Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2015-02-27 18:38:29 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:37:54 +0300
commitc5a0a17f10f3f0bdcf66ea90bd11011aa9c7b65c (patch)
tree20feea3cc57c4918561b628c07b41a3d07702d6a
parent9908d8001333865ba95e0305621ab75ab1a57a11 (diff)
Minor code fixes.
-rw-r--r--generator/dumper.cpp13
-rw-r--r--generator/feature_sorter.cpp31
-rw-r--r--generator/statistics.cpp19
-rw-r--r--indexer/feature.hpp4
-rw-r--r--indexer/feature_data.cpp5
5 files changed, 16 insertions, 56 deletions
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<value_type::iterator, bool> 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 <class T>
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 <typename FunctorT>
- void ForEachTypeRef(FunctorT & f) const
+ template <typename ToDo>
+ 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