Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaria Volvenkova <d.volvenkova@corp.mail.ru>2017-04-19 15:13:50 +0300
committerDaria Volvenkova <d.volvenkova@corp.mail.ru>2017-04-19 15:59:10 +0300
commitcadbd5f29afbb7654ccc19eaac5cb99eb45c9cda (patch)
tree6e85efcd30a8f0f4bf82e8b1eb67e851f73ae36c /indexer/feature.cpp
parent02483b4948479ec463c737b6db77dbc3db015079 (diff)
Reduced count of getting device language calls.
Diffstat (limited to 'indexer/feature.cpp')
-rw-r--r--indexer/feature.cpp38
1 files changed, 36 insertions, 2 deletions
diff --git a/indexer/feature.cpp b/indexer/feature.cpp
index fe5cb49aa1..28cd4e39e1 100644
--- a/indexer/feature.cpp
+++ b/indexer/feature.cpp
@@ -491,7 +491,7 @@ FeatureType::geom_stat_t FeatureType::GetTrianglesSize(int scale) const
return geom_stat_t(sz, m_triangles.size());
}
-void FeatureType::GetPreferredNames(bool allowTranslit, string & primary, string & secondary) const
+void FeatureType::GetPreferredNames(string & primary, string & secondary) const
{
if (!HasName())
return;
@@ -502,12 +502,29 @@ void FeatureType::GetPreferredNames(bool allowTranslit, string & primary, string
return;
ParseCommon();
+
auto const deviceLang = StringUtf8Multilang::GetLangIndex(languages::GetCurrentNorm());
+ ::GetPreferredNames(mwmInfo->GetRegionData(), GetNames(), deviceLang, false /* allowTranslit */,
+ primary, secondary);
+}
+
+void FeatureType::GetPreferredNames(bool allowTranslit, int8_t deviceLang, string & primary, string & secondary) const
+{
+ if (!HasName())
+ return;
+
+ auto const mwmInfo = GetID().m_mwmId.GetInfo();
+
+ if (!mwmInfo)
+ return;
+
+ ParseCommon();
+
::GetPreferredNames(mwmInfo->GetRegionData(), GetNames(), deviceLang, allowTranslit,
primary, secondary);
}
-void FeatureType::GetReadableName(bool allowTranslit, string & name) const
+void FeatureType::GetReadableName(string & name) const
{
if (!HasName())
return;
@@ -518,7 +535,24 @@ void FeatureType::GetReadableName(bool allowTranslit, string & name) const
return;
ParseCommon();
+
auto const deviceLang = StringUtf8Multilang::GetLangIndex(languages::GetCurrentNorm());
+ ::GetReadableName(mwmInfo->GetRegionData(), GetNames(), deviceLang, false /* allowTranslit */,
+ name);
+}
+
+void FeatureType::GetReadableName(bool allowTranslit, int8_t deviceLang, string & name) const
+{
+ if (!HasName())
+ return;
+
+ auto const mwmInfo = GetID().m_mwmId.GetInfo();
+
+ if (!mwmInfo)
+ return;
+
+ ParseCommon();
+
::GetReadableName(mwmInfo->GetRegionData(), GetNames(), deviceLang, allowTranslit, name);
}