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

wheelchair.hpp « indexer - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 815094f18609935bf623ab1478162098b8598a13 (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
52
53
54
55
#pragma once

#include "indexer/feature.hpp"
#include "indexer/feature_data.hpp"
#include "indexer/ftypes_mapping.hpp"

#include <cstdint>
#include <initializer_list>
#include <string>

namespace wheelchair
{
enum class Type
{
  No,
  Yes,
  Limited
};

inline std::string DebugPrint(Type wheelchair)
{
  switch (wheelchair)
  {
  case Type::No: return "No";
  case Type::Yes: return "Yes";
  case Type::Limited: return "Limited";
  }
}

class Matcher
{
public:
  static Type GetType(feature::TypesHolder const & types)
  {
    static Matcher instance;
    auto const it = instance.m_matcher.Find(types);
    if (!instance.m_matcher.IsValid(it))
      return Type::No;

    return it->second;
  }

private:
  using TypesInitializer = std::initializer_list<std::initializer_list<char const *>>;

  Matcher()
  {
    m_matcher.Append<TypesInitializer>({{"wheelchair", "no"}}, Type::No);
    m_matcher.Append<TypesInitializer>({{"wheelchair", "yes"}}, Type::Yes);
    m_matcher.Append<TypesInitializer>({{"wheelchair", "limited"}}, Type::Limited);
  }

  ftypes::HashMapMatcher<uint32_t, Type> m_matcher;
};
}  // namespace wheelchair