diff --git a/indexer/data_factory.cpp b/indexer/data_factory.cpp index a911b6ef1b..f2f20a47d7 100644 --- a/indexer/data_factory.cpp +++ b/indexer/data_factory.cpp @@ -11,7 +11,7 @@ void IndexFactory::Load(FilesContainerR const & cont) IntervalIndexIFace * IndexFactory::CreateIndex(ModelReaderPtr reader) const { - if (m_version.format == version::v1) + if (m_version.format == version::Format::v1) return new old_101::IntervalIndex(reader); return new IntervalIndex(reader); } diff --git a/indexer/data_header.cpp b/indexer/data_header.cpp index c426c4c046..317ffdbf7b 100644 --- a/indexer/data_header.cpp +++ b/indexer/data_header.cpp @@ -154,6 +154,6 @@ namespace feature m_type = country; - m_format = version::v1; + m_format = version::Format::v1; } } diff --git a/indexer/data_header.hpp b/indexer/data_header.hpp index 222537750b..3de441c0d9 100644 --- a/indexer/data_header.hpp +++ b/indexer/data_header.hpp @@ -66,7 +66,7 @@ namespace feature pair GetScaleRange() const; inline version::Format GetFormat() const { return m_format; } - inline bool IsMWMSuitable() const { return m_format <= version::lastFormat; } + inline bool IsMWMSuitable() const { return m_format <= version::Format::lastFormat; } /// @name Serialization //@{ diff --git a/indexer/feature_loader_base.cpp b/indexer/feature_loader_base.cpp index 61639c4fbe..e888ea50da 100644 --- a/indexer/feature_loader_base.cpp +++ b/indexer/feature_loader_base.cpp @@ -56,7 +56,7 @@ SharedLoadInfo::ReaderT SharedLoadInfo::GetTrianglesReader(int ind) const void SharedLoadInfo::CreateLoader() { - if (m_header.GetFormat() == version::v1) + if (m_header.GetFormat() == version::Format::v1) m_pLoader = new old_101::feature::LoaderImpl(*this); else m_pLoader = new LoaderCurrent(*this); diff --git a/indexer/feature_meta.hpp b/indexer/feature_meta.hpp index 60486ef1e9..ff798a6c83 100644 --- a/indexer/feature_meta.hpp +++ b/indexer/feature_meta.hpp @@ -126,7 +126,7 @@ namespace feature { for (auto const & e : m_metadata) { - // set high bit if it's the last element + // Set high bit if it's the last element. uint8_t const mark = (&e == &(*m_metadata.crbegin()) ? 0x80 : 0); uint8_t elem[2] = {static_cast(e.first | mark), static_cast(min(e.second.size(), (size_t)kMaxStringLength))}; diff --git a/indexer/features_vector.cpp b/indexer/features_vector.cpp index c909579dfd..06954a254b 100644 --- a/indexer/features_vector.cpp +++ b/indexer/features_vector.cpp @@ -24,9 +24,9 @@ FeaturesVectorTest::FeaturesVectorTest(FilesContainerR const & cont) : m_cont(cont), m_header(m_cont), m_vector(m_cont, m_header, 0) { auto const version = m_header.GetFormat(); - if (version == version::v5) + if (version == version::Format::v5) m_vector.m_table = feature::FeaturesOffsetsTable::CreateIfNotExistsAndLoad(m_cont).release(); - else if (version >= version::v6) + else if (version >= version::Format::v6) m_vector.m_table = feature::FeaturesOffsetsTable::Load(m_cont).release(); } diff --git a/indexer/index.cpp b/indexer/index.cpp index 8ac5b5060a..90a6139419 100644 --- a/indexer/index.cpp +++ b/indexer/index.cpp @@ -27,12 +27,12 @@ MwmValue::MwmValue(LocalCountryFile const & localFile) void MwmValue::SetTable(MwmInfoEx & info) { auto const version = GetHeader().GetFormat(); - if (version < version::v5) + if (version < version::Format::v5) return; if (!info.m_table) { - if (version == version::v5) + if (version == version::Format::v5) info.m_table = feature::FeaturesOffsetsTable::CreateIfNotExistsAndLoad(m_file, m_cont); else info.m_table = feature::FeaturesOffsetsTable::Load(m_cont); diff --git a/indexer/index.hpp b/indexer/index.hpp index 872ebae84f..d27f2c9d76 100644 --- a/indexer/index.hpp +++ b/indexer/index.hpp @@ -117,7 +117,7 @@ private: pValue->m_factory); // iterate through intervals - CheckUniqueIndexes checkUnique(header.GetFormat() >= version::v5); + CheckUniqueIndexes checkUnique(header.GetFormat() >= version::Format::v5); MwmId const mwmID = handle.GetId(); for (auto const & i : interval) @@ -164,7 +164,7 @@ private: pValue->m_factory); // iterate through intervals - CheckUniqueIndexes checkUnique(header.GetFormat() >= version::v5); + CheckUniqueIndexes checkUnique(header.GetFormat() >= version::Format::v5); MwmId const mwmID = handle.GetId(); for (auto const & i : interval) diff --git a/indexer/indexer_tests/test_mwm_set.hpp b/indexer/indexer_tests/test_mwm_set.hpp index dcd7c8e5d1..20ccf02cf5 100644 --- a/indexer/indexer_tests/test_mwm_set.hpp +++ b/indexer/indexer_tests/test_mwm_set.hpp @@ -22,7 +22,7 @@ protected: unique_ptr info(new MwmInfo()); info->m_maxScale = n; info->m_limitRect = m2::RectD(0, 0, 1, 1); - info->m_version.format = version::lastFormat; + info->m_version.format = version::Format::lastFormat; return info; } diff --git a/map/framework.cpp b/map/framework.cpp index 3acd9adac1..f87c757a56 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -507,7 +507,7 @@ void Framework::RegisterAllMaps() m_activeMaps->Init(maps); - m_searchEngine->SetSupportOldFormat(minFormat < version::v3); + m_searchEngine->SetSupportOldFormat(minFormat < static_cast(version::Format::v3)); } void Framework::DeregisterAllMaps() diff --git a/map/mwm_tests/mwm_index_test.cpp b/map/mwm_tests/mwm_index_test.cpp index 3b299b4d95..c87f08b9a7 100644 --- a/map/mwm_tests/mwm_index_test.cpp +++ b/map/mwm_tests/mwm_index_test.cpp @@ -47,7 +47,7 @@ bool RunTest(string const & countryFileName, int lowS, int highS) ASSERT(id.IsAlive(), ()); version::Format const version = id.GetInfo()->m_version.format; - if (version == version::unknownFormat) + if (version == version::Format::unknownFormat) return false; CheckNonEmptyGeometry doCheck; diff --git a/platform/mwm_version.cpp b/platform/mwm_version.cpp index f9b431ab32..a3db2ad89f 100644 --- a/platform/mwm_version.cpp +++ b/platform/mwm_version.cpp @@ -27,7 +27,7 @@ void ReadVersionT(TSource & src, MwmVersion & version) if (strcmp(prolog, MWM_PROLOG) != 0) { - version.format = v2; + version.format = Format::v2; version.timestamp = my::GenerateTimestamp(2011 - 1900 /* number of years since 1900 */, 10 /* number of month since January */, 1 /* month day */); @@ -41,14 +41,14 @@ void ReadVersionT(TSource & src, MwmVersion & version) } } // namespace -MwmVersion::MwmVersion() : format(unknownFormat), timestamp(0) {} +MwmVersion::MwmVersion() : format(Format::unknownFormat), timestamp(0) {} void WriteVersion(Writer & w, uint32_t versionDate) { w.Write(MWM_PROLOG, ARRAY_SIZE(MWM_PROLOG)); // write inner data version - WriteVarUint(w, static_cast(lastFormat)); + WriteVarUint(w, static_cast(Format::lastFormat)); WriteVarUint(w, versionDate); } diff --git a/platform/mwm_version.hpp b/platform/mwm_version.hpp index 56bada4861..7cc2b8f32a 100644 --- a/platform/mwm_version.hpp +++ b/platform/mwm_version.hpp @@ -9,7 +9,7 @@ class ModelReaderPtr; namespace version { -enum Format +enum class Format { unknownFormat = -1, v1 = 0, // April 2011 diff --git a/routing/osrm2feature_map.cpp b/routing/osrm2feature_map.cpp index 3437e8ce73..f9eac00054 100644 --- a/routing/osrm2feature_map.cpp +++ b/routing/osrm2feature_map.cpp @@ -415,7 +415,7 @@ void OsrmFtSegBackwardIndex::Construct(OsrmFtSegMapping & mapping, uint32_t maxN Clear(); feature::DataHeader header(localFile.GetPath(MapOptions::Map)); - m_oldFormat = header.GetFormat() < version::v5; + m_oldFormat = header.GetFormat() < version::Format::v5; if (m_oldFormat) LOG(LINFO, ("Using old format index for", localFile.GetCountryName())); diff --git a/routing/routing_tests/road_graph_builder.cpp b/routing/routing_tests/road_graph_builder.cpp index 82b6da646c..093a195578 100644 --- a/routing/routing_tests/road_graph_builder.cpp +++ b/routing/routing_tests/road_graph_builder.cpp @@ -43,7 +43,7 @@ private: unique_ptr info(new MwmInfo()); info->m_maxScale = 1; info->m_limitRect = m2::RectD(0, 0, 1, 1); - info->m_version.format = version::lastFormat; + info->m_version.format = version::Format::lastFormat; return info; } unique_ptr CreateValue(MwmInfo &) const override diff --git a/search/mwm_traits.cpp b/search/mwm_traits.cpp index 2f15e2b897..23200fc06a 100644 --- a/search/mwm_traits.cpp +++ b/search/mwm_traits.cpp @@ -8,14 +8,14 @@ MwmTraits::MwmTraits(version::Format versionFormat) : m_versionFormat(versionFor MwmTraits::SearchIndexFormat MwmTraits::GetSearchIndexFormat() const { - if (m_versionFormat < version::v7) + if (m_versionFormat < version::Format::v7) return SearchIndexFormat::FeaturesWithRankAndCenter; return SearchIndexFormat::CompressedBitVector; } MwmTraits::HouseToStreetTableFormat MwmTraits::GetHouseToStreetTableFormat() const { - if (m_versionFormat < version::v7) + if (m_versionFormat < version::Format::v7) return HouseToStreetTableFormat::Unknown; return HouseToStreetTableFormat::Fixed3BitsDDVector; }