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); }
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)); }
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); }
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); }
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); }
public static NewMap create(params object[] args) { NewMap map = create(); return(MapEx.putKvs(map, args)); }