summaryrefslogtreecommitdiff
path: root/include/mbgl/style/expression/error.hpp
blob: 9e1da2f0f062270b2723870cdd78686bce3ff6e1 (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
#pragma once

#include <mbgl/style/expression/expression.hpp>

#include <string>

namespace mbgl {
namespace style {
namespace expression {

class Error : public Expression {
public:
    Error(std::string message_) 
        : Expression(Kind::Error, type::Error),
          message(std::move(message_)) {}

    void eachChild(const std::function<void(const Expression&)>&) const override {}

    bool operator==(const Expression& e) const override {
        return e.getKind() == Kind::Error;
    }

    EvaluationResult evaluate(const EvaluationContext&) const override {
        return EvaluationError{message};
    }

    std::vector<optional<Value>> possibleOutputs() const override {
        return {};
    }

    std::string getOperator() const override { return "error"; }

private:
    std::string message;
};

} // namespace expression
} // namespace style
} // namespace mbgl