MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
error.hpp
Go to the documentation of this file.
1 #pragma once
2 
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};
25  }
26 
27  std::vector<std::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
Error(std::string message_)
Definition: error.hpp:13
std::vector< std::optional< Value > > possibleOutputs() const override
Definition: error.hpp:27
void eachChild(const std::function< void(const Expression &)> &) const override
Definition: error.hpp:17
bool operator==(const Expression &e) const override
Definition: error.hpp:19
EvaluationResult evaluate(const EvaluationContext &) const override
Definition: error.hpp:23
std::string getOperator() const override
Definition: error.hpp:31
std::unique_ptr< Expression > string(std::unique_ptr< Expression >, std::unique_ptr< Expression > def=nullptr)
Definition: actor.hpp:15
Definition: tile_id.hpp:256