From c8abbb16dcff6a122dffd461af376d2f0a72d97c Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Wed, 9 Dec 2015 12:15:58 +0300 Subject: [PATCH] Moved MAX_SUPPORTED_LANGUAGES to StringUtf8Multilang. --- coding/multilang_utf8_string.cpp | 2 +- coding/multilang_utf8_string.hpp | 8 ++++++-- defines.hpp | 3 --- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/coding/multilang_utf8_string.cpp b/coding/multilang_utf8_string.cpp index f27930a769..a3432c07e8 100644 --- a/coding/multilang_utf8_string.cpp +++ b/coding/multilang_utf8_string.cpp @@ -17,7 +17,7 @@ static char const * gLangs[] = { int8_t StringUtf8Multilang::GetLangIndex(string const & lang) { - static_assert(ARRAY_SIZE(gLangs) == MAX_SUPPORTED_LANGUAGES, ""); + static_assert(ARRAY_SIZE(gLangs) == MAX_SUPPORTED_LANGUAGES, "With current encoding we are limited to 64 languages max."); for (size_t i = 0; i < ARRAY_SIZE(gLangs); ++i) if (lang == gLangs[i]) diff --git a/coding/multilang_utf8_string.hpp b/coding/multilang_utf8_string.hpp index f78834d8dd..7c0efce963 100644 --- a/coding/multilang_utf8_string.hpp +++ b/coding/multilang_utf8_string.hpp @@ -35,8 +35,12 @@ class StringUtf8Multilang size_t GetNextIndex(size_t i) const; public: - static int8_t const UNSUPPORTED_LANGUAGE_CODE = -1; - static int8_t const DEFAULT_CODE = 0; + static int8_t constexpr UNSUPPORTED_LANGUAGE_CODE = -1; + static int8_t constexpr DEFAULT_CODE = 0; + /// How many languages we support on indexing stage. See full list in cpp file. + /// TODO(AlexZ): Review and replace invalid languages by valid ones. + static int8_t constexpr MAX_SUPPORTED_LANGUAGES = 64; + /// @return UNSUPPORTED_LANGUAGE_CODE if language is not recognized static int8_t GetLangIndex(string const & lang); diff --git a/defines.hpp b/defines.hpp index a7332bf0a8..2cd61ce422 100644 --- a/defines.hpp +++ b/defines.hpp @@ -62,7 +62,4 @@ #define EXTERNAL_RESOURCES_FILE "external_resources.txt" -/// How many langs we're supporting on indexing stage -#define MAX_SUPPORTED_LANGUAGES 64 - #define GPS_TRACK_FILENAME "gps_track.dat"