示例#1
0
 public String To_str(Object o) {
   if (o == null) return "<<NULL>>";
   Class<?> type = Type_adp_.ClassOf_obj(o);
   String rv = null;
   if (type == String.class) rv = String_.cast(o);
   else if (Int_.TypeMatch(type)) return Int_.To_str(Int_.cast(o));
   else if (Type_adp_.Eq(type, Bool_.Cls_ref_type)) return Yn.To_str(Bool_.cast(o));
   else if (type == DateAdp.class) return DateAdp_.cast(o).XtoStr_gplx();
   else rv = Object_.Xto_str_strict_or_empty(o);
   return String_.Replace(rv, "'", "''");
 }
示例#2
0
 public boolean ReadYn_toggle(String k, boolean cur) {
   Object rv = ReadOr(k, "!");
   if (rv == Nil) ThrowNotFound(k);
   if (!parse) throw Err_.new_wo_type("only parse supported");
   String rv_str = (String) rv;
   return (String_.Eq(rv_str, "!")) ? !cur : Yn.parse(rv_str);
 }
示例#3
0
 @gplx.Virtual
 protected Object ReadOr(String k, Object defaultOr) {
   if (args == null) return Nil; // WORKAROUND.gfui: args null for DataBndr_whenEvt_execCmd
   if (!String_.Eq(k, "")) {
     for (int i = 0; i < args.Count(); i++) {
       Keyval kv = (Keyval) args.Get_at(i);
       if (String_.Eq(k, kv.Key())) return kv.Val();
     }
   }
   if (counter >= args.Count()) return Nil;
   for (int i = 0; i < args.Count(); i++) {
     Keyval kv = (Keyval) args.Get_at(i);
     if (String_.Eq(kv.Key(), "") && i >= counter) {
       counter++;
       return kv.Val();
     }
   }
   return Nil;
 }
示例#4
0
 public GfoMsg Args_ovr(String k, Object v) {
   if (args == null) args = List_adp_.New();
   for (int i = 0; i < args.Count(); i++) {
     Keyval kv = (Keyval) args.Get_at(i);
     if (String_.Eq(k, kv.Key())) {
       kv.Val_(v);
       return this;
     }
   }
   args.Add(Keyval_.new_(k, v));
   return this;
 }
示例#5
0
 public String[] ReadStrAryIgnore(String k, String spr, String ignore) {
   return String_.Split(String_.Replace(ReadStr(k), ignore, ""), spr);
 }
示例#6
0
 public String[] ReadStrAry(String k, String spr) {
   return String_.Split(ReadStr(k), spr);
 }
示例#7
0
	public static String Escape_tilde(String v) {return String_.Replace(v, "~", "~~");}
示例#8
0
	int Compile_eval_cmd(byte[] fmt, int fmt_len, int eval_lhs_bgn, List_adp list) {
		int eval_lhs_end = Bry_finder.Find_fwd(fmt, char_eval_end, eval_lhs_bgn + Int_.Const_dlm_len, fmt_len); if (eval_lhs_end == Bry_.NotFound) throw Err_mgr._.fmt_(GRP_KEY, "eval_lhs_end_invalid", "could not find eval_lhs_end: ~{0}", String_.new_u8(fmt, eval_lhs_bgn, fmt_len));
		byte[] eval_dlm = Bry_.Mid(fmt, eval_lhs_bgn		, eval_lhs_end + Int_.Const_dlm_len);
		int eval_rhs_bgn = Bry_finder.Find_fwd(fmt, eval_dlm		, eval_lhs_end + Int_.Const_dlm_len, fmt_len); if (eval_rhs_bgn == Bry_.NotFound) throw Err_mgr._.fmt_(GRP_KEY, "eval_rhs_bgn_invalid", "could not find eval_rhs_bgn: ~{0}", String_.new_u8(fmt, eval_lhs_end, fmt_len));
		byte[] eval_cmd = Bry_.Mid(fmt, eval_lhs_end + Int_.Const_dlm_len, eval_rhs_bgn);
		byte[] eval_rslt = eval_mgr.Eval(eval_cmd);
		int eval_rhs_end = eval_rhs_bgn + Int_.Const_dlm_len + eval_dlm.length;
		if (eval_rslt == null) eval_rslt = Bry_.Mid(fmt, eval_lhs_bgn - 2, eval_rhs_end);	// not found; return original argument
		list.Add(Bry_fmtr_itm.dat_bry_(eval_rslt));
		return eval_rhs_end;
	}
示例#9
0
 public static IptKeyChain parse(String raw) {
   String[] itms = String_.Split(raw, ",");
   IptArg[] rv = new IptArg[itms.length];
   for (int i = 0; i < rv.length; i++) rv[i] = IptArg_.parse(String_.Trim(itms[i]));
   return new IptKeyChain(rv);
 }
示例#10
0
 public boolean Eq(IptArg comp) {
   return String_.Eq(key, comp.Key());
 }
示例#11
0
 public void Test_load_page(int ns_id, int page_id, String expd) {
   Xowe_wiki wiki = bldr_fxt.Wiki();
   Xow_ns ns = wiki.Ns_mgr().Ids_get_or_null(ns_id);
   wiki.Db_mgr_as_sql().Load_mgr().Load_page(actl.Id_(page_id), ns, false);
   Tfds.Eq(expd, String_.new_a7(actl.Text()));
 }