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>2011-10-05 18:36:22 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:25:11 +0300
commit770068b9bc636a8433e8fc9b195b852cf89c0895 (patch)
tree3ff846dfa8f74c83351f762954b7b9d01ffebd25 /indexer/old
parent9d92a05d3ba6b032684d6406d2ec89f2fafebf26 (diff)
Add "shop-convenience" and "shop-supermarket" to classificator.
TODO: Move them upper in types.txt before countries generation.
Diffstat (limited to 'indexer/old')
-rw-r--r--indexer/old/feature_loader_101.cpp44
1 files changed, 43 insertions, 1 deletions
diff --git a/indexer/old/feature_loader_101.cpp b/indexer/old/feature_loader_101.cpp
index 4f253d87c9..cae2f8ca43 100644
--- a/indexer/old/feature_loader_101.cpp
+++ b/indexer/old/feature_loader_101.cpp
@@ -36,13 +36,55 @@ uint8_t LoaderImpl::GetHeader()
return header;
}
+namespace
+{
+ class TypeConvertor
+ {
+ vector<uint32_t> m_inc;
+
+ public:
+ TypeConvertor()
+ {
+ char const * arr[][2] = {
+ { "shop", "convenience" }, // new type
+ { "shop", "hairdresser" }
+ };
+
+ Classificator const & c = classif();
+
+ for (size_t i = 0; i < ARRAY_SIZE(arr); ++i)
+ {
+ vector<string> v;
+ v.push_back(arr[i][0]);
+ v.push_back(arr[i][1]);
+ m_inc.push_back(c.GetTypeByPath(v));
+ }
+ }
+
+ uint32_t Convert(uint32_t t) const
+ {
+ size_t const count = m_inc.size();
+ for (size_t i = 0; i < count; ++i)
+ if (m_inc[i] == t)
+ {
+ // return next type (advance by 1)
+ ASSERT_LESS ( i+1, count, () );
+ return m_inc[i+1];
+ }
+ return t;
+ }
+ };
+}
+
void LoaderImpl::ParseTypes()
{
ArrayByteSource source(DataPtr() + m_TypesOffset);
+ static TypeConvertor typeC;
+
size_t const count = m_pF->GetTypesCount();
for (size_t i = 0; i < count; ++i)
- m_pF->m_Types[i] = ReadVarUint<uint32_t>(source);
+ m_pF->m_Types[i] = typeC.Convert(ReadVarUint<uint32_t>(source));
m_CommonOffset = CalcOffset(source);
}