|
|
| version 1.2, 2024/09/10 20:48:15 | version 1.4, 2024/09/16 23:22:52 |
|---|---|
| Line 41 static void _create_or_add(Request& r, M | Line 41 static void _create_or_add(Request& r, M |
| VArray& self=GET_SELF(r, VArray); | VArray& self=GET_SELF(r, VArray); |
| ArrayValue& self_array=self.array(); | ArrayValue& self_array=self.array(); |
| if(VArray* src=static_cast<VArray*>(vsrc.as(VARRAY_TYPE))) { | if(VArray* src=dynamic_cast<VArray*>(&vsrc)) { |
| ArrayValue& src_array =src->array(); | ArrayValue& src_array =src->array(); |
| if(&src_array==&self_array) // same: doing nothing | if(&src_array==&self_array) // same: doing nothing |
| return; | return; |
| Line 51 static void _create_or_add(Request& r, M | Line 51 static void _create_or_add(Request& r, M |
| for(HashStringValue::Iterator i(*src_hash); i; i.next()) | for(HashStringValue::Iterator i(*src_hash); i; i.next()) |
| self_array+=i.value(); | self_array+=i.value(); |
| } | } |
| self.clear_hash(); | self.invalidate(); |
| } | } |
| } | } |
| Line 89 static void _keys(Request& r, MethodPara | Line 89 static void _keys(Request& r, MethodPara |
| } | } |
| static void _count(Request& r, MethodParams&) { | static void _count(Request& r, MethodParams&) { |
| r.write(*new VInt(GET_SELF(r, VArray).count())); | r.write(*new VInt(GET_SELF(r, VArray).array().used())); |
| } | } |
| static void _append(Request& r, MethodParams& params) { | static void _append(Request& r, MethodParams& params) { |
| Line 101 static void _append(Request& r, MethodPa | Line 101 static void _append(Request& r, MethodPa |
| 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.clear_hash(); | self.invalidate(); |
| } | } |
| static void _insert(Request& r, MethodParams& params) { | static void _insert(Request& r, MethodParams& params) { |
| Line 114 static void _insert(Request& r, MethodPa | Line 114 static void _insert(Request& r, MethodPa |
| for(int i=1; i<count; i++){ | for(int i=1; i<count; i++){ |
| array.insert(index+i-1, &r.process(params[i])); | array.insert(index+i-1, &r.process(params[i])); |
| } | } |
| self.clear_hash(); | self.invalidate(); |
| } | } |
| static void _delete(Request& r, MethodParams& params) { | static void _delete(Request& r, MethodParams& params) { |
| Line 245 static void _sort(Request& r, MethodPara | Line 245 static void _sort(Request& r, MethodPara |
| VArray& self=GET_SELF(r, VArray); | VArray& self=GET_SELF(r, VArray); |
| ArrayValue& array=self.array(); | ArrayValue& array=self.array(); |
| int count=self.count(); // not array.count() | int count=array.used(); // not array.count() |
| Array_seq_item* seq=new Array_seq_item[count]; | Array_seq_item* seq=new Array_seq_item[count]; |
| int pos=0; | int pos=0; |
| Line 294 static void _sort(Request& r, MethodPara | Line 294 static void _sort(Request& r, MethodPara |
| static void _at(Request& r, MethodParams& params) { | static void _at(Request& r, MethodParams& params) { |
| VArray& self=GET_SELF(r, VArray); | VArray& self=GET_SELF(r, VArray); |
| ArrayValue& array=self.array(); | ArrayValue& array=self.array(); |
| size_t count=self.count(); | size_t count=array.count(); |
| int pos=0; | int pos=0; |
| Line 448 static void _reverse(Request& r, MethodP | Line 448 static void _reverse(Request& r, MethodP |
| VArray& result=*new VArray(count); | VArray& result=*new VArray(count); |
| ArrayValue& result_array=result.array(); | ArrayValue& result_array=result.array(); |
| for(ArrayValue::Iterator i(source_array); i; ){ | for(ArrayValue::ReverseIterator i(source_array); i; ){ |
| Value *v=i.next(); | result_array+=i.prev(); |
| if(v){ | |
| result_array.fit(count-i.index() /* no -1 as .next() is called */, v); | |
| } | |
| } | } |
| r.write(result); | r.write(result); |