blob: c8505115abfbd119751016dc1a6a679b570765e6 (
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
|
#pragma once
#include <mbgl/util/feature.hpp>
#include <mbgl/util/variant.hpp>
#include <cassert>
#include <utility>
#include <map>
namespace mbgl {
namespace style {
class CategoricalValue : public variant<bool, int64_t, std::string> {
public:
using variant<bool, int64_t, std::string>::variant;
};
template <class T>
class CategoricalStops {
public:
using Stops = std::map<CategoricalValue, T>;
Stops stops;
CategoricalStops() = default;
CategoricalStops(Stops stops_)
: stops(std::move(stops_)) {
assert(stops.size() > 0);
}
optional<T> evaluate(const Value&) const;
friend bool operator==(const CategoricalStops& lhs,
const CategoricalStops& rhs) {
return lhs.stops == rhs.stops;
}
};
} // namespace style
} // namespace mbgl
|