Esempio n. 1
0
        private static NewMap readMap(Stream s, int len)
        {
            NewMap ret = new NewMap();

            for (int i = 0; i < len; i++)
            {
                Object key = readObject(s);
                Object val = readObject(s);
                ret [key] = val;
            }
            return(ret);
        }
Esempio n. 2
0
        public PStr a_kv(string fmt, params object[] args)
        {
            NewMap p      = new NewMap();
            int    length = args.Length;

            for (int i = 0; i < length; i = i + 2)
            {
                string key   = args [i].ToString();
                string value = args [i + 1].ToString();

                p [key] = value;
            }
            return(a(fmt, p));
        }
Esempio n. 3
0
        public static NewMap putKvs(NewMap map, params object[] kv)
        {
            for (int n = 0; n < kv.Length; n++)
            {
                object key = kv [n];
                n++;
                if (n >= kv.Length)
                {
                    return(map);
                }

                object val = kv [n];
                map [key] = val;
            }
            return(map);
        }
Esempio n. 4
0
        public static NewMap create(Hashtable map)
        {
            if (map is NewMap)
            {
                return((NewMap)map);
            }

            NewMap ret = new NewMap();

            foreach (System.Collections.DictionaryEntry d in map)
            {
                object key = d.Key;
                object val = d.Value;
                ret [key] = val;
            }
            return(ret);
        }
Esempio n. 5
0
        public PStr a(string fmt, NewMap map)
        {
            //StringBuilder sb = ObjPool.strs.borrowObject ();
            this.sb.Append(fmt);
            ICollection keys = map.Keys;

            foreach (string key in keys)
            {
                object val = map [key];

                string skey1 = "${" + key + "}";
                string sval1 = val.ToString();

                sb.Replace(skey1, sval1);

                string skey2 = "$[" + key + "]";
                string sval2 = "\"" + val.ToString() + "\"";
                sb.Replace(skey2, sval2);
            }

            return(this);
        }
Esempio n. 6
0
        public static NewMap create(params object[] args)
        {
            NewMap map = create();

            return(MapEx.putKvs(map, args));
        }