Diff for /parser3/src/classes/string.C between versions 1.149 and 1.151

version 1.149, 2005/11/22 12:14:36 version 1.151, 2007/02/03 18:08:38
Line 88  static void _double(Request& r, MethodPa Line 88  static void _double(Request& r, MethodPa
         r.write_no_lang(*new VDouble(converted));          r.write_no_lang(*new VDouble(converted));
 }  }
   
   static void _bool(Request& r, MethodParams& params) {
           const String& self_string=GET_SELF(r, VString).string();
           bool converted;
           try {
                   if(self_string.is_empty())
                           throw Exception("parser.runtime",
                                   0,
                                   "parameter is empty string, error converting");
                   converted=self_string.as_bool();
           } catch(...) { // convert problem
                   if(params.count()>0)
                           converted=params.as_bool(0, "default must be bool", r); // (default)
                   else
                           rethrow; // we have a problem when no default
           }
   
           r.write_no_lang(*new VBool(converted));
   }
   
 /*not static*/void _string_format(Request& r, MethodParams& params) {  /*not static*/void _string_format(Request& r, MethodParams& params) {
   
         Value& fmt_maybe_code=params[0];          Value& fmt_maybe_code=params[0];
Line 323  static void _match(Request& r, MethodPar Line 342  static void _match(Request& r, MethodPar
                         regexp.as_string(), options,                          regexp.as_string(), options,
                         search_action, 0,                          search_action, 0,
                         just_matched);                          just_matched);
                 Value* result;                  // Value* result;
                 if(table)                   // if(table) 
                         result=new VTable(table); // table of pre/match/post+substrings                  //      result=new VTable(table); // table of pre/match/post+substrings
                 else                   // else 
                         result=new VBool(just_matched);                  //      result=new VBool(just_matched);
                 r.write_assign_lang(*result);                  // r.write_assign_lang(*result);
                   r.write_assign_lang(*new VTable(table));
         } else { // replace          } else { // replace
                 Value& replacement_code=params.as_junction(2, "replacement param must be code");                  Value& replacement_code=params.as_junction(2, "replacement param must be code");
   
Line 613  MString::MString(): Methoded("string") { Line 633  MString::MString(): Methoded("string") {
         // ^string.double[]          // ^string.double[]
         // ^string.double(default)          // ^string.double(default)
         add_native_method("double", Method::CT_DYNAMIC, _double, 0, 1);          add_native_method("double", Method::CT_DYNAMIC, _double, 0, 1);
           // ^void.bool[]
           // ^void.bool(default)
           add_native_method("bool", Method::CT_DYNAMIC, _bool, 0, 1);
   
         // ^string.format{format}          // ^string.format{format}
         add_native_method("format", Method::CT_DYNAMIC, _string_format, 1, 1);          add_native_method("format", Method::CT_DYNAMIC, _string_format, 1, 1);

Removed from v.1.149  
changed lines
  Added in v.1.151


E-mail: