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

Method ApplyCountries

libs/storage/storage.cpp:1407–1439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1405}
1406
1407void Storage::ApplyCountries(std::string const & countriesBuffer, Storage & storage)
1408{
1409 CHECK_THREAD_CHECKER(m_threadChecker, ());
1410
1411 /// @todo Or don't skip, but apply new data in OnFinishDownloading().
1412 if (storage.m_currentVersion <= m_currentVersion || !m_downloadingCountries.empty() || !m_diffsBeingApplied.empty())
1413 return;
1414
1415 {
1416 // Save file to the WritableDir (LoadCountriesFile checks it first).
1417 FileWriter writer(base::JoinPath(GetPlatform().WritableDir(), COUNTRIES_FILE));
1418 writer.Write(countriesBuffer.data(), countriesBuffer.size());
1419 }
1420
1421 m_currentVersion = storage.m_currentVersion;
1422 m_downloader->SetDataVersion(m_currentVersion);
1423
1424 m_countries = std::move(storage.m_countries);
1425
1426 /// @todo The best way is to restart the app after ApplyCountries.
1427 // Do not to update this information containers to avoid possible races.
1428 // Affiliations, synonyms, etc can be updated with the app update.
1429 // m_affiliations = std::move(storage.m_affiliations);
1430 // m_countryNameSynonyms = std::move(storage.m_countryNameSynonyms);
1431 // m_mwmTopCityGeoIds = std::move(storage.m_mwmTopCityGeoIds);
1432 // m_mwmTopCountryGeoIds = std::move(storage.m_mwmTopCountryGeoIds);
1433
1434 LOG(LDEBUG, ("Version", m_currentVersion, "is applied"));
1435
1436 // LoadDiffScheme();
1437
1438 /// @todo Start World and WorldCoasts download ?!
1439}
1440
1441CountryId const Storage::GetRootId() const
1442{

Callers

nothing calls this directly

Calls 6

JoinPathFunction · 0.85
SetDataVersionMethod · 0.80
emptyMethod · 0.45
WriteMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected