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

categories_set.hpp « search - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7216a5a65f885a9c7f58a83a97078555eaf82f64 (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
#pragma once

#include "indexer/classificator.hpp"
#include "indexer/search_string_utils.hpp"

#include "base/macros.hpp"
#include "base/string_utils.hpp"

#include "std/algorithm.hpp"
#include "std/cstdint.hpp"
#include "std/unordered_set.hpp"

namespace search
{
class CategoriesSet
{
public:
  CategoriesSet() : m_classificator(classif()) {}

  inline void Add(uint32_t type) { m_categories.insert(type); }

  template <typename Fn>
  void ForEach(Fn && fn) const
  {
    for_each(m_categories.begin(), m_categories.end(), forward<Fn>(fn));
  }

private:
  Classificator const & m_classificator;
  unordered_set<uint32_t> m_categories;

  DISALLOW_COPY_AND_MOVE(CategoriesSet);
};
}  // namespace search