Extract all the values for 'key' where objects in 'queue' contain that key. Replace the contents of queue with the values found.
| 158 | // Extract all the values for 'key' where objects in 'queue' contain that key. |
| 159 | // Replace the contents of queue with the values found. |
| 160 | static void SelectByKey(const string& key, JsonUdfValue* queue, |
| 161 | JsonUdfAllocator* allocator) { |
| 162 | SizeType old_items = queue->Size(); // RapidJson uses SizeType instead of size_t |
| 163 | JsonUdfValue item; |
| 164 | for (SizeType i = 0; i < old_items; ++i) { |
| 165 | item = (*queue)[i]; |
| 166 | if (!item.IsObject() || !item.HasMember(key)) continue; |
| 167 | queue->PushBack(item[key], *allocator); |
| 168 | } |
| 169 | queue->Erase(queue->Begin(), queue->Begin() + old_items); |
| 170 | } |
| 171 | |
| 172 | // Extract all the values for 'index' where arrays in 'queue' contain that index. |
| 173 | // Replace the contents of queue with the values found. |
no test coverage detected