From c5a0a17f10f3f0bdcf66ea90bd11011aa9c7b65c Mon Sep 17 00:00:00 2001 From: vng Date: Fri, 27 Feb 2015 18:38:29 +0300 Subject: Minor code fixes. --- generator/dumper.cpp | 13 ++++++------- generator/feature_sorter.cpp | 31 ------------------------------- generator/statistics.cpp | 19 ++++--------------- 3 files changed, 10 insertions(+), 53 deletions(-) (limited to 'generator') 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); + }); } }; -- cgit v1.2.3