uint64_t ReadVersionFromHeader(platform::LocalCountryFile const & mwm) { vector<string> specialFiles = { WORLD_FILE_NAME, WORLD_COASTS_FILE_NAME, WORLD_COASTS_OBSOLETE_FILE_NAME }; for (auto const & name : specialFiles) { if (mwm.GetCountryName() == name) return mwm.GetVersion(); } ModelReaderPtr reader = FilesContainerR(mwm.GetPath(MapOptions::Map)).GetReader(VERSION_FILE_TAG); ReaderSrc src(reader.GetPtr()); version::MwmVersion version; version::ReadVersion(src, version); return version.GetVersion(); }
void Editor::OnMapDeregistered(platform::LocalCountryFile const & localFile) { // TODO: to add some synchronization mechanism for whole Editor class lock_guard<mutex> g(m_mapDeregisteredMutex); using TFeaturePair = decltype(m_features)::value_type; // Cannot search by MwmId because country already removed. So, search by country name. auto const matchedMwm = find_if(begin(m_features), end(m_features), [&localFile](TFeaturePair const & item) { return item.first.GetInfo()->GetCountryName() == localFile.GetCountryName(); }); if (m_features.end() != matchedMwm) { m_features.erase(matchedMwm); Save(); } }