diff options
author | Arsentiy Milchakov <milcars@mapswithme.com> | 2017-06-05 18:48:04 +0300 |
---|---|---|
committer | Arsentiy Milchakov <milcars@mapswithme.com> | 2017-06-05 18:48:04 +0300 |
commit | 4871e2f7f48fd690f3e923797130b62e9e1a8bde (patch) | |
tree | 3c21933e139e1e3a693c092156a4dfdb4145d596 /indexer/wheelchair.hpp | |
parent | 338283c7fcfeacf999bade33093a0f2b9214d0c9 (diff) |
[indexer] wheelchair type info added into MapObject class
Diffstat (limited to 'indexer/wheelchair.hpp')
-rw-r--r-- | indexer/wheelchair.hpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/indexer/wheelchair.hpp b/indexer/wheelchair.hpp new file mode 100644 index 0000000000..a1029fca59 --- /dev/null +++ b/indexer/wheelchair.hpp @@ -0,0 +1,53 @@ +#pragma once + +#include "indexer/feature.hpp" +#include "indexer/ftypes_mapping.hpp" + +#include <initializer_list> + +namespace wheelchair +{ +enum class Type +{ + No, + Yes, + Limited +}; + +inline string DebugPrint(Type wheelchair) +{ + switch (wheelchair) + { + case Type::No: return "No"; + case Type::Yes: return "Yes"; + case Type::Limited: return "Limited"; + } + return {}; +} + +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 |