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

Function LoadCountriesFromBuffer

libs/storage/country_tree.cpp:400–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

398}
399
400int64_t LoadCountriesFromBuffer(string const & jsonBuffer, CountryTree & countries, Affiliations & affiliations,
401 CountryNameSynonyms & countryNameSynonyms, MwmTopCityGeoIds & mwmTopCityGeoIds,
402 MwmTopCountryGeoIds & mwmTopCountryGeoIds, std::string & mapSeries)
403{
404 countries.Clear();
405 affiliations.clear();
406
407 int64_t version = -1;
408 try
409 {
410 base::Json root(jsonBuffer.c_str());
411 FromJSONObject(root.get(), "v", version);
412 FromJSONObjectOptionalField(root.get(), "map_series", mapSeries);
413
414 LOG(LDEBUG, ("COUNTRIES: loaded and parsed map version", version, "mapSeries", mapSeries));
415
416 StoreCountries store(countries, affiliations, countryNameSynonyms, mwmTopCityGeoIds, mwmTopCountryGeoIds);
417 if (!LoadCountriesImpl(jsonBuffer, store))
418 return -1;
419 }
420 catch (base::Json::Exception const & e)
421 {
422 LOG(LWARNING, (e.Msg()));
423 }
424 return version;
425}
426
427namespace
428{

Callers 5

StorageMethod · 0.85
LoadCountriesFromFileFunction · 0.85

Calls 6

LoadCountriesImplFunction · 0.85
getMethod · 0.65
FromJSONObjectFunction · 0.50
ClearMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected