diff --git a/partners_api/downloader_promo.cpp b/partners_api/downloader_promo.cpp index acad44b48e..6574349ef7 100644 --- a/partners_api/downloader_promo.cpp +++ b/partners_api/downloader_promo.cpp @@ -18,7 +18,7 @@ DownloaderPromo::Banner DownloaderPromo::GetBanner(storage::Storage const & stor if (!hasRemoveAdsSubscription && ads::HasMegafonDownloaderBanner(storage, mwmId, currentLocale)) return {Type::Megafon, ads::GetMegafonDownloaderBannerUrl()}; - auto const & cities = storage.GetPromoCatalogCities(); + auto const & cities = storage.GetMwmTopCityGeoIds(); auto const it = cities.find(mwmId); if (it != cities.cend()) diff --git a/search/region_info_getter.cpp b/search/region_info_getter.cpp index 91ade3a25c..4338155057 100644 --- a/search/region_info_getter.cpp +++ b/search/region_info_getter.cpp @@ -44,9 +44,9 @@ void RegionInfoGetter::LoadCountriesTree() { storage::Affiliations affiliations; storage::CountryNameSynonyms countryNameSynonyms; - storage::PromoCatalogCities promoCatalogCities; + storage::MwmTopCityGeoIds mwmTopCityGeoIds; storage::LoadCountriesFromFile(COUNTRIES_FILE, m_countries, affiliations, countryNameSynonyms, - promoCatalogCities); + mwmTopCityGeoIds); } void RegionInfoGetter::SetLocale(string const & locale) diff --git a/storage/country_tree.cpp b/storage/country_tree.cpp index 49769add01..58a329cba0 100644 --- a/storage/country_tree.cpp +++ b/storage/country_tree.cpp @@ -37,7 +37,7 @@ public: virtual void InsertOldMwmMapping(CountryId const & newId, CountryId const & oldId) = 0; virtual void InsertAffiliation(CountryId const & countryId, string const & affilation) = 0; virtual void InsertCountryNameSynonym(CountryId const & countryId, string const & synonym) = 0; - virtual void InsertPromoCatalogCity(CountryId const & countryId, uint64_t const & geoObjectId) {} + virtual void InsertMwmTopCityGeoId(CountryId const & countryId, uint64_t const & geoObjectId) {} virtual OldMwmMapping GetMapping() const = 0; }; @@ -46,17 +46,17 @@ class StoreCountriesSingleMwms : public StoreSingleMwmInterface CountryTree & m_countries; Affiliations & m_affiliations; CountryNameSynonyms & m_countryNameSynonyms; - PromoCatalogCities & m_promoCatalogCities; + MwmTopCityGeoIds & m_mwmTopCityGeoIds; OldMwmMapping m_idsMapping; public: StoreCountriesSingleMwms(CountryTree & countries, Affiliations & affiliations, CountryNameSynonyms & countryNameSynonyms, - PromoCatalogCities & promoCatalogCities) + MwmTopCityGeoIds & mwmTopCityGeoIds) : m_countries(countries) , m_affiliations(affiliations) , m_countryNameSynonyms(countryNameSynonyms) - , m_promoCatalogCities(promoCatalogCities) + , m_mwmTopCityGeoIds(mwmTopCityGeoIds) { } ~StoreCountriesSingleMwms() @@ -104,12 +104,12 @@ public: m_countryNameSynonyms[synonym] = countryId; } - void InsertPromoCatalogCity(CountryId const & countryId, uint64_t const & geoObjectId) override + void InsertMwmTopCityGeoId(CountryId const & countryId, uint64_t const & geoObjectId) override { ASSERT(!countryId.empty(), ()); ASSERT_NOT_EQUAL(geoObjectId, 0, ()); base::GeoObjectId id(geoObjectId); - m_promoCatalogCities.emplace(countryId, move(id)); + m_mwmTopCityGeoIds.emplace(countryId, move(id)); } OldMwmMapping GetMapping() const override { return m_idsMapping; } @@ -349,9 +349,9 @@ MwmSubtreeAttrs LoadGroupSingleMwmsImpl(size_t depth, json_t * node, CountryId c store.InsertAffiliation(id, affilationValue); uint64_t geoObjectId = 0; - FromJSONObjectOptionalField(node, "pc", geoObjectId); + FromJSONObjectOptionalField(node, "top_city_geo_id", geoObjectId); if (geoObjectId != 0) - store.InsertPromoCatalogCity(id, geoObjectId); + store.InsertMwmTopCityGeoId(id, geoObjectId); int nodeSize; FromJSONObjectOptionalField(node, "s", nodeSize); @@ -528,7 +528,7 @@ bool LoadCountriesTwoComponentMwmsImpl(string const & jsonBuffer, int64_t LoadCountriesFromBuffer(string const & jsonBuffer, CountryTree & countries, Affiliations & affiliations, CountryNameSynonyms & countryNameSynonyms, - PromoCatalogCities & promoCatalogCities, + MwmTopCityGeoIds & mwmTopCityGeoIds, OldMwmMapping * mapping /* = nullptr */) { countries.Clear(); @@ -543,7 +543,7 @@ int64_t LoadCountriesFromBuffer(string const & jsonBuffer, CountryTree & countri if (version::IsSingleMwm(version)) { StoreCountriesSingleMwms store(countries, affiliations, countryNameSynonyms, - promoCatalogCities); + mwmTopCityGeoIds); if (!LoadCountriesSingleMwmsImpl(jsonBuffer, store)) return -1; if (mapping) @@ -566,12 +566,12 @@ int64_t LoadCountriesFromBuffer(string const & jsonBuffer, CountryTree & countri int64_t LoadCountriesFromFile(string const & path, CountryTree & countries, Affiliations & affiliations, CountryNameSynonyms & countryNameSynonyms, - PromoCatalogCities & promoCatalogCities, OldMwmMapping * mapping) + MwmTopCityGeoIds & mwmTopCityGeoIds, OldMwmMapping * mapping) { string json; ReaderPtr(GetPlatform().GetReader(path)).ReadAsString(json); return LoadCountriesFromBuffer(json, countries, affiliations, countryNameSynonyms, - promoCatalogCities, mapping); + mwmTopCityGeoIds, mapping); } void LoadCountryFile2CountryInfo(string const & jsonBuffer, map & id2info, diff --git a/storage/country_tree.hpp b/storage/country_tree.hpp index fbcca4a525..5a1c879ea6 100644 --- a/storage/country_tree.hpp +++ b/storage/country_tree.hpp @@ -119,12 +119,12 @@ private: int64_t LoadCountriesFromBuffer(std::string const & buffer, CountryTree & countries, Affiliations & affiliations, CountryNameSynonyms & countryNameSynonyms, - PromoCatalogCities & promoCatalogCities, + MwmTopCityGeoIds & mwmTopCityGeoIds, OldMwmMapping * mapping = nullptr); int64_t LoadCountriesFromFile(std::string const & path, CountryTree & countries, Affiliations & affiliations, CountryNameSynonyms & countryNameSynonyms, - PromoCatalogCities & promoCatalogCities, + MwmTopCityGeoIds & mwmTopCityGeoIds, OldMwmMapping * mapping = nullptr); void LoadCountryFile2CountryInfo(std::string const & jsonBuffer, diff --git a/storage/storage.cpp b/storage/storage.cpp index fcb2c7eb88..a688d3cef6 100644 --- a/storage/storage.cpp +++ b/storage/storage.cpp @@ -143,7 +143,7 @@ Storage::Storage(string const & referenceCountriesTxtJsonForTesting, { m_currentVersion = LoadCountriesFromBuffer(referenceCountriesTxtJsonForTesting, m_countries, m_affiliations, - m_countryNameSynonyms, m_promoCatalogCities); + m_countryNameSynonyms, m_mwmTopCityGeoIds); CHECK_LESS_OR_EQUAL(0, m_currentVersion, ("Can't load test countries file")); CalcMaxMwmSizeBytes(); } @@ -764,7 +764,7 @@ void Storage::LoadCountriesFile(string const & pathToCountriesFile, string const if (m_countries.IsEmpty()) { m_currentVersion = LoadCountriesFromFile(pathToCountriesFile, m_countries, m_affiliations, - m_countryNameSynonyms, m_promoCatalogCities, mapping); + m_countryNameSynonyms, m_mwmTopCityGeoIds, mapping); LOG_SHORT(LINFO, ("Loaded countries list for version:", m_currentVersion)); if (m_currentVersion < 0) LOG(LERROR, ("Can't load countries file", pathToCountriesFile)); diff --git a/storage/storage.hpp b/storage/storage.hpp index ecab27d3aa..853e0d9b4e 100644 --- a/storage/storage.hpp +++ b/storage/storage.hpp @@ -264,7 +264,7 @@ private: // Note. |m_affiliations| is empty in case of countries_obsolete.txt. Affiliations m_affiliations; CountryNameSynonyms m_countryNameSynonyms; - PromoCatalogCities m_promoCatalogCities; + MwmTopCityGeoIds m_mwmTopCityGeoIds; MwmSize m_maxMwmSizeBytes; @@ -473,7 +473,7 @@ public: CountryNameSynonyms const & GetCountryNameSynonyms() const { return m_countryNameSynonyms; } - PromoCatalogCities const & GetPromoCatalogCities() const { return m_promoCatalogCities; } + MwmTopCityGeoIds const & GetMwmTopCityGeoIds() const { return m_mwmTopCityGeoIds; } /// \brief Calls |toDo| for each node for subtree with |root|. /// For example ForEachInSubtree(GetRootId()) calls |toDo| for every node including diff --git a/storage/storage_defines.hpp b/storage/storage_defines.hpp index a93d7ab29b..6cde63257b 100644 --- a/storage/storage_defines.hpp +++ b/storage/storage_defines.hpp @@ -25,8 +25,8 @@ using OldMwmMapping = std::map; using Affiliations = std::unordered_map>; /// Map from country name synonyms and old names into CountryId. using CountryNameSynonyms = std::unordered_map; -/// Map from CountryId into promo catalog cities GeoObject id. -using PromoCatalogCities = std::unordered_map; +/// Map from CountryId into city GeoObject id. +using MwmTopCityGeoIds = std::unordered_map; extern const storage::CountryId kInvalidCountryId;