|
|
| version 1.78, 2001/10/09 07:06:00 | version 1.80, 2001/10/11 10:21:44 |
|---|---|
| Line 410 static void _sql(Request& r, const Strin | Line 410 static void _sql(Request& r, const Strin |
| "default option must be code"); | "default option must be code"); |
| string=r.process(*vdefault).get_string(); | string=r.process(*vdefault).get_string(); |
| if(!string) | if(!string) |
| string=empty_string; | string=new(pool) String(pool); |
| } else | } else |
| PTHROW(0, 0, | PTHROW(0, 0, |
| &method_name, | &method_name, |
| Line 438 static void _replace(Request& r, const S | Line 438 static void _replace(Request& r, const S |
| Dictionary dict(*table); | Dictionary dict(*table); |
| r.write_assign_lang(*new(pool) VString(src.replace(pool, dict))); | r.write_assign_lang(*new(pool) VString(src.replace(pool, dict))); |
| } | } |
| static void _save(Request& r, const String& method_name, MethodParams *params) { | |
| Pool& pool=r.pool(); | |
| Value& vfile_name=params->as_no_junction(0, | |
| "file name must not be code"); | |
| const String& src=*static_cast<VString *>(r.self)->get_string(); | |
| // write | |
| file_write(pool, r.absolute(vfile_name.as_string()), | |
| src.cstr(String::UL_AS_IS), src.size(), true); | |
| } | |
| // constructor | // constructor |
| MString::MString(Pool& apool) : Methoded(apool) { | MString::MString(Pool& apool) : Methoded(apool) { |
| Line 487 MString::MString(Pool& apool) : Methoded | Line 500 MString::MString(Pool& apool) : Methoded |
| // ^string.replace[table] | // ^string.replace[table] |
| add_native_method("replace", Method::CT_DYNAMIC, _replace, 1, 1); | add_native_method("replace", Method::CT_DYNAMIC, _replace, 1, 1); |
| // ^string.save[file] | |
| add_native_method("save", Method::CT_DYNAMIC, _save, 1, 1); | |
| } | } |
| // global variable | // global variable |