|
|
| version 1.17, 2024/10/04 05:12:05 | version 1.19, 2024/10/20 13:20:57 |
|---|---|
| Line 555 static void _right(Request& r, MethodPar | Line 555 static void _right(Request& r, MethodPar |
| } | } |
| static void _mid(Request& r, MethodParams& params) { | static void _mid(Request& r, MethodParams& params) { |
| const String& string=GET_SELF(r, VString).string(); | |
| int begin=params.as_int(0, "p must be int", r); | int begin=params.as_int(0, "p must be int", r); |
| if(begin<0) | if(begin<0) |
| throw Exception(PARSER_RUNTIME, 0, "p(%d) must be >=0", begin); | throw Exception(PARSER_RUNTIME, 0, "p(%d) must be >=0", begin); |
| size_t end; | |
| size_t length=0; | |
| if(params.count()>1) { | if(params.count()>1) { |
| int n=params.as_int(1, "n must be int", r); | int n=params.as_int(1, "n must be int", r); |
| if(n<0) | if(n<0) |
| Line 1025 static void _select(Request& r, MethodPa | Line 1021 static void _select(Request& r, MethodPa |
| r.write(*result); | r.write(*result); |
| } | } |
| static void _reverse(Request& r, MethodParams& params) { | static void _reverse(Request& r, MethodParams&) { |
| ArrayValue& source_array=GET_SELF(r, VArray).array(); | ArrayValue& source_array=GET_SELF(r, VArray).array(); |
| VArray& result=*new VArray(source_array.count()); | VArray& result=*new VArray(source_array.count()); |
| Line 1043 static void _reverse(Request& r, MethodP | Line 1039 static void _reverse(Request& r, MethodP |
| MArray::MArray(): Methoded(VARRAY_TYPE) { | MArray::MArray(): Methoded(VARRAY_TYPE) { |
| // ^array::create[[copy_from]] | // ^array::copy[[copy_from]] |
| add_native_method("create", Method::CT_DYNAMIC, _create_or_add, 0, 1); | add_native_method("copy", Method::CT_DYNAMIC, _create_or_add, 0, 1); |
| // ^array.add[add_from] | // ^array.add[add_from] |
| add_native_method("add", Method::CT_DYNAMIC, _create_or_add, 1, 1); | add_native_method("add", Method::CT_DYNAMIC, _create_or_add, 1, 1); |
| // ^array.join[join_from[;options]] | // ^array.join[join_from[;options]] |
| add_native_method("join", Method::CT_DYNAMIC, _join, 1, 2); | add_native_method("join", Method::CT_DYNAMIC, _join, 1, 2); |
| // ^array::create[value;value] | |
| add_native_method("create", Method::CT_DYNAMIC, _append, 0, 10000); | |
| // ^array.append[value;value] | |
| add_native_method("append", Method::CT_DYNAMIC, _append, 1, 10000); | |
| // ^array.insert[index;value...] | |
| add_native_method("insert", Method::CT_DYNAMIC, _insert, 2, 10000); | |
| // ^array.left(n) | // ^array.left(n) |
| add_native_method("left", Method::CT_DYNAMIC, _left, 1, 1); | add_native_method("left", Method::CT_DYNAMIC, _left, 1, 1); |
| // ^array.right(n) | // ^array.right(n) |
| Line 1058 MArray::MArray(): Methoded(VARRAY_TYPE) | Line 1061 MArray::MArray(): Methoded(VARRAY_TYPE) |
| // ^array.mid(p;n) | // ^array.mid(p;n) |
| add_native_method("mid", Method::CT_DYNAMIC, _mid, 1, 2); | add_native_method("mid", Method::CT_DYNAMIC, _mid, 1, 2); |
| // ^array::new[value;value] | |
| add_native_method("new", Method::CT_DYNAMIC, _append, 0, 10000); | |
| // ^array.append[value;value] | |
| add_native_method("append", Method::CT_DYNAMIC, _append, 1, 10000); | |
| // ^array.insert[index;value...] | |
| add_native_method("insert", Method::CT_DYNAMIC, _insert, 2, 10000); | |
| // ^array.delete[index] | // ^array.delete[index] |
| add_native_method("delete", Method::CT_DYNAMIC, _delete, 0, 1); | add_native_method("delete", Method::CT_DYNAMIC, _delete, 0, 1); |
| // ^array.remove[index] | // ^array.remove[index] |