Add some functions for search result's interface.

This commit is contained in:
vng 2012-06-15 23:13:39 -07:00 committed by Alex Zolotarev
parent f2e87171b3
commit 738d0aed2c
2 changed files with 14 additions and 3 deletions

View file

@ -67,7 +67,18 @@ public:
inline IterT Begin() const { return m_vec.begin(); }
inline IterT End() const { return m_vec.end(); }
inline size_t Count() const { return m_vec.size(); }
inline size_t GetCount() const { return m_vec.size(); }
inline Result const & GetResult(size_t i) const
{
ASSERT_LESS(i, m_vec.size(), ());
return m_vec[i];
}
inline void Swap(Results & rhs)
{
m_vec.swap(rhs.m_vec);
}
};
}

View file

@ -235,7 +235,7 @@ void Engine::SearchAsync()
res.Clear();
m_pQuery->SearchAllInViewport(GetViewportRect(params.m_lat, params.m_lon, arrR[i]), res, 3*RESULTS_COUNT);
if (m_pQuery->IsCanceled() || res.Count() >= 2*RESULTS_COUNT)
if (m_pQuery->IsCanceled() || res.GetCount() >= 2*RESULTS_COUNT)
break;
}
}
@ -251,7 +251,7 @@ void Engine::SearchAsync()
params.m_callback(res);
// Make additional search in whole mwm when not enough results.
if (!m_pQuery->IsCanceled() && res.Count() < RESULTS_COUNT)
if (!m_pQuery->IsCanceled() && res.GetCount() < RESULTS_COUNT)
{
try
{