| 496 | } |
| 497 | template <typename F> |
| 498 | td::Status iterate_array(F &&run) { |
| 499 | if (!is_array()) { |
| 500 | return td::Status::Error(ton::ErrorCode::protoviolation, PSTRING() << path << " must be an array"); |
| 501 | } |
| 502 | size_t idx = 0; |
| 503 | for (auto &x : *obj) { |
| 504 | TRY_STATUS(run(std::make_unique<CtxLevel>(&x, PSTRING() << path << "[" << (idx++) << "]"))); |
| 505 | } |
| 506 | return td::Status::OK(); |
| 507 | } |
| 508 | |
| 509 | bool is_string() { |
| 510 | switch (mode) { |