MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
coalesce.hpp
Go to the documentation of this file.
1 #pragma once
2 
6 
7 #include <memory>
8 #include <map>
9 
10 namespace mbgl {
11 namespace style {
12 namespace expression {
13 
14 class Coalesce : public Expression {
15 public:
16  using Args = std::vector<std::unique_ptr<Expression>>;
17  Coalesce(const type::Type& type_, Args args_) :
18  Expression(Kind::Coalesce, type_),
19  args(std::move(args_))
20  {}
21 
23 
24 
25  EvaluationResult evaluate(const EvaluationContext& params) const override;
26 
27  void eachChild(const std::function<void(const Expression&)>& visit) const override;
28 
29  bool operator==(const Expression& e) const override;
30 
31  std::vector<std::optional<Value>> possibleOutputs() const override;
32 
33  std::size_t getLength() const {
34  return args.size();
35  }
36 
37  Expression* getChild(std::size_t i) const {
38  return args.at(i).get();
39  }
40 
41  std::string getOperator() const override { return "coalesce"; }
42 private:
43  Args args;
44 };
45 
46 } // namespace expression
47 } // namespace style
48 } // namespace mbgl
EvaluationResult evaluate(const EvaluationContext &params) const override
void eachChild(const std::function< void(const Expression &)> &visit) const override
Coalesce(const type::Type &type_, Args args_)
Definition: coalesce.hpp:17
bool operator==(const Expression &e) const override
Expression * getChild(std::size_t i) const
Definition: coalesce.hpp:37
std::string getOperator() const override
Definition: coalesce.hpp:41
std::vector< std::optional< Value > > possibleOutputs() const override
std::size_t getLength() const
Definition: coalesce.hpp:33
std::vector< std::unique_ptr< Expression > > Args
Definition: coalesce.hpp:16
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)
variant< NullType, NumberType, BooleanType, StringType, ColorType, ObjectType, ValueType, mapbox::util::recursive_wrapper< Array >, CollatorType, FormattedType, ErrorType, ImageType > Type
Definition: type.hpp:108
std::optional< std::unique_ptr< Expression > > ParseResult
Definition: actor.hpp:15
Definition: tile_id.hpp:256