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-08-15 18:13:19 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:21:38 +0300
commite367587b92521e47ef80e11f0c1488507b5ac4c4 (patch)
tree1717d1f807a8db485afa7e9c14e5870148b0e627 /indexer/types_mapping.cpp
parent4e8e88052775f4781f8a96e7688b7602db5d4e61 (diff)
Add additional types mapping (index <-> type) in classificator.
Diffstat (limited to 'indexer/types_mapping.cpp')
-rw-r--r--indexer/types_mapping.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/indexer/types_mapping.cpp b/indexer/types_mapping.cpp
new file mode 100644
index 0000000000..d8f04c8c97
--- /dev/null
+++ b/indexer/types_mapping.cpp
@@ -0,0 +1,40 @@
+#include "types_mapping.hpp"
+#include "classificator.hpp"
+
+#include "../base/string_utils.hpp"
+#include "../base/stl_add.hpp"
+
+
+void BaseTypeMapper::Load(string const & buffer)
+{
+ istringstream ss(buffer);
+ Classificator & c = classif();
+
+ string v;
+ vector<string> path;
+
+ uint32_t ind = 0;
+ while (true)
+ {
+ ss >> v;
+
+ if (ss.eof())
+ break;
+
+ path.clear();
+ strings::Tokenize(v, "|", MakeBackInsertFunctor(path));
+
+ Add(ind++, c.GetTypeByPath(path));
+ }
+}
+
+void Index2Type::Add(uint32_t ind, uint32_t type)
+{
+ ASSERT_EQUAL ( ind, m_types.size(), () );
+ m_types.push_back(type);
+}
+
+void Type2Index::Add(uint32_t ind, uint32_t type)
+{
+ VERIFY ( m_map.insert(make_pair(type, ind)).second, (type, ind) );
+}