|
|
| version 1.22, 2024/10/23 16:41:11 | version 1.24, 2024/10/26 00:21:02 |
|---|---|
| Line 63 static void _create_or_add(Request& r, M | Line 63 static void _create_or_add(Request& r, M |
| self_array.put(VArray::index(i.key()), i.value()); | self_array.put(VArray::index(i.key()), i.value()); |
| } | } |
| } | } |
| self.invalidate(); | self_array.invalidate(); |
| } | } |
| } | } |
| Line 145 static void _join(Request& r, MethodPara | Line 145 static void _join(Request& r, MethodPara |
| } | } |
| } | } |
| } | } |
| self.invalidate(); | self_array.invalidate(); |
| } | } |
| #ifndef DOXYGEN | #ifndef DOXYGEN |
| Line 494 static void _sql(Request& r, MethodParam | Line 494 static void _sql(Request& r, MethodParam |
| VArray& self=GET_SELF(r, VArray); | VArray& self=GET_SELF(r, VArray); |
| ArrayValue& array=self.array(); | ArrayValue& array=self.array(); |
| array.clear(); self.invalidate(); // just in case if called as method | if(array.count()){ |
| array.clear(); array.invalidate(); // just in case if called as method | |
| } | |
| if(sparse){ | if(sparse){ |
| SparseArray_sql_event_handlers handlers(distinct, array, value_type); | SparseArray_sql_event_handlers handlers(distinct, array, value_type); |
| Line 607 static void _count(Request& r, MethodPar | Line 609 static void _count(Request& r, MethodPar |
| } | } |
| static void _append(Request& r, MethodParams& params) { | static void _append(Request& r, MethodParams& params) { |
| VArray& self=GET_SELF(r, VArray); | ArrayValue& array=GET_SELF(r, VArray).array(); |
| ArrayValue& array=self.array(); | |
| int count=params.count(); | int count=params.count(); |
| for(int i=0; i<count; i++){ | for(int i=0; i<count; i++){ |
| array+=&r.process(params[i]); | array+=&r.process(params[i]); |
| } | } |
| self.invalidate(); | array.invalidate(); |
| } | } |
| static void _insert(Request& r, MethodParams& params) { | static void _insert(Request& r, MethodParams& params) { |
| VArray& self=GET_SELF(r, VArray); | ArrayValue& array=GET_SELF(r, VArray).array(); |
| ArrayValue& array=self.array(); | |
| int count=params.count(); | int count=params.count(); |
| size_t index=VArray::index(params.as_int(0, PARAM_INDEX, r)); | size_t index=VArray::index(params.as_int(0, PARAM_INDEX, r)); |
| Line 628 static void _insert(Request& r, MethodPa | Line 628 static void _insert(Request& r, MethodPa |
| for(int i=1; i<count; i++){ | for(int i=1; i<count; i++){ |
| array.insert(index++, &r.process(params[i])); | array.insert(index++, &r.process(params[i])); |
| } | } |
| self.invalidate(); | array.invalidate(); |
| } | } |
| static void _delete(Request& r, MethodParams& params) { | static void _delete(Request& r, MethodParams& params) { |
| VArray& self=GET_SELF(r, VArray); | ArrayValue& array=GET_SELF(r, VArray).array(); |
| if(params.count()>0) | if(params.count()>0) |
| self.array().clear(VArray::index(params.as_int(0, PARAM_INDEX, r))); | array.clear(VArray::index(params.as_int(0, PARAM_INDEX, r))); |
| else | else |
| self.array().clear(); | array.clear(); |
| self.invalidate(); | array.invalidate(); |
| } | } |
| static void _remove(Request& r, MethodParams& params) { | static void _remove(Request& r, MethodParams& params) { |
| VArray& self=GET_SELF(r, VArray); | ArrayValue& array=GET_SELF(r, VArray).array(); |
| self.array().remove(VArray::index(params.as_int(0, PARAM_INDEX, r))); | array.remove(VArray::index(params.as_int(0, PARAM_INDEX, r))); |
| self.invalidate(); | array.invalidate(); |
| } | } |
| static void _contains(Request& r, MethodParams& params) { | static void _contains(Request& r, MethodParams& params) { |
| Line 856 static void _sort(Request& r, MethodPara | Line 856 static void _sort(Request& r, MethodPara |
| for(pos=0; pos<count; pos++) | for(pos=0; pos<count; pos++) |
| array+=seq[pos].array_data; | array+=seq[pos].array_data; |
| self.invalidate(); | array.invalidate(); |
| delete[] seq; | delete[] seq; |
| } | } |
| Line 1034 static void _reverse(Request& r, MethodP | Line 1034 static void _reverse(Request& r, MethodP |
| r.write(result); | r.write(result); |
| } | } |
| static void _compact(Request& r, MethodParams&) { | static void _compact(Request& r, MethodParams& params) { |
| GET_SELF(r, VArray).array().compact(); | bool compact_undef=false; |
| if(params.count()>0){ | |
| const String& what=params.as_string(0, PARAMETER_MUST_BE_STRING); | |
| if(!what.is_empty()){ | |
| if(what != "undef") | |
| throw Exception(PARSER_RUNTIME, &what, "param must be empty or 'undef'"); | |
| compact_undef=true; | |
| } | |
| } | |
| GET_SELF(r, VArray).array().compact(compact_undef); | |
| } | } |
| Line 1097 MArray::MArray(): Methoded(VARRAY_TYPE) | Line 1106 MArray::MArray(): Methoded(VARRAY_TYPE) |
| // ^array.reverse[] | // ^array.reverse[] |
| add_native_method("reverse", Method::CT_DYNAMIC, _reverse, 0, 0); | add_native_method("reverse", Method::CT_DYNAMIC, _reverse, 0, 0); |
| // ^array.compact[] | // ^array.compact[[undef]] |
| add_native_method("compact", Method::CT_DYNAMIC, _compact, 0, 0); | add_native_method("compact", Method::CT_DYNAMIC, _compact, 0, 1); |
| // ^array._at[first|last[;'key'|'value'|'hash']] | // ^array._at[first|last[;'key'|'value'|'hash']] |
| // ^array._at([-+]offset)[['key'|'value'|'hash']] | // ^array._at([-+]offset)[['key'|'value'|'hash']] |