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-10-16 20:01:07 +0300
committervng <viktor.govako@gmail.com>2015-10-16 20:12:20 +0300
commit2c6daf71e8d3bd8ef1882112c74c3e55c2e51a58 (patch)
tree09d64daaa1709d7bd0f69819a259708d7d9dfb7f /indexer/feature_visibility.cpp
parent69c162c00a084879a953e0d0a501b72bdbbebd93 (diff)
[feature] Removed old-school type parsing.
Diffstat (limited to 'indexer/feature_visibility.cpp')
-rw-r--r--indexer/feature_visibility.cpp45
1 files changed, 5 insertions, 40 deletions
diff --git a/indexer/feature_visibility.cpp b/indexer/feature_visibility.cpp
index db93cb8fed..7d7815fc1d 100644
--- a/indexer/feature_visibility.cpp
+++ b/indexer/feature_visibility.cpp
@@ -8,54 +8,19 @@
#include "std/array.hpp"
-namespace
-{
- bool NeedProcessParent(ClassifObject const * p)
- {
- return false;
- }
-}
-
template <class ToDo> typename ToDo::ResultType
Classificator::ProcessObjects(uint32_t type, ToDo & toDo) const
{
typedef typename ToDo::ResultType ResultType;
ResultType res = ResultType(); // default initialization
- ClassifObject const * p = &m_root;
- uint8_t i = 0;
- uint8_t v;
-
- // it's enough for now with our 3-level classificator
- array<ClassifObject const *, 8> path;
-
- // get objects route in hierarchy for type
- while (ftype::GetValue(type, i, v))
+ ClassifObject const * p = GetObject(type);
+ if (p != &m_root)
{
- p = p->GetObject(v);
- if (p != 0)
- {
- path[i++] = p;
- toDo(p);
- }
- else
- break;
- }
- if (path.empty())
- return res;
- else
- {
- // process objects from child to root
- for (; i > 0; --i)
- {
- // process and stop find if needed
- if (toDo(path[i-1], res)) break;
-
- // no need to process parents
- if (!NeedProcessParent(path[i-1])) break;
- }
- return res;
+ ASSERT(p, ());
+ toDo(p, res);
}
+ return res;
}
ClassifObject const * Classificator::GetObject(uint32_t type) const