diff --git a/generator/dumper.cpp b/generator/dumper.cpp index 926620837d..342063755c 100644 --- a/generator/dumper.cpp +++ b/generator/dumper.cpp @@ -40,17 +40,16 @@ namespace feature ++m_namesCount; m_currFeatureTypes.clear(); - f.ForEachTypeRef(*this); + f.ForEachType([this](uint32_t type) + { + m_currFeatureTypes.push_back(type); + }); CHECK(!m_currFeatureTypes.empty(), ("Feature without any type???")); - pair found = m_stats.insert(make_pair(m_currFeatureTypes, 1)); + + auto found = m_stats.insert(make_pair(m_currFeatureTypes, 1)); if (!found.second) found.first->second++; } - - void operator()(uint32_t type) - { - m_currFeatureTypes.push_back(type); - } }; template diff --git a/generator/feature_sorter.cpp b/generator/feature_sorter.cpp index 9941ba28fb..fef092fc6e 100644 --- a/generator/feature_sorter.cpp +++ b/generator/feature_sorter.cpp @@ -411,28 +411,6 @@ namespace feature return scales::IsGoodForLevel(level, r); } - /* - class DoPrintTypes - { - Classificator const & m_c; - - public: - DoPrintTypes() : m_c(classif()) - { - LOG(LINFO, ("Start")); - } - ~DoPrintTypes() - { - LOG(LINFO, ("Finish")); - } - - void operator() (uint32_t t) - { - LOG(LINFO, (m_c.GetFullObjectName(t))); - } - }; - */ - bool IsCountry() const { return m_header.GetType() == feature::DataHeader::country; } public: @@ -443,15 +421,6 @@ namespace feature bool const isLine = fb.IsLine(); bool const isArea = fb.IsArea(); - // Dump features with linear and area types. - /* - if (isLine && isArea) - { - DoPrintTypes doPrint; - fb.GetFeatureBase().ForEachTypeRef(doPrint); - } - */ - int const scalesStart = m_header.GetScalesCount() - 1; for (int i = scalesStart; i >= 0; --i) { diff --git a/generator/statistics.cpp b/generator/statistics.cpp index ab9e7ad0e9..8de27527bd 100644 --- a/generator/statistics.cpp +++ b/generator/statistics.cpp @@ -38,19 +38,6 @@ namespace stats { MapInfo & m_info; - class ProcessType - { - MapInfo & m_info; - uint32_t m_size; - - public: - ProcessType(MapInfo & info, uint32_t sz) : m_info(info), m_size(sz) {} - void operator() (uint32_t type) - { - m_info.AddToSet(TypeTag(type), m_size, m_info.m_byClassifType); - } - }; - public: AccumulateStatistic(MapInfo & info) : m_info(info) {} @@ -75,8 +62,10 @@ namespace stats m_info.AddToSet(f.GetFeatureType(), allSize, m_info.m_byGeomType); - ProcessType doProcess(m_info, allSize); - f.ForEachTypeRef(doProcess); + f.ForEachType([this, allSize](uint32_t type) + { + m_info.AddToSet(TypeTag(type), allSize, m_info.m_byClassifType); + }); } }; diff --git a/indexer/feature.hpp b/indexer/feature.hpp index dc7ee5650e..a676164075 100644 --- a/indexer/feature.hpp +++ b/indexer/feature.hpp @@ -103,8 +103,8 @@ public: return m_center; } - template - void ForEachTypeRef(FunctorT & f) const + template + void ForEachType(ToDo f) const { ParseTypes(); diff --git a/indexer/feature_data.cpp b/indexer/feature_data.cpp index 1910c157fc..e29b144b30 100644 --- a/indexer/feature_data.cpp +++ b/indexer/feature_data.cpp @@ -17,7 +17,10 @@ using namespace feature; TypesHolder::TypesHolder(FeatureBase const & f) : m_size(0), m_geoType(f.GetFeatureType()) { - f.ForEachTypeRef(*this); + f.ForEachType([this](uint32_t type) + { + this->operator()(type); + }); } string TypesHolder::DebugPrint() const