/
githubmirror
/
omim
Обзор
Документация
Войти
/
githubmirror
/
omim
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
map/everywhere_search_callback.cpp
40 строк
1 KB
Arsentiy Milchakov
[booking][search] store viewport search params into SearchApi instead of forwarding search params into callbacks.
22 апр 2019, 18:47
22 апр 2019, 18:47
ddc6567
Код
Авторство
О чём код?
#include "map/everywhere_search_callback.hpp" #include <cstddef> #include <utility> namespace search { EverywhereSearchCallback::EverywhereSearchCallback( Delegate & hotelsDelegate, ProductInfo::Delegate & productInfoDelegate, booking::filter::Tasks const & bookingFilterTasks, EverywhereSearchParams::OnResults onResults) : m_hotelsDelegate(hotelsDelegate) , m_productInfoDelegate(productInfoDelegate) , m_onResults(std::move(onResults)) , m_bookingFilterTasks(bookingFilterTasks) { } void EverywhereSearchCallback::operator()(Results const & results) { auto const prevSize = m_productInfo.size(); ASSERT_LESS_OR_EQUAL(prevSize, results.GetCount(), ()); LOG(LINFO, ("Emitted", results.GetCount() - prevSize, "search results.")); for (size_t i = prevSize; i < results.GetCount(); ++i) { m_productInfo.push_back(m_productInfoDelegate.GetProductInfo(results[i])); } if (results.IsEndedNormal() && results.GetType() == Results::Type::Hotels && !m_bookingFilterTasks.IsEmpty()) { m_hotelsDelegate.FilterResultsForHotelsQuery(m_bookingFilterTasks, results, false /* inViewport */); } ASSERT_EQUAL(m_productInfo.size(), results.GetCount(), ()); m_onResults(results, m_productInfo); } } // namespace search