diff options
author | Sergey Magidovich <mgsergio@mapswithme.com> | 2016-06-27 15:56:54 +0300 |
---|---|---|
committer | Sergey Magidovich <mgsergio@mapswithme.com> | 2016-07-01 15:27:59 +0300 |
commit | 57f6d206925fe777796d72c81ea975ecedbd6eff (patch) | |
tree | d0cdfe6e48c0fb28cb7434f18ba21f1d26c901b5 /indexer/editable_map_object.cpp | |
parent | b3f7936edd7338b10892dff7120c24875e262264 (diff) |
Add convenient constructor for LocalizedNames. Add method.
Diffstat (limited to 'indexer/editable_map_object.cpp')
-rw-r--r-- | indexer/editable_map_object.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/indexer/editable_map_object.cpp b/indexer/editable_map_object.cpp index 83700838fc..8bc08aebaa 100644 --- a/indexer/editable_map_object.cpp +++ b/indexer/editable_map_object.cpp @@ -11,6 +11,26 @@ namespace osm { +// LocalizedName ----------------------------------------------------------------------------------- + +LocalizedName::LocalizedName(int8_t const code, string const & name) + : m_code(code) + , m_lang(StringUtf8Multilang::GetLangByCode(code)) + , m_langName(StringUtf8Multilang::GetLangNameByCode(code)) + , m_name(name) +{ +} + +LocalizedName::LocalizedName(string const & langCode, string const & name) + : m_code(StringUtf8Multilang::GetLangIndex(langCode)) + , m_lang(StringUtf8Multilang::GetLangByCode(m_code)) + , m_langName(StringUtf8Multilang::GetLangNameByCode(m_code)) + , m_name(name) +{ +} + +// EditableMapObject ------------------------------------------------------------------------------- + // static int8_t const EditableMapObject::kMaximumLevelsEditableByUsers = 25; @@ -34,8 +54,7 @@ vector<LocalizedName> EditableMapObject::GetLocalizedNames() const vector<LocalizedName> result; m_name.ForEach([&result](int8_t code, string const & name) -> bool { - result.push_back({code, StringUtf8Multilang::GetLangByCode(code), - StringUtf8Multilang::GetLangNameByCode(code), name}); + result.push_back({code, name}); return true; }); return result; @@ -212,7 +231,7 @@ bool EditableMapObject::ValidateBuildingLevels(string const & buildingLevels) // static bool EditableMapObject::ValidateHouseNumber(string const & houseNumber) { - // TODO(mgsergio): Make a better validation, use real samples for example. + // TODO(mgsergio): Use LooksLikeHouseNumber! if (houseNumber.empty()) return true; |