|
|
| version 1.126, 2003/07/24 11:31:20 | version 1.129, 2003/11/20 16:34:23 |
|---|---|
| Line 5 | Line 5 |
| Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) | Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru) |
| */ | */ |
| static const char* IDENT_STRING_C="$Date$"; | static const char * const IDENT_STRING_C="$Date$"; |
| #include "classes.h" | #include "classes.h" |
| #include "pa_vmethod_frame.h" | #include "pa_vmethod_frame.h" |
| Line 111 static void _right(Request& r, MethodPar | Line 111 static void _right(Request& r, MethodPar |
| size_t n=(size_t)params.as_int(0, "n must be int", r); | size_t n=(size_t)params.as_int(0, "n must be int", r); |
| const String& string=GET_SELF(r, VString).string(); | const String& string=GET_SELF(r, VString).string(); |
| r.write_assign_lang(string.mid(string.length()-n, string.length())); | size_t length=string.length(); |
| r.write_assign_lang(n<length?string.mid(length-n, string.length()):string); | |
| } | } |
| static void _mid(Request& r, MethodParams& params) { | static void _mid(Request& r, MethodParams& params) { |
| Line 131 static void _pos(Request& r, MethodParam | Line 132 static void _pos(Request& r, MethodParam |
| r.write_assign_lang(*new VInt((int)string.pos(substr.as_string()))); | r.write_assign_lang(*new VInt((int)string.pos(substr.as_string()))); |
| } | } |
| static void split_list(Request& r, | static void split_list(MethodParams& params, int paramIndex, |
| MethodParams& params, int paramIndex, | |
| const String& string, | const String& string, |
| ArrayString& result) { | ArrayString& result) { |
| Value& delim_value=params.as_no_junction(paramIndex, "delimiter must not be code"); | Value& delim_value=params.as_no_junction(paramIndex, "delimiter must not be code"); |
| Line 176 static int split_options(const String* o | Line 176 static int split_options(const String* o |
| return result; | return result; |
| } | } |
| static Table& split_vertical(Request& r, ArrayString& pieces, bool right) { | static Table& split_vertical(ArrayString& pieces, bool right) { |
| Table::columns_type columns(new ArrayString); | Table::columns_type columns(new ArrayString); |
| *columns+=new String("piece"); | *columns+=new String("piece"); |
| Line 200 static Table& split_vertical(Request& r, | Line 199 static Table& split_vertical(Request& r, |
| return table; | return table; |
| } | } |
| static Table& split_horizontal(Request& r, ArrayString& pieces, bool right) { | static Table& split_horizontal(ArrayString& pieces, bool right) { |
| Table& table=*new Table(Table::columns_type(0) /* nameless */); | Table& table=*new Table(Table::columns_type(0) /* nameless */); |
| Table::element_type row(new ArrayString(pieces.count())); | Table::element_type row(new ArrayString(pieces.count())); |
| if(right) { // right | if(right) { // right |
| Line 220 static void split_with_options(Request& | Line 219 static void split_with_options(Request& |
| const String& string=GET_SELF(r, VString).string(); | const String& string=GET_SELF(r, VString).string(); |
| ArrayString pieces; | ArrayString pieces; |
| split_list(r, params, 0, string, pieces); | split_list(params, 0, string, pieces); |
| if(!bits) { | if(!bits) { |
| const String* options=0; | const String* options=0; |
| Line 232 static void split_with_options(Request& | Line 231 static void split_with_options(Request& |
| bool right=(bits & SPLIT_RIGHT) != 0; | bool right=(bits & SPLIT_RIGHT) != 0; |
| bool horizontal=(bits & SPLIT_HORIZONTAL) !=0; | bool horizontal=(bits & SPLIT_HORIZONTAL) !=0; |
| Table& table=horizontal?split_horizontal(r, pieces, right) | Table& table=horizontal?split_horizontal(pieces, right) |
| :split_vertical(r, pieces, right); | :split_vertical(pieces, right); |
| r.write_no_lang(*new VTable(&table)); | r.write_no_lang(*new VTable(&table)); |
| } | } |
| Line 328 static void _match(Request& r, MethodPar | Line 327 static void _match(Request& r, MethodPar |
| } | } |
| } | } |
| static void change_case(Request& r, MethodParams& params, | static void change_case(Request& r, MethodParams&, |
| String::Change_case_kind kind) { | String::Change_case_kind kind) { |
| const String& src=GET_SELF(r, VString).string(); | const String& src=GET_SELF(r, VString).string(); |
| Line 356 public: | Line 355 public: |
| got_cell(false), | got_cell(false), |
| result(*new String) {} | result(*new String) {} |
| bool add_column(SQL_Error& error, const char* str, size_t /*length*/) { | bool add_column(SQL_Error& error, const char* /*str*/, size_t /*length*/) { |
| if(got_column) { | if(got_column) { |
| error=SQL_Error("parser.runtime", | error=SQL_Error("parser.runtime", |
| //statement_string, | //statement_string, |