| 1 | #pragma once |
|---|---|
| 2 | |
| 3 | #include <mbgl/style/expression/expression.hpp> |
| 4 | |
| 5 | #include <string> |
| 6 | |
| 7 | namespace mbgl { |
| 8 | namespace style { |
| 9 | namespace expression { |
| 10 | |
| 11 | class Error : public Expression { |
| 12 | public: |
| 13 | Error(std::string message_) |
| 14 | : Expression(Kind::Error, type::Error), |
| 15 | message(std::move(message_)) {} |
| 16 | |
| 17 | void eachChild(const std::function<void(const Expression&)>&) const override {} |
| 18 | |
| 19 | bool operator==(const Expression& e) const override { |
| 20 | return e.getKind() == Kind::Error; |
| 21 | } |
| 22 | |
| 23 | EvaluationResult evaluate(const EvaluationContext&) const override { |
| 24 | return EvaluationError{.message: message}; |
| 25 | } |
| 26 | |
| 27 | std::vector<optional<Value>> possibleOutputs() const override { |
| 28 | return {}; |
| 29 | } |
| 30 | |
| 31 | std::string getOperator() const override { return "error"; } |
| 32 | |
| 33 | private: |
| 34 | std::string message; |
| 35 | }; |
| 36 | |
| 37 | } // namespace expression |
| 38 | } // namespace style |
| 39 | } // namespace mbgl |
| 40 |
