blob: 11ec2a0e5a162dc7b71e817985867113d6020455 (
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
|
#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;
T defaultValue;
CategoricalStops() = default;
CategoricalStops(Stops stops_, T defaultValue_ = T())
: stops(std::move(stops_)),
defaultValue(std::move(defaultValue_)) {
assert(stops.size() > 0);
}
T evaluate(const Value&) const;
friend bool operator==(const CategoricalStops& lhs,
const CategoricalStops& rhs) {
return lhs.stops == rhs.stops && lhs.defaultValue == rhs.defaultValue;
}
};
} // namespace style
} // namespace mbgl
|