diff options
author | tatiana-yan <tatiana.kondakova@gmail.com> | 2018-07-30 16:36:52 +0300 |
---|---|---|
committer | mpimenov <mpimenov@users.noreply.github.com> | 2018-07-30 19:26:47 +0300 |
commit | 0e889ff8aac083077dedd525d60dfef182e53f0f (patch) | |
tree | 14e8d675728e5b8c56912ae644e834a07cfd0a26 /indexer/categories_holder.hpp | |
parent | 9f3df8b8658964ca24ff39e093d2e88419b9599d (diff) |
[indexer] Style & includes
Diffstat (limited to 'indexer/categories_holder.hpp')
-rw-r--r-- | indexer/categories_holder.hpp | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/indexer/categories_holder.hpp b/indexer/categories_holder.hpp index 6439ab2797..125d2aa9de 100644 --- a/indexer/categories_holder.hpp +++ b/indexer/categories_holder.hpp @@ -4,16 +4,15 @@ #include "base/stl_helpers.hpp" #include "base/string_utils.hpp" -#include "std/algorithm.hpp" -#include "std/deque.hpp" -#include "std/iostream.hpp" -#include "std/map.hpp" -#include "std/shared_ptr.hpp" -#include "std/string.hpp" -#include "std/unique_ptr.hpp" -#include "std/unordered_map.hpp" -#include "std/utility.hpp" -#include "std/vector.hpp" +#include <algorithm> +#include <deque> +#include <iostream> +#include <map> +#include <memory> +#include <string> +#include <unordered_map> +#include <utility> +#include <vector> class Reader; @@ -26,16 +25,16 @@ public: struct Name { - string m_name; + std::string m_name; /// This language/locale code is completely different from our built-in langs in multilang_utf8_string.cpp /// and is only used for mapping user's input language to our values in categories.txt file int8_t m_locale; uint8_t m_prefixLengthToSuggest; }; - deque<Name> m_synonyms; + std::deque<Name> m_synonyms; - inline void Swap(Category & r) + void Swap(Category & r) { m_synonyms.swap(r.m_synonyms); } @@ -47,11 +46,11 @@ public: int8_t m_code; }; - using GroupTranslations = unordered_map<string, vector<Category::Name>>; + using GroupTranslations = std::unordered_map<std::string, std::vector<Category::Name>>; private: using String = strings::UniString; - using Type2CategoryCont = multimap<uint32_t, shared_ptr<Category>>; + using Type2CategoryCont = std::multimap<uint32_t, std::shared_ptr<Category>>; using Trie = base::MemTrie<String, base::VectorValues<uint32_t>>; Type2CategoryCont m_type2cat; @@ -66,14 +65,14 @@ public: static int8_t constexpr kEnglishCode = 1; static int8_t constexpr kUnsupportedLocaleCode = -1; static uint8_t constexpr kMaxSupportedLocaleIndex = 31; - static vector<Mapping> const kLocaleMapping; + static std::vector<Mapping> const kLocaleMapping; // List of languages that are currently disabled in the application // because their translations are not yet complete. - static vector<string> kDisabledLanguages; + static std::vector<std::string> kDisabledLanguages; - explicit CategoriesHolder(unique_ptr<Reader> && reader); - void LoadFromStream(istream & s); + explicit CategoriesHolder(std::unique_ptr<Reader> && reader); + void LoadFromStream(std::istream & s); template <class ToDo> void ForEachCategory(ToDo && toDo) const @@ -123,24 +122,24 @@ public: void ForEachTypeByName(int8_t locale, String const & name, ToDo && toDo) const { auto const localePrefix = String(1, static_cast<strings::UniChar>(locale)); - m_name2type.ForEachInNode(localePrefix + name, forward<ToDo>(toDo)); + m_name2type.ForEachInNode(localePrefix + name, std::forward<ToDo>(toDo)); } - inline GroupTranslations const & GetGroupTranslations() const { return m_groupTranslations; } + GroupTranslations const & GetGroupTranslations() const { return m_groupTranslations; } /// Search name for type with preffered locale language. /// If no name for this language, return en name. /// @return false if no categories for type. - bool GetNameByType(uint32_t type, int8_t locale, string & name) const; + bool GetNameByType(uint32_t type, int8_t locale, std::string & name) const; /// @returns raw classificator type if it's not localized in categories.txt. - string GetReadableFeatureType(uint32_t type, int8_t locale) const; + std::string GetReadableFeatureType(uint32_t type, int8_t locale) const; // Exposes the tries that map category tokens to types. Trie const & GetNameToTypesTrie() const { return m_name2type; } bool IsTypeExist(uint32_t type) const; - inline void Swap(CategoriesHolder & r) + void Swap(CategoriesHolder & r) { m_type2cat.swap(r.m_type2cat); std::swap(m_name2type, r.m_name2type); @@ -148,15 +147,15 @@ public: // Converts any language |locale| from UI to the corresponding // internal integer code. - static int8_t MapLocaleToInteger(string const & locale); + static int8_t MapLocaleToInteger(std::string const & locale); // Returns corresponding string representation for an internal // integer |code|. Returns an empty string in case of invalid // |code|. - static string MapIntegerToLocale(int8_t code); + static std::string MapIntegerToLocale(int8_t code); private: - void AddCategory(Category & cat, vector<uint32_t> & types); + void AddCategory(Category & cat, std::vector<uint32_t> & types); static bool ValidKeyToken(String const & s); }; |