MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
coercion.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 
6 #include <memory>
7 #include <vector>
8 
9 namespace mbgl {
10 namespace style {
11 namespace expression {
12 
13 class Coercion : public Expression {
14 public:
15  Coercion(type::Type type_, std::vector<std::unique_ptr<Expression>> inputs_);
16 
18 
19  EvaluationResult evaluate(const EvaluationContext& params) const override;
20  void eachChild(const std::function<void(const Expression&)>& visit) const override;
21 
22  mbgl::Value serialize() const override;
23 
24  bool operator==(const Expression& e) const override;
25 
26  std::vector<std::optional<Value>> possibleOutputs() const override;
27 
28  std::string getOperator() const override;
29 private:
30  EvaluationResult (*coerceSingleValue) (const Value& v);
31  std::vector<std::unique_ptr<Expression>> inputs;
32 };
33 
34 } // namespace expression
35 } // namespace style
36 } // namespace mbgl
37 
std::string getOperator() const override
std::vector< std::optional< Value > > possibleOutputs() const override
bool operator==(const Expression &e) const override
EvaluationResult evaluate(const EvaluationContext &params) const override
void eachChild(const std::function< void(const Expression &)> &visit) const override
Coercion(type::Type type_, std::vector< std::unique_ptr< Expression >> inputs_)
static ParseResult parse(const mbgl::style::conversion::Convertible &value, ParsingContext &ctx)
mbgl::Value serialize() const override
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
mapbox::base::Value Value
Definition: feature.hpp:11