1 | #pragma once |
2 | |
3 | #include <mbgl/style/expression/value.hpp> |
4 | #include <mbgl/style/expression/expression.hpp> |
5 | #include <mbgl/style/expression/interpolator.hpp> |
6 | #include <mbgl/util/ignore.hpp> |
7 | |
8 | #include <memory> |
9 | #include <string> |
10 | #include <initializer_list> |
11 | |
12 | namespace mbgl { |
13 | namespace style { |
14 | namespace expression { |
15 | namespace dsl { |
16 | |
17 | // This convenience API does little to no expression validation or type-checking, and is intended for |
18 | // use only by test and other non-production code. |
19 | |
20 | template <class... Args> |
21 | std::vector<std::unique_ptr<Expression>> vec(Args... args) { |
22 | std::vector<std::unique_ptr<Expression>> result; |
23 | util::ignore({ (result.push_back(std::move(args)), 0)... }); |
24 | return result; |
25 | } |
26 | |
27 | std::unique_ptr<Expression> error(std::string); |
28 | |
29 | std::unique_ptr<Expression> literal(const char* value); |
30 | std::unique_ptr<Expression> literal(Value value); |
31 | std::unique_ptr<Expression> literal(std::initializer_list<double> value); |
32 | std::unique_ptr<Expression> literal(std::initializer_list<const char *> value); |
33 | |
34 | std::unique_ptr<Expression> number(std::unique_ptr<Expression>); |
35 | std::unique_ptr<Expression> string(std::unique_ptr<Expression>); |
36 | std::unique_ptr<Expression> boolean(std::unique_ptr<Expression>); |
37 | |
38 | std::unique_ptr<Expression> toColor(std::unique_ptr<Expression>); |
39 | std::unique_ptr<Expression> toString(std::unique_ptr<Expression>); |
40 | |
41 | std::unique_ptr<Expression> get(const char* value); |
42 | std::unique_ptr<Expression> get(std::unique_ptr<Expression>); |
43 | |
44 | std::unique_ptr<Expression> id(); |
45 | std::unique_ptr<Expression> zoom(); |
46 | |
47 | std::unique_ptr<Expression> eq(std::unique_ptr<Expression>, |
48 | std::unique_ptr<Expression>); |
49 | std::unique_ptr<Expression> ne(std::unique_ptr<Expression>, |
50 | std::unique_ptr<Expression>); |
51 | std::unique_ptr<Expression> gt(std::unique_ptr<Expression>, |
52 | std::unique_ptr<Expression>); |
53 | std::unique_ptr<Expression> lt(std::unique_ptr<Expression>, |
54 | std::unique_ptr<Expression>); |
55 | |
56 | std::unique_ptr<Expression> step(std::unique_ptr<Expression> input, |
57 | std::unique_ptr<Expression> output0, |
58 | double input1, std::unique_ptr<Expression> output1); |
59 | |
60 | Interpolator linear(); |
61 | Interpolator exponential(double base); |
62 | Interpolator cubicBezier(double x1, double y1, double x2, double y2); |
63 | |
64 | std::unique_ptr<Expression> interpolate(Interpolator interpolator, |
65 | std::unique_ptr<Expression> input, |
66 | double input1, std::unique_ptr<Expression> output1); |
67 | |
68 | std::unique_ptr<Expression> interpolate(Interpolator interpolator, |
69 | std::unique_ptr<Expression> input, |
70 | double input1, std::unique_ptr<Expression> output1, |
71 | double input2, std::unique_ptr<Expression> output2); |
72 | |
73 | std::unique_ptr<Expression> interpolate(Interpolator interpolator, |
74 | std::unique_ptr<Expression> input, |
75 | double input1, std::unique_ptr<Expression> output1, |
76 | double input2, std::unique_ptr<Expression> output2, |
77 | double input3, std::unique_ptr<Expression> output3); |
78 | |
79 | std::unique_ptr<Expression> concat(std::vector<std::unique_ptr<Expression>> inputs); |
80 | |
81 | } // namespace dsl |
82 | } // namespace expression |
83 | } // namespace style |
84 | } // namespace mbgl |
85 | |