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

everywhere_search_callback.cpp « search - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9b80cda188509ff315fec6116122f65234cd8326 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "search/everywhere_search_callback.hpp"

#include <cstddef>
#include <utility>

namespace search
{
EverywhereSearchCallback::EverywhereSearchCallback(Delegate & delegate, OnResults onResults)
  : m_delegate(delegate), m_onResults(std::move(onResults))
{
}

void EverywhereSearchCallback::operator()(Results const & results)
{
  auto const prevSize = m_isLocalAdsCustomer.size();
  ASSERT_LESS_OR_EQUAL(prevSize, results.GetCount(), ());

  for (size_t i = prevSize; i < results.GetCount(); ++i)
    m_isLocalAdsCustomer.push_back(m_delegate.IsLocalAdsCustomer(results[i]));

  ASSERT_EQUAL(m_isLocalAdsCustomer.size(), results.GetCount(), ());
  m_onResults(results, m_isLocalAdsCustomer);
}
}  // namespace search