MCPcopy Create free account
hub / github.com/comaps/comaps / ParseFeatureToBrand

Function ParseFeatureToBrand

generator/brands_loader.cpp:29–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27DECLARE_EXCEPTION(ParsingError, RootException);
28
29static 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
49void ParseTranslations(json_t * root, std::set<string> const & keys, map<uint32_t, string> & idToKey)
50{

Callers 1

LoadBrandsFunction · 0.85

Calls 1

GetJSONOptionalFieldFunction · 0.85

Tested by

no test coverage detected