1#pragma once
2
3#include <mbgl/style/expression/expression.hpp>
4#include <mbgl/style/conversion.hpp>
5#include <mbgl/style/expression/parsing_context.hpp>
6
7#include <memory>
8#include <vector>
9
10namespace mbgl {
11namespace style {
12namespace expression {
13
14class Case : public Expression {
15public:
16 using Branch = std::pair<std::unique_ptr<Expression>, std::unique_ptr<Expression>>;
17
18 Case(type::Type type_, std::vector<Branch> branches_, std::unique_ptr<Expression> otherwise_)
19 : Expression(Kind::Case, type_), branches(std::move(branches_)), otherwise(std::move(otherwise_)) {
20 }
21
22 static ParseResult parse(const mbgl::style::conversion::Convertible& value, ParsingContext& ctx);
23
24 EvaluationResult evaluate(const EvaluationContext& params) const override;
25 void eachChild(const std::function<void(const Expression&)>& visit) const override;
26
27 bool operator==(const Expression& e) const override;
28
29 std::vector<optional<Value>> possibleOutputs() const override;
30
31 std::string getOperator() const override { return "case"; }
32private:
33 std::vector<Branch> branches;
34 std::unique_ptr<Expression> otherwise;
35};
36
37} // namespace expression
38} // namespace style
39} // namespace mbgl
40

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