#pragma once #include #include #include #include #include #include #include #include #include namespace mbgl { namespace style { namespace conversion { template struct Converter> { optional> operator()(const Convertible& value, Error& error) const { using namespace mbgl::style::expression; if (isUndefined(value)) { return PropertyValue(); } else if (isExpression(value)) { ParsingContext ctx(valueTypeToExpressionType()); ParseResult expression = ctx.parseLayerPropertyExpression(value); if (!expression) { error = { ctx.getCombinedErrors() }; return {}; } if (isFeatureConstant(**expression)) { return { CameraFunction(std::move(*expression)) }; } else { error = { "property expressions not supported" }; return {}; } } else if (isObject(value)) { optional> function = convert>(value, error); if (!function) { return {}; } return { *function }; } else { optional constant = convert(value, error); if (!constant) { return {}; } return { *constant }; } } }; } // namespace conversion } // namespace style } // namespace mbgl