| 398 | } |
| 399 | |
| 400 | int64_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 | |
| 427 | namespace |
| 428 | { |
no test coverage detected