MapLibre Native Core
|
Namespaces | |
detail | |
dsl | |
type | |
Typedefs | |
using | Interpolator = variant< ExponentialInterpolator, CubicBezierInterpolator > |
using | ParseResult = std::optional< std::unique_ptr< Expression > > |
using | ValueBase = variant< NullValue, bool, double, std::string, Color, Collator, Formatted, Image, mapbox::util::recursive_wrapper< std::vector< Value > >, mapbox::util::recursive_wrapper< std::unordered_map< std::string, Value > >> |
Enumerations | |
enum class | Kind : int32_t { Coalesce , CompoundExpression , Literal , At , Interpolate , Assertion , Length , Step , Let , Var , CollatorExpression , Coercion , Match , Error , Case , Any , All , Comparison , FormatExpression , FormatSectionOverride , NumberFormat , ImageExpression , In , Within , Distance } |
enum class | TypeAnnotationOption { coerce , assert , omit } |
Functions | |
ParseResult | parseComparison (const mbgl::style::conversion::Convertible &, ParsingContext &) |
ParseResult | parseCompoundExpression (const std::string &name, const mbgl::style::conversion::Convertible &value, ParsingContext &ctx) |
ParseResult | createCompoundExpression (const std::string &name, std::vector< std::unique_ptr< Expression >> args, ParsingContext &ctx) |
std::optional< variant< const Interpolate *, const Step *, ParsingError > > | findZoomCurve (const expression::Expression *e) |
variant< std::nullptr_t, const Interpolate *, const Step * > | findZoomCurveChecked (const expression::Expression *e) |
Range< float > | getCoveringStops (const std::map< double, std::unique_ptr< Expression >> &stops, double lower, double upper) |
Return the smallest range of stops that covers the interval [lower, upper]. More... | |
ParseResult | parseInterpolate (const mbgl::style::conversion::Convertible &value, ParsingContext &ctx) |
ParseResult | createInterpolate (type::Type type, Interpolator interpolator, std::unique_ptr< Expression > input, std::map< double, std::unique_ptr< Expression >> stops, ParsingContext &ctx) |
template<typename T > | |
bool | isGlobalPropertyConstant (const Expression &expression, const T &properties) |
bool | isFeatureConstant (const Expression &expression) |
bool | isZoomConstant (const Expression &e) |
bool | isRuntimeConstant (const Expression &e) |
Returns true if expression does not depend on information provided by the runtime. More... | |
bool | isExpression (const conversion::Convertible &value) |
ParseResult | parseMatch (const mbgl::style::conversion::Convertible &value, ParsingContext &ctx) |
bool | isExpression (const std::string &) |
type::Type | typeOf (const Value &value) |
std::string | toString (const Value &value) |
std::string | stringify (const Value &value) |
template<typename T > | |
type::Type | valueTypeToExpressionType () |
template<typename T > | |
Value | toExpressionValue (const T &value) |
template<typename T > | |
std::optional< T > | fromExpressionValue (const Value &value) |
template<typename T > | |
std::vector< std::optional< T > > | fromExpressionValues (const std::vector< std::optional< Value >> &values) |
Variables | |
const char *const | kFormattedSectionFontScale |
const char *const | kFormattedSectionTextFont |
const char *const | kFormattedSectionTextColor |
constexpr NullValue | Null = NullValue() |
using mbgl::style::expression::Interpolator = typedef variant<ExponentialInterpolator, CubicBezierInterpolator> |
Definition at line 52 of file interpolator.hpp.
using mbgl::style::expression::ParseResult = typedef std::optional<std::unique_ptr<Expression> > |
Definition at line 28 of file parsing_context.hpp.
|
strong |
Expression is an abstract class that serves as an interface and base class for particular expression implementations.
CompoundExpression implements the majority of expressions in the spec by inferring the argument and output from a simple function (const T0& arg0, const T1& arg1, ...) -> Result where T0, T1, ..., U are member types of mbgl::style::expression::Value.
The other Expression subclasses (Let, Curve, Match, etc.) exist in order to implement expressions that need specialized parsing, type checking, or evaluation logic that can't be handled by CompoundExpression's inference mechanism.
Each Expression subclass also provides a static ParseResult ExpressionClass::parse(const V&, ParsingContext), which handles parsing a style-spec JSON representation of the expression.
Definition at line 151 of file expression.hpp.
|
strong |
Controls the annotation behavior of the parser when encountering an expression whose type is not a subtype of the expected type. The default behavior, used when optional<TypeAnnotationOption> is a nullopt, is as follows:
When we expect a number, string, boolean, or array but have a value, wrap it in an assertion. When we expect a color or formatted string, but have a string or value, wrap it in a coercion. Otherwise, we do static type-checking.
These behaviors are overridable for: The "coalesce" operator, which needs to omit type annotations. String-valued properties (e.g. text-field
), where coercion is more convenient than assertion.
Enumerator | |
---|---|
coerce | |
assert | |
omit |
Definition at line 69 of file parsing_context.hpp.
ParseResult mbgl::style::expression::createCompoundExpression | ( | const std::string & | name, |
std::vector< std::unique_ptr< Expression >> | args, | ||
ParsingContext & | ctx | ||
) |
ParseResult mbgl::style::expression::createInterpolate | ( | type::Type | type, |
Interpolator | interpolator, | ||
std::unique_ptr< Expression > | input, | ||
std::map< double, std::unique_ptr< Expression >> | stops, | ||
ParsingContext & | ctx | ||
) |
std::optional<variant<const Interpolate*, const Step*, ParsingError> > mbgl::style::expression::findZoomCurve | ( | const expression::Expression * | e | ) |
variant<std::nullptr_t, const Interpolate*, const Step*> mbgl::style::expression::findZoomCurveChecked | ( | const expression::Expression * | e | ) |
std::optional<T> mbgl::style::expression::fromExpressionValue | ( | const Value & | value | ) |
std::vector<std::optional<T> > mbgl::style::expression::fromExpressionValues | ( | const std::vector< std::optional< Value >> & | values | ) |
Range<float> mbgl::style::expression::getCoveringStops | ( | const std::map< double, std::unique_ptr< Expression >> & | stops, |
double | lower, | ||
double | upper | ||
) |
Return the smallest range of stops that covers the interval [lower, upper].
bool mbgl::style::expression::isExpression | ( | const conversion::Convertible & | value | ) |
bool mbgl::style::expression::isExpression | ( | const std::string & | ) |
bool mbgl::style::expression::isFeatureConstant | ( | const Expression & | expression | ) |
bool mbgl::style::expression::isGlobalPropertyConstant | ( | const Expression & | expression, |
const T & | properties | ||
) |
Definition at line 11 of file is_constant.hpp.
bool mbgl::style::expression::isRuntimeConstant | ( | const Expression & | e | ) |
Returns true if expression does not depend on information provided by the runtime.
bool mbgl::style::expression::isZoomConstant | ( | const Expression & | e | ) |
ParseResult mbgl::style::expression::parseComparison | ( | const mbgl::style::conversion::Convertible & | , |
ParsingContext & | |||
) |
ParseResult mbgl::style::expression::parseCompoundExpression | ( | const std::string & | name, |
const mbgl::style::conversion::Convertible & | value, | ||
ParsingContext & | ctx | ||
) |
ParseResult mbgl::style::expression::parseInterpolate | ( | const mbgl::style::conversion::Convertible & | value, |
ParsingContext & | ctx | ||
) |
ParseResult mbgl::style::expression::parseMatch | ( | const mbgl::style::conversion::Convertible & | value, |
ParsingContext & | ctx | ||
) |
std::string mbgl::style::expression::stringify | ( | const Value & | value | ) |
Value mbgl::style::expression::toExpressionValue | ( | const T & | value | ) |
std::string mbgl::style::expression::toString | ( | const Value & | value | ) |
type::Type mbgl::style::expression::typeOf | ( | const Value & | value | ) |
type::Type mbgl::style::expression::valueTypeToExpressionType | ( | ) |
|
extern |
|
extern |
|
extern |