diff options
author | Maxim Pimenov <m@maps.me> | 2017-10-10 15:53:13 +0300 |
---|---|---|
committer | Tatiana Yan <tatiana.kondakova@gmail.com> | 2017-10-11 13:33:51 +0300 |
commit | 4f2f14e8cea0591551df748feda414762e764fdc (patch) | |
tree | e8671506e2b0d168b28b4f583519bd3ec66ac0df /indexer/categories_holder.cpp | |
parent | 61931851397d8bf72ae7c5acd14c9ff2c68a6f55 (diff) |
[search] Using SmallSet for Locales.
Diffstat (limited to 'indexer/categories_holder.cpp')
-rw-r--r-- | indexer/categories_holder.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/indexer/categories_holder.cpp b/indexer/categories_holder.cpp index 4cd965ef1a..2f7baf0c43 100644 --- a/indexer/categories_holder.cpp +++ b/indexer/categories_holder.cpp @@ -141,8 +141,9 @@ void ProcessCategory(string const & line, vector<string> & groups, vector<uint32 } // namespace // static -int8_t const CategoriesHolder::kEnglishCode = 1; -int8_t const CategoriesHolder::kUnsupportedLocaleCode = -1; +int8_t constexpr CategoriesHolder::kEnglishCode; +int8_t constexpr CategoriesHolder::kUnsupportedLocaleCode; +uint8_t constexpr CategoriesHolder::kMaxSupportedLocaleIndex; // *NOTE* These constants should be updated when adding new // translation to categories.txt. When editing, keep in mind to check @@ -186,6 +187,11 @@ CategoriesHolder::CategoriesHolder(unique_ptr<Reader> && reader) ReaderStreamBuf buffer(move(reader)); istream s(&buffer); LoadFromStream(s); + +#if defined(DEBUG) + for (auto const & entry : kLocaleMapping) + ASSERT_LESS_OR_EQUAL(entry.m_code, kMaxSupportedLocaleIndex, ()); +#endif } void CategoriesHolder::AddCategory(Category & cat, vector<uint32_t> & types) |