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>2016-04-29 18:32:59 +0300
committerAlex Zolotarev <alex@maps.me>2016-05-01 10:28:03 +0300
commit3f1b0c9d22fdf3a859edb4a52935bf5dc8acc883 (patch)
treec852c6df76a088cdb83012a735cea3db74d08f1c /indexer/categories_holder.cpp
parent892829b3017ac79526c8524caf0bf553d06d27ff (diff)
Fixed categories loading.
Diffstat (limited to 'indexer/categories_holder.cpp')
-rw-r--r--indexer/categories_holder.cpp26
1 files changed, 15 insertions, 11 deletions
diff --git a/indexer/categories_holder.cpp b/indexer/categories_holder.cpp
index bd95a59613..4cb7c0ab2c 100644
--- a/indexer/categories_holder.cpp
+++ b/indexer/categories_holder.cpp
@@ -98,6 +98,7 @@ void CategoriesHolder::LoadFromStream(istream & s)
// Allow for comments starting with '#' character.
if (!line.empty() && line[0] == '#')
continue;
+
strings::SimpleTokenizer iter(line, state == EParseTypes ? "|" : ":|");
switch (state)
@@ -142,6 +143,20 @@ void CategoriesHolder::LoadFromStream(istream & s)
{
if (!iter)
{
+ // If the category groups are specified, add translations from them.
+
+ ///@todo According to the current logic, categories.txt should have
+ /// the blank string at the end of file.
+ if (!types.empty())
+ {
+ for (string const & group : currentGroups)
+ {
+ auto trans = groupTranslations.equal_range(group);
+ for (auto it = trans.first; it != trans.second; ++it)
+ cat.m_synonyms.push_back(it->second);
+ }
+ }
+
state = EParseTypes;
continue;
}
@@ -199,17 +214,6 @@ void CategoriesHolder::LoadFromStream(istream & s)
else
cat.m_synonyms.push_back(name);
}
-
- if (!types.empty())
- {
- // If a category group is specified, add translations from it.
- for (string const & group : currentGroups)
- {
- auto trans = groupTranslations.equal_range(group);
- for (auto it = trans.first; it != trans.second; ++it)
- cat.m_synonyms.push_back(it->second);
- }
- }
}
break;
}