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

viewport_search_callback.hpp « search - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 61919f589466a3212edd8d7b9da57e341e3c4fef (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once

#include "search/hotels_classifier.hpp"
#include "search/search_params.hpp"

#include "std/function.hpp"

namespace search
{
class Results;

// An on-results-callback that should be used for interactive search.
//
// *NOTE* the class is NOT thread safe.
class ViewportSearchCallback
{
public:
  class Delegate
  {
  public:
    virtual ~Delegate() = default;

    virtual void RunUITask(function<void()> fn) = 0;
    virtual void SetHotelDisplacementMode() = 0;
    virtual bool IsViewportSearchActive() const = 0;
    virtual void ShowViewportSearchResults(Results const & results) = 0;
    virtual void ClearViewportSearchResults() = 0;
  };

  using TOnResults = SearchParams::TOnResults;

  ViewportSearchCallback(Delegate & delegate, TOnResults onResults);

  void operator()(Results const & results);

private:
  Delegate & m_delegate;
  TOnResults m_onResults;

  bool m_hotelsModeSet;
  bool m_firstCall;

  HotelsClassifier m_hotelsClassif;
  size_t m_lastResultsSize;
};
}  // namespace search