MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
at.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 #include <memory>
6 
7 namespace mbgl {
8 namespace style {
9 namespace expression {
10 
11 class At : public Expression {
12 public:
13  At(std::unique_ptr<Expression> index_, std::unique_ptr<Expression> input_) :
14  Expression(Kind::At, input_->getType().get<type::Array>().itemType),
15  index(std::move(index_)),
16  input(std::move(input_))
17  {}
18 
20 
21  EvaluationResult evaluate(const EvaluationContext& params) const override;
22  void eachChild(const std::function<void(const Expression&)>&) const override;
23 
24  bool operator==(const Expression& e) const override {
25  if (e.getKind() == Kind::At) {
26  auto rhs = static_cast<const At*>(&e);
27  return *index == *(rhs->index) && *input == *(rhs->input);
28  }
29  return false;
30  }
31 
32  std::vector<std::optional<Value>> possibleOutputs() const override {
33  return { std::nullopt };
34  }
35 
36  std::string getOperator() const override { return "at"; }
37 
38 private:
39  std::unique_ptr<Expression> index;
40  std::unique_ptr<Expression> input;
41 };
42 
43 } // namespace expression
44 } // namespace style
45 } // namespace mbgl
void eachChild(const std::function< void(const Expression &)> &) const override
EvaluationResult evaluate(const EvaluationContext &params) const override
bool operator==(const Expression &e) const override
Definition: at.hpp:24
At(std::unique_ptr< Expression > index_, std::unique_ptr< Expression > input_)
Definition: at.hpp:13
std::string getOperator() const override
Definition: at.hpp:36
std::vector< std::optional< Value > > possibleOutputs() const override
Definition: at.hpp:32
static ParseResult parse(const mbgl::style::conversion::Convertible &value, ParsingContext &ctx)
std::unique_ptr< Expression > string(std::unique_ptr< Expression >, std::unique_ptr< Expression > def=nullptr)
std::unique_ptr< Expression > get(const char *value)
std::optional< std::unique_ptr< Expression > > ParseResult
Definition: actor.hpp:15
Definition: tile_id.hpp:256