blob: ce4015bb6915a3746af8e18c7aea61c56b0f1c01 (
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
|
#pragma once
#include <mbgl/util/variant.hpp>
#include <mbgl/util/feature.hpp>
#include <mbgl/util/geometry.hpp>
#include <mbgl/style/expression/expression.hpp>
#include <string>
#include <vector>
#include <tuple>
namespace mbgl {
namespace style {
class Filter {
public:
optional<std::shared_ptr<const expression::Expression>> expression;
Filter() : expression() {}
Filter(expression::ParseResult _expression) : expression(std::move(*_expression)) {
assert(!expression || *expression != nullptr);
}
bool operator()(const expression::EvaluationContext& context) const;
friend bool operator==(const Filter& lhs, const Filter& rhs) {
if (!lhs.expression || !rhs.expression) {
return lhs.expression == rhs.expression;
} else {
return *(lhs.expression) == *(rhs.expression);
}
}
friend bool operator!=(const Filter& lhs, const Filter& rhs) {
return !(lhs == rhs);
}
};
} // namespace style
} // namespace mbgl
|