diff --git a/indexer/indexer_tests/categories_test.cpp b/indexer/indexer_tests/categories_test.cpp index 3ea51ad2d5..473e402545 100644 --- a/indexer/indexer_tests/categories_test.cpp +++ b/indexer/indexer_tests/categories_test.cpp @@ -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, ("+++++++++++++++++++++++++++++++++++++")); } - } + }); } diff --git a/indexer/new_feature_categories.hpp b/indexer/new_feature_categories.hpp index 5bdd544f56..81f7aa7036 100644 --- a/indexer/new_feature_categories.hpp +++ b/indexer/new_feature_categories.hpp @@ -48,6 +48,12 @@ public: // The returned list is sorted. TNames const & GetAllCategoryNames(string const & lang) const; + template void ForEachLanguage(TFn && fn) const + { + for (auto const & e : m_categoriesByLang) + fn(e.first); + } + private: indexer::CategoriesIndex m_index; vector m_types;