1#pragma once
2
3#include <mbgl/style/expression/expression.hpp>
4#include <mbgl/style/expression/parsing_context.hpp>
5#include <mbgl/style/conversion.hpp>
6
7#include <memory>
8
9namespace mbgl {
10namespace style {
11namespace expression {
12
13template <typename T>
14class Match : public Expression {
15public:
16 using Branches = std::unordered_map<T, std::shared_ptr<Expression>>;
17
18 Match(type::Type type_,
19 std::unique_ptr<Expression> input_,
20 Branches branches_,
21 std::unique_ptr<Expression> otherwise_
22 ) : Expression(Kind::Match, type_),
23 input(std::move(input_)),
24 branches(std::move(branches_)),
25 otherwise(std::move(otherwise_))
26 {}
27
28 EvaluationResult evaluate(const EvaluationContext& params) const override;
29
30 void eachChild(const std::function<void(const Expression&)>& visit) const override;
31
32 bool operator==(const Expression& e) const override;
33
34 std::vector<optional<Value>> possibleOutputs() const override;
35
36 mbgl::Value serialize() const override;
37 std::string getOperator() const override { return "match"; }
38private:
39 std::unique_ptr<Expression> input;
40 Branches branches;
41 std::unique_ptr<Expression> otherwise;
42};
43
44ParseResult parseMatch(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx);
45
46} // namespace expression
47} // namespace style
48} // namespace mbgl
49

source code of qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/style/expression/match.hpp