Extract all the values for 'index' where arrays in 'queue' contain that index. Replace the contents of queue with the values found.
| 172 | // Extract all the values for 'index' where arrays in 'queue' contain that index. |
| 173 | // Replace the contents of queue with the values found. |
| 174 | static void SelectByIndex(const int index, JsonUdfValue* queue, |
| 175 | JsonUdfAllocator* allocator) { |
| 176 | DCHECK(queue->IsArray()); |
| 177 | SizeType old_items = queue->Size(); |
| 178 | for (SizeType i = 0; i < old_items; ++i) { |
| 179 | JsonUdfValue& item = (*queue)[i]; |
| 180 | if (!item.IsArray() || index >= item.Capacity()) continue; |
| 181 | queue->PushBack(item[index], *allocator); |
| 182 | } |
| 183 | queue->Erase(queue->Begin(), queue->Begin() + old_items); |
| 184 | } |
| 185 | |
| 186 | // Expand all arrays in the queue and replace the contents of queue with them. |
| 187 | static void ExpandArrays(JsonUdfValue* queue, JsonUdfAllocator* allocator) { |