blob: 457ad61cf16387c031e38bd4c58309d7d0312eef (
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
56
57
58
59
60
61
62
63
64
65
66
|
#pragma once
#include <cstdint>
#include <set>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <vector>
#include "boost/optional.hpp"
namespace routing
{
class RoutingOptions
{
public:
static std::string const kAvoidRoutingOptionSettingsForCar;
enum class Road : uint8_t
{
Usual = 1u << 0,
Toll = 1u << 1,
Motorway = 1u << 2,
Ferry = 1u << 3,
Dirty = 1u << 4,
Max = (1u << 4) + 1
};
using RoadType = std::underlying_type_t<Road>;
RoutingOptions() = default;
explicit RoutingOptions(RoadType mask) : m_options(mask) {}
static RoutingOptions LoadCarOptionsFromSettings();
static void SaveCarOptionsToSettings(RoutingOptions options);
void Add(Road type);
void Remove(Road type);
bool Has(Road type) const;
RoadType GetOptions() const { return m_options; }
private:
RoadType m_options = 0;
};
class RoutingOptionsClassifier
{
public:
RoutingOptionsClassifier();
boost::optional<RoutingOptions::Road> Get(uint32_t type) const;
static RoutingOptionsClassifier const & Instance();
private:
std::unordered_map<uint32_t, RoutingOptions::Road> m_data;
};
RoutingOptions::Road ChooseMainRoutingOptionRoad(RoutingOptions options);
std::string DebugPrint(RoutingOptions const & routingOptions);
std::string DebugPrint(RoutingOptions::Road type);
} // namespace routing
|