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

ads_engine.hpp « partners_api - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 820ebd10884faf9af414c86970e0fe5ae156ac7a (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
47
48
49
50
51
#pragma once

#include "partners_api/ads_base.hpp"
#include "partners_api/banner.hpp"

#include <memory>
#include <string>
#include <vector>

namespace feature
{
class TypesHolder;
}

namespace ads
{
class Engine
{
public:
  Engine();

  bool HasBanner(feature::TypesHolder const & types, storage::CountriesVec const & countryIds,
                 std::string const & userLanguage) const;
  std::vector<Banner> GetBanners(feature::TypesHolder const & types,
                                 storage::CountriesVec const & countryIds,
                                 std::string const & userLanguage) const;
  void DisableAdProvider(Banner::Type const type, Banner::Place const place);
  bool HasSearchBanner() const;
  std::vector<Banner> GetSearchBanners() const;

private:
  using ContainerPtr = std::unique_ptr<ContainerBase>;

  struct ContainerItem
  {
    ContainerItem(Banner::Type type, ContainerPtr && container)
      : m_type(type), m_container(std::move(container))
    {
    }
    bool m_enabled = true;
    Banner::Type m_type;
    ContainerPtr m_container;
  };

  void SetAdProviderEnabled(std::vector<ContainerItem> & banners, Banner::Type const type,
                            bool const isEnabled);

  std::vector<ContainerItem> m_banners;
  std::vector<ContainerItem> m_searchBanners;
};
}  // namespace ads