Issue #10714 - Each expression stores its operator as a string, and default serialization is [operator, serialize(child1), ...] - Custom implementations of `serialize` for Expression types that don't follow the pattern - expression::Value -> mbgl::Value converter - node_expression bindings to expose `serialize`
34 lines
991 B
C++
34 lines
991 B
C++
#pragma once
|
|
|
|
#include <mbgl/style/expression/expression.hpp>
|
|
#include <mbgl/style/expression/parsing_context.hpp>
|
|
#include <mbgl/style/conversion.hpp>
|
|
|
|
#include <memory>
|
|
|
|
namespace mbgl {
|
|
namespace style {
|
|
namespace expression {
|
|
|
|
class Equals : public Expression {
|
|
public:
|
|
Equals(std::unique_ptr<Expression> lhs, std::unique_ptr<Expression> rhs, bool negate);
|
|
|
|
static ParseResult parse(const mbgl::style::conversion::Convertible&, ParsingContext&);
|
|
|
|
void eachChild(const std::function<void(const Expression&)>& visit) const override;
|
|
bool operator==(const Expression&) const override;
|
|
EvaluationResult evaluate(const EvaluationContext&) const override;
|
|
std::vector<optional<Value>> possibleOutputs() const override;
|
|
|
|
std::string getOperator() const override { return negate ? "!=" : "=="; }
|
|
private:
|
|
std::unique_ptr<Expression> lhs;
|
|
std::unique_ptr<Expression> rhs;
|
|
bool negate;
|
|
};
|
|
|
|
} // namespace expression
|
|
} // namespace style
|
|
} // namespace mbgl
|