summaryrefslogtreecommitdiff
path: root/src/mbgl/style
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-08-17 15:38:47 -0700
committerKonstantin Käfer <mail@kkaefer.com>2018-08-19 13:09:16 +0200
commit112bbc7ab289298094d6e6593437a71ec8029caa (patch)
tree229af7a6d7610e20edea65d565adbff9c9cd5f06 /src/mbgl/style
parent9df9f5fe2089a0dcd0d039115dec5cc63010603a (diff)
downloadqtlocation-mapboxgl-112bbc7ab289298094d6e6593437a71ec8029caa.tar.gz
[core] make style/conversion.hpp implementation private
Diffstat (limited to 'src/mbgl/style')
-rw-r--r--src/mbgl/style/conversion/color_ramp_property_value.cpp2
-rw-r--r--src/mbgl/style/conversion/constant.cpp56
-rw-r--r--src/mbgl/style/conversion/coordinate.cpp1
-rw-r--r--src/mbgl/style/conversion/custom_geometry_source_options.cpp1
-rw-r--r--src/mbgl/style/conversion/filter.cpp3
-rw-r--r--src/mbgl/style/conversion/function.cpp68
-rw-r--r--src/mbgl/style/conversion/geojson.cpp1
-rw-r--r--src/mbgl/style/conversion/geojson_options.cpp1
-rw-r--r--src/mbgl/style/conversion/get_json_type.cpp1
-rw-r--r--src/mbgl/style/conversion/json.hpp2
-rw-r--r--src/mbgl/style/conversion/layer.cpp1
-rw-r--r--src/mbgl/style/conversion/light.cpp1
-rw-r--r--src/mbgl/style/conversion/position.cpp1
-rw-r--r--src/mbgl/style/conversion/property_value.cpp83
-rw-r--r--src/mbgl/style/conversion/source.cpp1
-rw-r--r--src/mbgl/style/conversion/tileset.cpp1
-rw-r--r--src/mbgl/style/conversion/transition_options.cpp1
-rw-r--r--src/mbgl/style/expression/array_assertion.cpp1
-rw-r--r--src/mbgl/style/expression/assertion.cpp1
-rw-r--r--src/mbgl/style/expression/at.cpp1
-rw-r--r--src/mbgl/style/expression/boolean_operator.cpp1
-rw-r--r--src/mbgl/style/expression/case.cpp1
-rw-r--r--src/mbgl/style/expression/coalesce.cpp1
-rw-r--r--src/mbgl/style/expression/coercion.cpp1
-rw-r--r--src/mbgl/style/expression/collator_expression.cpp1
-rw-r--r--src/mbgl/style/expression/comparison.cpp1
-rw-r--r--src/mbgl/style/expression/compound_expression.cpp1
-rw-r--r--src/mbgl/style/expression/interpolate.cpp1
-rw-r--r--src/mbgl/style/expression/is_expression.cpp3
-rw-r--r--src/mbgl/style/expression/length.cpp1
-rw-r--r--src/mbgl/style/expression/let.cpp1
-rw-r--r--src/mbgl/style/expression/literal.cpp1
-rw-r--r--src/mbgl/style/expression/match.cpp1
-rw-r--r--src/mbgl/style/expression/parsing_context.cpp1
-rw-r--r--src/mbgl/style/expression/step.cpp1
-rw-r--r--src/mbgl/style/layer.cpp1
-rw-r--r--src/mbgl/style/layers/background_layer.cpp2
-rw-r--r--src/mbgl/style/layers/circle_layer.cpp2
-rw-r--r--src/mbgl/style/layers/fill_extrusion_layer.cpp2
-rw-r--r--src/mbgl/style/layers/fill_layer.cpp2
-rw-r--r--src/mbgl/style/layers/heatmap_layer.cpp2
-rw-r--r--src/mbgl/style/layers/hillshade_layer.cpp2
-rw-r--r--src/mbgl/style/layers/layer.cpp.ejs2
-rw-r--r--src/mbgl/style/layers/line_layer.cpp2
-rw-r--r--src/mbgl/style/layers/raster_layer.cpp2
-rw-r--r--src/mbgl/style/layers/symbol_layer.cpp2
-rw-r--r--src/mbgl/style/parser.cpp2
-rw-r--r--src/mbgl/style/rapidjson_conversion.hpp2
48 files changed, 253 insertions, 17 deletions
diff --git a/src/mbgl/style/conversion/color_ramp_property_value.cpp b/src/mbgl/style/conversion/color_ramp_property_value.cpp
index f29438b6a2..0da16c67ee 100644
--- a/src/mbgl/style/conversion/color_ramp_property_value.cpp
+++ b/src/mbgl/style/conversion/color_ramp_property_value.cpp
@@ -1,6 +1,6 @@
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
-#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/constant.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/style/expression/value.hpp>
#include <mbgl/style/expression/is_constant.hpp>
#include <mbgl/style/expression/is_expression.hpp>
diff --git a/src/mbgl/style/conversion/constant.cpp b/src/mbgl/style/conversion/constant.cpp
index d432b5f051..de4ab22269 100644
--- a/src/mbgl/style/conversion/constant.cpp
+++ b/src/mbgl/style/conversion/constant.cpp
@@ -1,4 +1,5 @@
#include <mbgl/style/conversion/constant.hpp>
+#include <mbgl/style/conversion_impl.hpp>
namespace mbgl {
namespace style {
@@ -31,6 +32,38 @@ optional<std::string> Converter<std::string>::operator()(const Convertible& valu
return *converted;
}
+template <class T>
+optional<T> Converter<T, typename std::enable_if_t<std::is_enum<T>::value>>::operator()(const Convertible& value, Error& error) const {
+ optional<std::string> string = toString(value);
+ if (!string) {
+ error.message = "value must be a string";
+ return nullopt;
+ }
+
+ const auto result = Enum<T>::toEnum(*string);
+ if (!result) {
+ error.message = "value must be a valid enumeration value";
+ return nullopt;
+ }
+
+ return *result;
+}
+
+template optional<AlignmentType> Converter<AlignmentType>::operator()(const Convertible&, Error&) const;
+template optional<CirclePitchScaleType> Converter<CirclePitchScaleType>::operator()(const Convertible&, Error&) const;
+template optional<HillshadeIlluminationAnchorType> Converter<HillshadeIlluminationAnchorType>::operator()(const Convertible&, Error&) const;
+template optional<IconTextFitType> Converter<IconTextFitType>::operator()(const Convertible&, Error&) const;
+template optional<LightAnchorType> Converter<LightAnchorType>::operator()(const Convertible&, Error&) const;
+template optional<LineCapType> Converter<LineCapType>::operator()(const Convertible&, Error&) const;
+template optional<LineJoinType> Converter<LineJoinType>::operator()(const Convertible&, Error&) const;
+template optional<RasterResamplingType> Converter<RasterResamplingType>::operator()(const Convertible&, Error&) const;
+template optional<SymbolAnchorType> Converter<SymbolAnchorType>::operator()(const Convertible&, Error&) const;
+template optional<SymbolPlacementType> Converter<SymbolPlacementType>::operator()(const Convertible&, Error&) const;
+template optional<TextJustifyType> Converter<TextJustifyType>::operator()(const Convertible&, Error&) const;
+template optional<TextTransformType> Converter<TextTransformType>::operator()(const Convertible&, Error&) const;
+template optional<TranslateAnchorType> Converter<TranslateAnchorType>::operator()(const Convertible&, Error&) const;
+template optional<VisibilityType> Converter<VisibilityType>::operator()(const Convertible&, Error&) const;
+
optional<Color> Converter<Color>::operator()(const Convertible& value, Error& error) const {
optional<std::string> string = toString(value);
if (!string) {
@@ -47,6 +80,29 @@ optional<Color> Converter<Color>::operator()(const Convertible& value, Error& er
return *color;
}
+template <size_t N>
+optional<std::array<float, N>> Converter<std::array<float, N>>::operator()(const Convertible& value, Error& error) const {
+ if (!isArray(value) || arrayLength(value) != N) {
+ error.message = "value must be an array of " + util::toString(N) + " numbers";
+ return nullopt;
+ }
+
+ std::array<float, N> result;
+ for (size_t i = 0; i < N; i++) {
+ optional<float> n = toNumber(arrayMember(value, i));
+ if (!n) {
+ error.message = "value must be an array of " + util::toString(N) + " numbers";
+ return nullopt;
+ }
+ result[i] = *n;
+ }
+ return result;
+}
+
+template optional<std::array<float, 2>> Converter<std::array<float, 2>>::operator()(const Convertible&, Error&) const;
+template optional<std::array<float, 3>> Converter<std::array<float, 3>>::operator()(const Convertible&, Error&) const;
+template optional<std::array<float, 4>> Converter<std::array<float, 4>>::operator()(const Convertible&, Error&) const;
+
optional<std::vector<float>> Converter<std::vector<float>>::operator()(const Convertible& value, Error& error) const {
if (!isArray(value)) {
error.message = "value must be an array";
diff --git a/src/mbgl/style/conversion/coordinate.cpp b/src/mbgl/style/conversion/coordinate.cpp
index 20abd45e26..ee03bffb30 100644
--- a/src/mbgl/style/conversion/coordinate.cpp
+++ b/src/mbgl/style/conversion/coordinate.cpp
@@ -1,4 +1,5 @@
#include <mbgl/style/conversion/coordinate.hpp>
+#include <mbgl/style/conversion_impl.hpp>
namespace mbgl {
namespace style {
diff --git a/src/mbgl/style/conversion/custom_geometry_source_options.cpp b/src/mbgl/style/conversion/custom_geometry_source_options.cpp
index 8983f9f479..491509c28f 100644
--- a/src/mbgl/style/conversion/custom_geometry_source_options.cpp
+++ b/src/mbgl/style/conversion/custom_geometry_source_options.cpp
@@ -1,4 +1,5 @@
#include <mbgl/style/conversion/custom_geometry_source_options.hpp>
+#include <mbgl/style/conversion_impl.hpp>
namespace mbgl {
namespace style {
diff --git a/src/mbgl/style/conversion/filter.cpp b/src/mbgl/style/conversion/filter.cpp
index 5114c61778..fc25ab0b0d 100644
--- a/src/mbgl/style/conversion/filter.cpp
+++ b/src/mbgl/style/conversion/filter.cpp
@@ -1,10 +1,11 @@
#include <mbgl/style/conversion/filter.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/style/expression/literal.hpp>
-#include <mbgl/util/geometry.hpp>
#include <mbgl/style/expression/expression.hpp>
#include <mbgl/style/expression/type.hpp>
#include <mbgl/style/expression/compound_expression.hpp>
#include <mbgl/style/expression/boolean_operator.hpp>
+#include <mbgl/util/geometry.hpp>
namespace mbgl {
namespace style {
diff --git a/src/mbgl/style/conversion/function.cpp b/src/mbgl/style/conversion/function.cpp
index 1cc49e483a..6aadaad3b3 100644
--- a/src/mbgl/style/conversion/function.cpp
+++ b/src/mbgl/style/conversion/function.cpp
@@ -1,4 +1,6 @@
#include <mbgl/style/conversion/function.hpp>
+#include <mbgl/style/conversion/position.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/style/expression/dsl.hpp>
#include <mbgl/style/expression/step.hpp>
#include <mbgl/style/expression/interpolate.hpp>
@@ -70,6 +72,72 @@ std::unique_ptr<Expression> convertTokenStringToExpression(const std::string& so
}
}
+template <class T>
+optional<PropertyExpression<T>> convertFunctionToExpression(const Convertible& value, Error& error, bool convertTokens) {
+ auto expression = convertFunctionToExpression(expression::valueTypeToExpressionType<T>(), value, error, convertTokens);
+ if (!expression) {
+ return nullopt;
+ }
+
+ optional<T> defaultValue;
+
+ auto defaultValueValue = objectMember(value, "default");
+ if (defaultValueValue) {
+ defaultValue = convert<T>(*defaultValueValue, error);
+ if (!defaultValue) {
+ error.message = R"(wrong type for "default": )" + error.message;
+ return nullopt;
+ }
+ }
+
+ return PropertyExpression<T>(std::move(*expression), defaultValue);
+}
+
+template optional<PropertyExpression<AlignmentType>>
+ convertFunctionToExpression<AlignmentType>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<bool>>
+ convertFunctionToExpression<bool>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<CirclePitchScaleType>>
+ convertFunctionToExpression<CirclePitchScaleType>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<float>>
+ convertFunctionToExpression<float>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<HillshadeIlluminationAnchorType>>
+ convertFunctionToExpression<HillshadeIlluminationAnchorType>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<IconTextFitType>>
+ convertFunctionToExpression<IconTextFitType>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<LightAnchorType>>
+ convertFunctionToExpression<LightAnchorType>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<LineCapType>>
+ convertFunctionToExpression<LineCapType>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<LineJoinType>>
+ convertFunctionToExpression<LineJoinType>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<Color>>
+ convertFunctionToExpression<Color>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<Position>>
+ convertFunctionToExpression<Position>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<RasterResamplingType>>
+ convertFunctionToExpression<RasterResamplingType>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<std::array<float, 2>>>
+ convertFunctionToExpression<std::array<float, 2>>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<std::array<float, 4>>>
+ convertFunctionToExpression<std::array<float, 4>>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<std::string>>
+ convertFunctionToExpression<std::string>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<std::vector<float>>>
+ convertFunctionToExpression<std::vector<float>>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<std::vector<std::string>>>
+ convertFunctionToExpression<std::vector<std::string>>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<SymbolAnchorType>>
+ convertFunctionToExpression<SymbolAnchorType>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<SymbolPlacementType>>
+ convertFunctionToExpression<SymbolPlacementType>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<TextJustifyType>>
+ convertFunctionToExpression<TextJustifyType>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<TextTransformType>>
+ convertFunctionToExpression<TextTransformType>(const Convertible&, Error&, bool);
+template optional<PropertyExpression<TranslateAnchorType>>
+ convertFunctionToExpression<TranslateAnchorType>(const Convertible&, Error&, bool);
+
// Ad-hoc Converters for double and int64_t. We should replace float with double wholesale,
// and promote the int64_t Converter to general use (and it should check that the input is
// an integer).
diff --git a/src/mbgl/style/conversion/geojson.cpp b/src/mbgl/style/conversion/geojson.cpp
index e39a1a80eb..c2d34c5491 100644
--- a/src/mbgl/style/conversion/geojson.cpp
+++ b/src/mbgl/style/conversion/geojson.cpp
@@ -1,5 +1,6 @@
#include <mbgl/style/conversion/geojson.hpp>
#include <mbgl/style/conversion/json.hpp>
+#include <mbgl/style/conversion_impl.hpp>
namespace mbgl {
namespace style {
diff --git a/src/mbgl/style/conversion/geojson_options.cpp b/src/mbgl/style/conversion/geojson_options.cpp
index 77340e5f1d..11bd7cc507 100644
--- a/src/mbgl/style/conversion/geojson_options.cpp
+++ b/src/mbgl/style/conversion/geojson_options.cpp
@@ -1,4 +1,5 @@
#include <mbgl/style/conversion/geojson_options.hpp>
+#include <mbgl/style/conversion_impl.hpp>
namespace mbgl {
namespace style {
diff --git a/src/mbgl/style/conversion/get_json_type.cpp b/src/mbgl/style/conversion/get_json_type.cpp
index cd3b4608b1..2e9d35a957 100644
--- a/src/mbgl/style/conversion/get_json_type.cpp
+++ b/src/mbgl/style/conversion/get_json_type.cpp
@@ -1,4 +1,5 @@
#include <mbgl/style/conversion/get_json_type.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/feature.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/conversion/json.hpp b/src/mbgl/style/conversion/json.hpp
index a823f6d383..3a7bf2b557 100644
--- a/src/mbgl/style/conversion/json.hpp
+++ b/src/mbgl/style/conversion/json.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include <mbgl/style/conversion.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/style/rapidjson_conversion.hpp>
#include <string>
diff --git a/src/mbgl/style/conversion/layer.cpp b/src/mbgl/style/conversion/layer.cpp
index d36ca494da..085d7ae4c6 100644
--- a/src/mbgl/style/conversion/layer.cpp
+++ b/src/mbgl/style/conversion/layer.cpp
@@ -1,6 +1,7 @@
#include <mbgl/style/conversion/layer.hpp>
#include <mbgl/style/conversion/constant.hpp>
#include <mbgl/style/conversion/filter.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/style/layers/background_layer.hpp>
#include <mbgl/style/layers/circle_layer.hpp>
#include <mbgl/style/layers/fill_layer.hpp>
diff --git a/src/mbgl/style/conversion/light.cpp b/src/mbgl/style/conversion/light.cpp
index 7b96c89a1c..e8723216ee 100644
--- a/src/mbgl/style/conversion/light.cpp
+++ b/src/mbgl/style/conversion/light.cpp
@@ -2,6 +2,7 @@
#include <mbgl/style/conversion/position.hpp>
#include <mbgl/style/conversion/property_value.hpp>
#include <mbgl/style/conversion/transition_options.hpp>
+#include <mbgl/style/conversion_impl.hpp>
namespace mbgl {
namespace style {
diff --git a/src/mbgl/style/conversion/position.cpp b/src/mbgl/style/conversion/position.cpp
index a19f57bff3..df6c868ee8 100644
--- a/src/mbgl/style/conversion/position.cpp
+++ b/src/mbgl/style/conversion/position.cpp
@@ -1,5 +1,6 @@
#include <mbgl/style/conversion/position.hpp>
#include <mbgl/style/conversion/constant.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <array>
diff --git a/src/mbgl/style/conversion/property_value.cpp b/src/mbgl/style/conversion/property_value.cpp
new file mode 100644
index 0000000000..8a93c24767
--- /dev/null
+++ b/src/mbgl/style/conversion/property_value.cpp
@@ -0,0 +1,83 @@
+#include <mbgl/style/conversion/property_value.hpp>
+#include <mbgl/style/conversion/position.hpp>
+#include <mbgl/style/conversion_impl.hpp>
+
+namespace mbgl {
+namespace style {
+namespace conversion {
+
+template <class T>
+optional<PropertyValue<T>> Converter<PropertyValue<T>>::operator()(const Convertible& value, Error& error, bool allowDataExpressions, bool convertTokens) const {
+ using namespace mbgl::style::expression;
+
+ if (isUndefined(value)) {
+ return PropertyValue<T>();
+ }
+
+ optional<PropertyExpression<T>> expression;
+
+ if (isExpression(value)) {
+ ParsingContext ctx(valueTypeToExpressionType<T>());
+ ParseResult parsed = ctx.parseLayerPropertyExpression(value);
+ if (!parsed) {
+ error.message = ctx.getCombinedErrors();
+ return nullopt;
+ }
+ expression = PropertyExpression<T>(std::move(*parsed));
+ } else if (isObject(value)) {
+ expression = convertFunctionToExpression<T>(value, error, convertTokens);
+ } else {
+ optional<T> constant = convert<T>(value, error);
+ if (!constant) {
+ return nullopt;
+ }
+ return convertTokens ? maybeConvertTokens(*constant) : PropertyValue<T>(*constant);
+ }
+
+ if (!expression) {
+ return nullopt;
+ } else if (!allowDataExpressions && !(*expression).isFeatureConstant()) {
+ error.message = "data expressions not supported";
+ return nullopt;
+ } else if (!(*expression).isFeatureConstant() || !(*expression).isZoomConstant()) {
+ return { std::move(*expression) };
+ } else if ((*expression).getExpression().getKind() == Kind::Literal) {
+ optional<T> constant = fromExpressionValue<T>(
+ static_cast<const Literal&>((*expression).getExpression()).getValue());
+ if (!constant) {
+ return nullopt;
+ }
+ return PropertyValue<T>(*constant);
+ } else {
+ assert(false);
+ error.message = "expected a literal expression";
+ return nullopt;
+ }
+}
+
+template optional<PropertyValue<bool>> Converter<PropertyValue<bool>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<float>> Converter<PropertyValue<float>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<std::array<float, 2>>> Converter<PropertyValue<std::array<float, 2>>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<std::array<float, 4>>> Converter<PropertyValue<std::array<float, 4>>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<std::vector<float>>> Converter<PropertyValue<std::vector<float>>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<Color>> Converter<PropertyValue<Color>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<std::string>> Converter<PropertyValue<std::string>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<std::vector<std::string>>> Converter<PropertyValue<std::vector<std::string>>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<AlignmentType>> Converter<PropertyValue<AlignmentType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<CirclePitchScaleType>> Converter<PropertyValue<CirclePitchScaleType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<HillshadeIlluminationAnchorType>> Converter<PropertyValue<HillshadeIlluminationAnchorType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<IconTextFitType>> Converter<PropertyValue<IconTextFitType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<LightAnchorType>> Converter<PropertyValue<LightAnchorType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<LineCapType>> Converter<PropertyValue<LineCapType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<LineJoinType>> Converter<PropertyValue<LineJoinType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<Position>> Converter<PropertyValue<Position>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<RasterResamplingType>> Converter<PropertyValue<RasterResamplingType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<SymbolAnchorType>> Converter<PropertyValue<SymbolAnchorType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<SymbolPlacementType>> Converter<PropertyValue<SymbolPlacementType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<TextJustifyType>> Converter<PropertyValue<TextJustifyType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<TextTransformType>> Converter<PropertyValue<TextTransformType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+template optional<PropertyValue<TranslateAnchorType>> Converter<PropertyValue<TranslateAnchorType>>::operator()(conversion::Convertible const&, conversion::Error&, bool, bool) const;
+
+} // namespace conversion
+} // namespace style
+} // namespace mbgl
diff --git a/src/mbgl/style/conversion/source.cpp b/src/mbgl/style/conversion/source.cpp
index ce0cb24ce0..5ecbd3b474 100644
--- a/src/mbgl/style/conversion/source.cpp
+++ b/src/mbgl/style/conversion/source.cpp
@@ -3,6 +3,7 @@
#include <mbgl/style/conversion/geojson.hpp>
#include <mbgl/style/conversion/geojson_options.hpp>
#include <mbgl/style/conversion/tileset.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/style/sources/geojson_source.hpp>
#include <mbgl/style/sources/raster_source.hpp>
#include <mbgl/style/sources/raster_dem_source.hpp>
diff --git a/src/mbgl/style/conversion/tileset.cpp b/src/mbgl/style/conversion/tileset.cpp
index b566af0a18..40575838ea 100644
--- a/src/mbgl/style/conversion/tileset.cpp
+++ b/src/mbgl/style/conversion/tileset.cpp
@@ -1,4 +1,5 @@
#include <mbgl/style/conversion/tileset.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/geo.hpp>
#include <mbgl/math/clamp.hpp>
diff --git a/src/mbgl/style/conversion/transition_options.cpp b/src/mbgl/style/conversion/transition_options.cpp
index 924032a0c0..6e39dca24f 100644
--- a/src/mbgl/style/conversion/transition_options.cpp
+++ b/src/mbgl/style/conversion/transition_options.cpp
@@ -1,4 +1,5 @@
#include <mbgl/style/conversion/transition_options.hpp>
+#include <mbgl/style/conversion_impl.hpp>
namespace mbgl {
namespace style {
diff --git a/src/mbgl/style/expression/array_assertion.cpp b/src/mbgl/style/expression/array_assertion.cpp
index 4049301b0b..9df586bdc3 100644
--- a/src/mbgl/style/expression/array_assertion.cpp
+++ b/src/mbgl/style/expression/array_assertion.cpp
@@ -1,5 +1,6 @@
#include <mbgl/style/expression/array_assertion.hpp>
#include <mbgl/style/expression/check_subtype.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/string.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/expression/assertion.cpp b/src/mbgl/style/expression/assertion.cpp
index 2434d7a2f8..7e93003ac3 100644
--- a/src/mbgl/style/expression/assertion.cpp
+++ b/src/mbgl/style/expression/assertion.cpp
@@ -1,5 +1,6 @@
#include <mbgl/style/expression/assertion.hpp>
#include <mbgl/style/expression/check_subtype.hpp>
+#include <mbgl/style/conversion_impl.hpp>
namespace mbgl {
namespace style {
diff --git a/src/mbgl/style/expression/at.cpp b/src/mbgl/style/expression/at.cpp
index 725e5ddb51..648f247830 100644
--- a/src/mbgl/style/expression/at.cpp
+++ b/src/mbgl/style/expression/at.cpp
@@ -1,4 +1,5 @@
#include <mbgl/style/expression/at.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/string.hpp>
diff --git a/src/mbgl/style/expression/boolean_operator.cpp b/src/mbgl/style/expression/boolean_operator.cpp
index 68e96129aa..fa472270ce 100644
--- a/src/mbgl/style/expression/boolean_operator.cpp
+++ b/src/mbgl/style/expression/boolean_operator.cpp
@@ -1,4 +1,5 @@
#include <mbgl/style/expression/boolean_operator.hpp>
+#include <mbgl/style/conversion_impl.hpp>
namespace mbgl {
namespace style {
diff --git a/src/mbgl/style/expression/case.cpp b/src/mbgl/style/expression/case.cpp
index e885c0ce6b..0c2ff0d7cd 100644
--- a/src/mbgl/style/expression/case.cpp
+++ b/src/mbgl/style/expression/case.cpp
@@ -1,4 +1,5 @@
#include <mbgl/style/expression/case.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/string.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/expression/coalesce.cpp b/src/mbgl/style/expression/coalesce.cpp
index 0090f16009..cdbf452f7f 100644
--- a/src/mbgl/style/expression/coalesce.cpp
+++ b/src/mbgl/style/expression/coalesce.cpp
@@ -1,5 +1,6 @@
#include <mbgl/style/expression/coalesce.hpp>
#include <mbgl/style/expression/check_subtype.hpp>
+#include <mbgl/style/conversion_impl.hpp>
namespace mbgl {
namespace style {
diff --git a/src/mbgl/style/expression/coercion.cpp b/src/mbgl/style/expression/coercion.cpp
index f5a4d70f66..486658ddda 100644
--- a/src/mbgl/style/expression/coercion.cpp
+++ b/src/mbgl/style/expression/coercion.cpp
@@ -1,6 +1,7 @@
#include <mbgl/style/expression/coercion.hpp>
#include <mbgl/style/expression/check_subtype.hpp>
#include <mbgl/style/expression/util.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/string.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/expression/collator_expression.cpp b/src/mbgl/style/expression/collator_expression.cpp
index b27eedbc76..07346633a2 100644
--- a/src/mbgl/style/expression/collator_expression.cpp
+++ b/src/mbgl/style/expression/collator_expression.cpp
@@ -1,6 +1,7 @@
#include <mbgl/style/expression/collator.hpp>
#include <mbgl/style/expression/collator_expression.hpp>
#include <mbgl/style/expression/literal.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/string.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/expression/comparison.cpp b/src/mbgl/style/expression/comparison.cpp
index 6179c3ce88..cdcdb5d59c 100644
--- a/src/mbgl/style/expression/comparison.cpp
+++ b/src/mbgl/style/expression/comparison.cpp
@@ -1,6 +1,7 @@
#include <mbgl/style/expression/collator.hpp>
#include <mbgl/style/expression/comparison.hpp>
#include <mbgl/style/expression/dsl.hpp>
+#include <mbgl/style/conversion_impl.hpp>
namespace mbgl {
namespace style {
diff --git a/src/mbgl/style/expression/compound_expression.cpp b/src/mbgl/style/expression/compound_expression.cpp
index 4c476a3749..f8c2376cb3 100644
--- a/src/mbgl/style/expression/compound_expression.cpp
+++ b/src/mbgl/style/expression/compound_expression.cpp
@@ -3,6 +3,7 @@
#include <mbgl/style/expression/compound_expression.hpp>
#include <mbgl/style/expression/check_subtype.hpp>
#include <mbgl/style/expression/util.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/tile/geometry_tile_data.hpp>
#include <mbgl/math/log2.hpp>
#include <mbgl/util/i18n.hpp>
diff --git a/src/mbgl/style/expression/interpolate.cpp b/src/mbgl/style/expression/interpolate.cpp
index 54fbc6e1d7..8725e9e86d 100644
--- a/src/mbgl/style/expression/interpolate.cpp
+++ b/src/mbgl/style/expression/interpolate.cpp
@@ -1,4 +1,5 @@
#include <mbgl/style/expression/interpolate.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/string.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/expression/is_expression.cpp b/src/mbgl/style/expression/is_expression.cpp
index 77212f6a1e..acf074c25b 100644
--- a/src/mbgl/style/expression/is_expression.cpp
+++ b/src/mbgl/style/expression/is_expression.cpp
@@ -1,8 +1,7 @@
#include <mbgl/style/expression/is_expression.hpp>
#include <mbgl/style/expression/compound_expression.hpp>
#include <mbgl/style/expression/parsing_context.hpp>
-
-#include <mbgl/style/conversion.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <unordered_set>
diff --git a/src/mbgl/style/expression/length.cpp b/src/mbgl/style/expression/length.cpp
index ad7a15675a..f1b58d7952 100644
--- a/src/mbgl/style/expression/length.cpp
+++ b/src/mbgl/style/expression/length.cpp
@@ -1,4 +1,5 @@
#include <mbgl/style/expression/length.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/string.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/expression/let.cpp b/src/mbgl/style/expression/let.cpp
index 242a995b0b..592ceed58a 100644
--- a/src/mbgl/style/expression/let.cpp
+++ b/src/mbgl/style/expression/let.cpp
@@ -1,5 +1,6 @@
#include <mbgl/style/expression/let.hpp>
#include <mbgl/style/conversion/get_json_type.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/string.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/expression/literal.cpp b/src/mbgl/style/expression/literal.cpp
index 345a52de9b..c69341d298 100644
--- a/src/mbgl/style/expression/literal.cpp
+++ b/src/mbgl/style/expression/literal.cpp
@@ -1,4 +1,5 @@
#include <mbgl/style/expression/literal.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/string.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/expression/match.cpp b/src/mbgl/style/expression/match.cpp
index 4b4984811f..0f05001a97 100644
--- a/src/mbgl/style/expression/match.cpp
+++ b/src/mbgl/style/expression/match.cpp
@@ -1,6 +1,7 @@
#include <mbgl/style/expression/match.hpp>
#include <mbgl/style/expression/check_subtype.hpp>
#include <mbgl/style/expression/parsing_context.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/string.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/expression/parsing_context.cpp b/src/mbgl/style/expression/parsing_context.cpp
index b3f6b1acee..ef17caed33 100644
--- a/src/mbgl/style/expression/parsing_context.cpp
+++ b/src/mbgl/style/expression/parsing_context.cpp
@@ -24,6 +24,7 @@
#include <mbgl/style/expression/find_zoom_curve.hpp>
#include <mbgl/style/conversion/get_json_type.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/string.hpp>
diff --git a/src/mbgl/style/expression/step.cpp b/src/mbgl/style/expression/step.cpp
index a1ca0a702e..39b04c04a0 100644
--- a/src/mbgl/style/expression/step.cpp
+++ b/src/mbgl/style/expression/step.cpp
@@ -1,5 +1,6 @@
#include <mbgl/style/expression/step.hpp>
#include <mbgl/style/expression/get_covering_stops.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/string.hpp>
#include <cmath>
diff --git a/src/mbgl/style/layer.cpp b/src/mbgl/style/layer.cpp
index 31ff5bf47a..e08b71e6b3 100644
--- a/src/mbgl/style/layer.cpp
+++ b/src/mbgl/style/layer.cpp
@@ -2,6 +2,7 @@
#include <mbgl/style/layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
#include <mbgl/style/conversion/constant.hpp>
+#include <mbgl/style/conversion_impl.hpp>
namespace mbgl {
namespace style {
diff --git a/src/mbgl/style/layers/background_layer.cpp b/src/mbgl/style/layers/background_layer.cpp
index e47b41daa8..f2e85ce7e7 100644
--- a/src/mbgl/style/layers/background_layer.cpp
+++ b/src/mbgl/style/layers/background_layer.cpp
@@ -3,12 +3,12 @@
#include <mbgl/style/layers/background_layer.hpp>
#include <mbgl/style/layers/background_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
-#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
#include <mbgl/style/conversion/constant.hpp>
#include <mbgl/style/conversion/property_value.hpp>
#include <mbgl/style/conversion/transition_options.hpp>
#include <mbgl/style/conversion/json.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/layers/circle_layer.cpp b/src/mbgl/style/layers/circle_layer.cpp
index 1dae77547b..c301a83c9e 100644
--- a/src/mbgl/style/layers/circle_layer.cpp
+++ b/src/mbgl/style/layers/circle_layer.cpp
@@ -3,12 +3,12 @@
#include <mbgl/style/layers/circle_layer.hpp>
#include <mbgl/style/layers/circle_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
-#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
#include <mbgl/style/conversion/constant.hpp>
#include <mbgl/style/conversion/property_value.hpp>
#include <mbgl/style/conversion/transition_options.hpp>
#include <mbgl/style/conversion/json.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/layers/fill_extrusion_layer.cpp b/src/mbgl/style/layers/fill_extrusion_layer.cpp
index db90415daa..74cdb9abe6 100644
--- a/src/mbgl/style/layers/fill_extrusion_layer.cpp
+++ b/src/mbgl/style/layers/fill_extrusion_layer.cpp
@@ -3,12 +3,12 @@
#include <mbgl/style/layers/fill_extrusion_layer.hpp>
#include <mbgl/style/layers/fill_extrusion_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
-#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
#include <mbgl/style/conversion/constant.hpp>
#include <mbgl/style/conversion/property_value.hpp>
#include <mbgl/style/conversion/transition_options.hpp>
#include <mbgl/style/conversion/json.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/layers/fill_layer.cpp b/src/mbgl/style/layers/fill_layer.cpp
index 2da131b6b2..bdfc000736 100644
--- a/src/mbgl/style/layers/fill_layer.cpp
+++ b/src/mbgl/style/layers/fill_layer.cpp
@@ -3,12 +3,12 @@
#include <mbgl/style/layers/fill_layer.hpp>
#include <mbgl/style/layers/fill_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
-#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
#include <mbgl/style/conversion/constant.hpp>
#include <mbgl/style/conversion/property_value.hpp>
#include <mbgl/style/conversion/transition_options.hpp>
#include <mbgl/style/conversion/json.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/layers/heatmap_layer.cpp b/src/mbgl/style/layers/heatmap_layer.cpp
index df00558135..a90aab7009 100644
--- a/src/mbgl/style/layers/heatmap_layer.cpp
+++ b/src/mbgl/style/layers/heatmap_layer.cpp
@@ -3,12 +3,12 @@
#include <mbgl/style/layers/heatmap_layer.hpp>
#include <mbgl/style/layers/heatmap_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
-#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
#include <mbgl/style/conversion/constant.hpp>
#include <mbgl/style/conversion/property_value.hpp>
#include <mbgl/style/conversion/transition_options.hpp>
#include <mbgl/style/conversion/json.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/layers/hillshade_layer.cpp b/src/mbgl/style/layers/hillshade_layer.cpp
index fb96c681cc..aed49f6441 100644
--- a/src/mbgl/style/layers/hillshade_layer.cpp
+++ b/src/mbgl/style/layers/hillshade_layer.cpp
@@ -3,12 +3,12 @@
#include <mbgl/style/layers/hillshade_layer.hpp>
#include <mbgl/style/layers/hillshade_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
-#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
#include <mbgl/style/conversion/constant.hpp>
#include <mbgl/style/conversion/property_value.hpp>
#include <mbgl/style/conversion/transition_options.hpp>
#include <mbgl/style/conversion/json.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/layers/layer.cpp.ejs b/src/mbgl/style/layers/layer.cpp.ejs
index 4e80a7bf74..b5fb1a97a4 100644
--- a/src/mbgl/style/layers/layer.cpp.ejs
+++ b/src/mbgl/style/layers/layer.cpp.ejs
@@ -8,12 +8,12 @@
#include <mbgl/style/layers/<%- type.replace('-', '_') %>_layer.hpp>
#include <mbgl/style/layers/<%- type.replace('-', '_') %>_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
-#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
#include <mbgl/style/conversion/constant.hpp>
#include <mbgl/style/conversion/property_value.hpp>
#include <mbgl/style/conversion/transition_options.hpp>
#include <mbgl/style/conversion/json.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/layers/line_layer.cpp b/src/mbgl/style/layers/line_layer.cpp
index c744adad95..1b84c2d73e 100644
--- a/src/mbgl/style/layers/line_layer.cpp
+++ b/src/mbgl/style/layers/line_layer.cpp
@@ -3,12 +3,12 @@
#include <mbgl/style/layers/line_layer.hpp>
#include <mbgl/style/layers/line_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
-#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
#include <mbgl/style/conversion/constant.hpp>
#include <mbgl/style/conversion/property_value.hpp>
#include <mbgl/style/conversion/transition_options.hpp>
#include <mbgl/style/conversion/json.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/layers/raster_layer.cpp b/src/mbgl/style/layers/raster_layer.cpp
index 45d3240833..7bd01c92e1 100644
--- a/src/mbgl/style/layers/raster_layer.cpp
+++ b/src/mbgl/style/layers/raster_layer.cpp
@@ -3,12 +3,12 @@
#include <mbgl/style/layers/raster_layer.hpp>
#include <mbgl/style/layers/raster_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
-#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
#include <mbgl/style/conversion/constant.hpp>
#include <mbgl/style/conversion/property_value.hpp>
#include <mbgl/style/conversion/transition_options.hpp>
#include <mbgl/style/conversion/json.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/layers/symbol_layer.cpp b/src/mbgl/style/layers/symbol_layer.cpp
index 48af6b13aa..4ea138a7f5 100644
--- a/src/mbgl/style/layers/symbol_layer.cpp
+++ b/src/mbgl/style/layers/symbol_layer.cpp
@@ -3,12 +3,12 @@
#include <mbgl/style/layers/symbol_layer.hpp>
#include <mbgl/style/layers/symbol_layer_impl.hpp>
#include <mbgl/style/layer_observer.hpp>
-#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/color_ramp_property_value.hpp>
#include <mbgl/style/conversion/constant.hpp>
#include <mbgl/style/conversion/property_value.hpp>
#include <mbgl/style/conversion/transition_options.hpp>
#include <mbgl/style/conversion/json.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/fnv_hash.hpp>
namespace mbgl {
diff --git a/src/mbgl/style/parser.cpp b/src/mbgl/style/parser.cpp
index 0a90919f0b..114a666f08 100644
--- a/src/mbgl/style/parser.cpp
+++ b/src/mbgl/style/parser.cpp
@@ -1,12 +1,12 @@
#include <mbgl/style/parser.hpp>
#include <mbgl/style/layer_impl.hpp>
#include <mbgl/style/rapidjson_conversion.hpp>
-#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/coordinate.hpp>
#include <mbgl/style/conversion/source.hpp>
#include <mbgl/style/conversion/layer.hpp>
#include <mbgl/style/conversion/light.hpp>
#include <mbgl/style/conversion/transition_options.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mbgl/util/logging.hpp>
#include <mbgl/util/string.hpp>
diff --git a/src/mbgl/style/rapidjson_conversion.hpp b/src/mbgl/style/rapidjson_conversion.hpp
index 79bd9c928b..be335101e9 100644
--- a/src/mbgl/style/rapidjson_conversion.hpp
+++ b/src/mbgl/style/rapidjson_conversion.hpp
@@ -1,7 +1,7 @@
#pragma once
#include <mbgl/util/rapidjson.hpp>
-#include <mbgl/style/conversion.hpp>
+#include <mbgl/style/conversion_impl.hpp>
#include <mapbox/geojson.hpp>
#include <mapbox/geojson/rapidjson.hpp>