summaryrefslogtreecommitdiff
path: root/include/mbgl/style/expression/error.hpp
blob: bfb9247d117691595fb7ef1b5276392efc106b19 (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(type::Error),
          message(std::move(message_)) {}

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

    bool operator==(const Expression& e) const override {
        return dynamic_cast<const Error*>(&e);
    }

    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