SqlRule.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SQLFormatter
{
    class SqlRule
    {
        /** キーワードの変換規則. */
        public int keyword = KEYWORD_UPPER_CASE;

        /** キーワードの変換規則:何もしない */
        public const int KEYWORD_NONE = 0;

        /** キーワードの変換規則:大文字にする */
        public const int KEYWORD_UPPER_CASE = 1;

        /** キーワードの変換規則:小文字にする */
        public const int KEYWORD_LOWER_CASE = 2;

        /**
         * インデントの文字列. 設定は自由入力とする。通常は " ", " ", "\t" のいずれか。
         */
        public String indentString = "    ";

        /**
         * 関数の名前。
         */
        private String[] fFunctionNames = null;

        public void setKeywordCase(int keyword) {
            this.keyword = keyword;
        }

        /**
         * 関数の名前か?
         * 
         * @param name
         *            調べる名前
         * @return 関数の名前のとき、<code>true</code> を返す。
         */
        public bool isFunction(String name) {
            if (fFunctionNames == null)
                return false;
            for (int i = 0; i < fFunctionNames.Length; i++) {
                if(fFunctionNames[i].Equals(name, StringComparison.CurrentCultureIgnoreCase))
                    return true;
            }
            return false;
        }

        /**
         * 関数の名前の配列を登録します。
         * 
         * @param names
         *            関数名の配列。null可。
         */
        public void setFunctionNames(String[] names) {
            fFunctionNames = names;
        }
    }
}