| 11 | namespace routing |
| 12 | { |
| 13 | class RoutingOptions |
| 14 | { |
| 15 | public: |
| 16 | enum Road : uint8_t |
| 17 | { |
| 18 | Usual = 1u << 0, |
| 19 | Toll = 1u << 1, |
| 20 | Motorway = 1u << 2, |
| 21 | Ferry = 1u << 3, |
| 22 | Dirty = 1u << 4, |
| 23 | Steps = 1u << 5, |
| 24 | Paved = 1u << 6, |
| 25 | |
| 26 | Max = (1u << 6) + 1 |
| 27 | }; |
| 28 | |
| 29 | using RoadType = std::underlying_type_t<Road>; |
| 30 | |
| 31 | RoutingOptions() = default; |
| 32 | explicit RoutingOptions(RoadType mask) : m_options(mask) {} |
| 33 | |
| 34 | static RoutingOptions LoadCarOptionsFromSettings(); |
| 35 | static void SaveCarOptionsToSettings(RoutingOptions options); |
| 36 | |
| 37 | void Add(Road type); |
| 38 | void Remove(Road type); |
| 39 | bool Has(Road type) const; |
| 40 | |
| 41 | RoadType GetOptions() const { return m_options; } |
| 42 | |
| 43 | private: |
| 44 | RoadType m_options = 0; |
| 45 | }; |
| 46 | |
| 47 | class RoutingOptionsClassifier |
| 48 | { |
no outgoing calls
no test coverage detected