Пример #1
0
 public TemplateMark()
 {
     json = new JSON();
     json["name"] = new QuoteString(null, '\'');
     json["sql"] = new QuoteString(null, '\'');
     json["xsl"] = new QuoteString(null, '\'');
     json["node"] = new QuoteString("div", '\'');
     json["params"] = new JSON();
 }
Пример #2
0
        /// <summary>
        /// 读取属性名称
        /// </summary>
        /// <param name="name">输出属性名称</param>
        public void ReadPropertyName(out QuoteString name)
        {
            ReadBlank();

            int ch = Read();
            int start = position;

            if (ch == '\'' || ch == '"')
            {
                name = new QuoteString(null, ch);
                ReadQuote(name.Quote, out name.Value);
                if (Current != ':')
                {
                    ReadBlank();
                    ch = Read();
                }
                if (ch != ':') throw new Exception("Should be ':'");
            }
            else
            {
                while ((ch = Read()) > -1)
                {
                    switch (ch)
                    {
                        case ':':
                        case ' ':
                        case '\r':
                        case '\n':
                        case '\t':
                            name = new QuoteString(origin.Substring(start - 1, position - start), -1);
                            if (Current != ':')
                            {
                                ReadBlank();
                                ch = Read();
                            }
                            if (ch != ':') throw new Exception("Should be ':'");
                            return;
                        default:
                            continue;
                    }
                }
                name = QuoteString.Null;
            }
        }
Пример #3
0
 public object this[string key]
 {
     get
     {
         List<QuoteString> keys = new List<QuoteString>(this.dic.Keys);
         QuoteString qs = keys.Find(delegate(QuoteString q) {
             if (q.Value == key) return true;
             return false;
         });
         if (qs == null || !this.dic.ContainsKey(qs)) return null;
         object value = this.dic[qs];
         if (value is QuoteString)
         {
             return ((QuoteString)value).Value;
         }
         else
         {
             return value;
         }
     }
     set
     {
         QuoteString qsKey = new QuoteString(key, -1);
         object v;
         if(value is string)
         {
             v = new QuoteString((string)value, '\'');
         } else {
             v = value;
         }
         if(dic.ContainsKey(qsKey))
         {
             dic[qsKey] = v;
         }
         else
         {
             this.Add(qsKey, v);
         }
     }
 }
Пример #4
0
 /// <summary>
 /// 添加值对
 /// </summary>
 /// <param name="key">键值</param>
 /// <param name="val">值</param>
 public void Add(QuoteString key, object val)
 {
     dic[key] = val;
 }