Review fixes.

This commit is contained in:
vng 2016-04-29 19:13:30 +03:00 committed by Alex Zolotarev
parent 305f4d7660
commit f480afd606
2 changed files with 10 additions and 6 deletions

View file

@ -268,9 +268,7 @@ UNIT_TEST(CategoriesIndex_UniqueNames)
editor::EditorConfig config;
osm::NewFeatureCategories categories(config);
for (auto const & lang : {"en", "ru", "de", "cs", "da", "es", "fi", "fr", "hu",
"id", "it", "ja", "co", "nl", "nb", "pl", "pt", "ro",
"sk", "sv", "th", "tr", "uk", "vi", "zh-Hant" "ar"})
categories.ForEachLanguage([&](string const & lang)
{
categories.AddLanguage(lang);
auto const & names = categories.GetAllCategoryNames(lang);
@ -285,15 +283,15 @@ UNIT_TEST(CategoriesIndex_UniqueNames)
for (size_t i = 1; i < names.size(); ++i)
{
if (names[i-1].first == names[i].first)
if (names[i - 1].first == names[i].first)
{
LOG(LWARNING, (names[i].first,
cl.GetReadableObjectName(names[i].second),
cl.GetReadableObjectName(names[i-1].second)));
cl.GetReadableObjectName(names[i - 1].second)));
}
}
LOG(LWARNING, ("+++++++++++++++++++++++++++++++++++++"));
}
}
});
}

View file

@ -48,6 +48,12 @@ public:
// The returned list is sorted.
TNames const & GetAllCategoryNames(string const & lang) const;
template <class TFn> void ForEachLanguage(TFn && fn) const
{
for (auto const & e : m_categoriesByLang)
fn(e.first);
}
private:
indexer::CategoriesIndex m_index;
vector<uint32_t> m_types;