Avoid to use heavy function languages::CurrentLanguage().

This commit is contained in:
vng 2012-09-25 18:20:39 +03:00 committed by Alex Zolotarev
parent 41359f557a
commit 49a7bfc73d
5 changed files with 14 additions and 1 deletions

View file

@ -360,7 +360,7 @@ namespace
void FillAddress(search::Engine const * eng, Framework::AddressInfo & info)
{
int8_t const lang = StringUtf8Multilang::GetLangIndex(languages::CurrentLanguage());
int8_t const lang = eng->GetCurrentLanguage();
SortResults();

View file

@ -334,6 +334,11 @@ m2::RectD Engine::GetCountryBounds(string const & file) const
return m_pData->m_infoGetter.CalcLimitRect(file);
}
int8_t Engine::GetCurrentLanguage() const
{
return m_pQuery->GetPrefferedLanguage();
}
void Engine::ClearCaches()
{
/// @todo Add m_pData->m_infoGetter clearing routine.

View file

@ -43,6 +43,8 @@ public:
string GetCountryFile(m2::PointD const & pt);
string GetCountryCode(m2::PointD const & pt);
int8_t GetCurrentLanguage() const;
private:
template <class T> string GetCountryNameT(T const & t);
public:

View file

@ -177,6 +177,11 @@ void Query::SetInputLanguage(int8_t lang)
SetLanguage(LANG_INPUT, lang);
}
int8_t Query::GetPrefferedLanguage() const
{
return GetLanguage(LANG_CURRENT);
}
void Query::ClearCache()
{
for (size_t i = 0; i < RECTSCOUNT; ++i)

View file

@ -73,6 +73,7 @@ public:
void SetPreferredLanguage(string const & lang);
void SetInputLanguage(int8_t lang);
int8_t GetPrefferedLanguage() const;
void Search(string const & query, Results & res);
void SearchAllInViewport(m2::RectD const & viewport, Results & res, unsigned int resultsNeeded = 30);