| 304 | |
| 305 | template <typename T, typename F, typename Filter> |
| 306 | static cmJSONHelper<std::vector<T>> VectorFilter( |
| 307 | JsonErrors::ErrorGenerator const& error, F func, Filter filter) |
| 308 | { |
| 309 | return [error, func, filter](std::vector<T>& out, Json::Value const* value, |
| 310 | cmJSONState* state) -> bool { |
| 311 | bool success = true; |
| 312 | if (!value) { |
| 313 | out.clear(); |
| 314 | return true; |
| 315 | } |
| 316 | if (!value->isArray()) { |
| 317 | error(value, state); |
| 318 | return false; |
| 319 | } |
| 320 | out.clear(); |
| 321 | int index = 0; |
| 322 | for (auto const& item : *value) { |
| 323 | state->push_stack(cmStrCat("$vector_item_", index++), &item); |
| 324 | T t; |
| 325 | if (!func(t, &item, state)) { |
| 326 | success = false; |
| 327 | } |
| 328 | if (!filter(t)) { |
| 329 | state->pop_stack(); |
| 330 | continue; |
| 331 | } |
| 332 | out.push_back(std::move(t)); |
| 333 | state->pop_stack(); |
| 334 | } |
| 335 | return success; |
| 336 | }; |
| 337 | } |
| 338 | |
| 339 | template <typename T, typename F> |
| 340 | static cmJSONHelper<std::vector<T>> Vector(JsonErrors::ErrorGenerator error, |
nothing calls this directly
no test coverage detected
searching dependent graphs…