| 27 | DECLARE_EXCEPTION(ParsingError, RootException); |
| 28 | |
| 29 | static void ParseFeatureToBrand(json_t * root, string const & field, GeoObjectId::Type type, |
| 30 | vector<pair<GeoObjectId, uint32_t>> & result) |
| 31 | { |
| 32 | auto arr = base::GetJSONOptionalField(root, field); |
| 33 | if (arr == nullptr) |
| 34 | return; |
| 35 | |
| 36 | char const * key; |
| 37 | json_t * value; |
| 38 | json_object_foreach(arr, key, value) |
| 39 | { |
| 40 | result.emplace_back(); |
| 41 | uint64_t id; |
| 42 | if (!strings::to_uint64(key, id)) |
| 43 | MYTHROW(ParsingError, ("Incorrect OSM id:", key)); |
| 44 | result.back().first = GeoObjectId(type, id); |
| 45 | FromJSON(value, result.back().second); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | void ParseTranslations(json_t * root, std::set<string> const & keys, map<uint32_t, string> & idToKey) |
| 50 | { |
no test coverage detected