summaryrefslogtreecommitdiff
path: root/include/mbgl/style/conversion/property_setter.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/style/conversion/property_setter.hpp')
-rw-r--r--include/mbgl/style/conversion/property_setter.hpp34
1 files changed, 7 insertions, 27 deletions
diff --git a/include/mbgl/style/conversion/property_setter.hpp b/include/mbgl/style/conversion/property_setter.hpp
index 1f537f3c4d..759c4512cc 100644
--- a/include/mbgl/style/conversion/property_setter.hpp
+++ b/include/mbgl/style/conversion/property_setter.hpp
@@ -14,14 +14,11 @@ namespace style {
namespace conversion {
template <class V>
-using LayoutPropertySetter = optional<Error> (*) (Layer&, const V&);
-
-template <class V>
-using PaintPropertySetter = optional<Error> (*) (Layer&, const V&, const optional<std::string>&);
+using PropertySetter = optional<Error> (*) (Layer&, const V&);
template <class V, class L, class PropertyValue, void (L::*setter)(PropertyValue)>
-optional<Error> setLayoutProperty(Layer& layer, const V& value) {
- L* typedLayer = layer.as<L>();
+optional<Error> setProperty(Layer& layer, const V& value) {
+ auto* typedLayer = layer.as<L>();
if (!typedLayer) {
return Error { "layer doesn't support this property" };
}
@@ -36,26 +33,9 @@ optional<Error> setLayoutProperty(Layer& layer, const V& value) {
return {};
}
-template <class V, class L, class PropertyValue, void (L::*setter)(PropertyValue, const optional<std::string>&)>
-optional<Error> setPaintProperty(Layer& layer, const V& value, const optional<std::string>& klass) {
- L* typedLayer = layer.as<L>();
- if (!typedLayer) {
- return Error { "layer doesn't support this property" };
- }
-
- Error error;
- optional<PropertyValue> typedValue = convert<PropertyValue>(value, error);
- if (!typedValue) {
- return error;
- }
-
- (typedLayer->*setter)(*typedValue, klass);
- return {};
-}
-
-template <class V, class L, void (L::*setter)(const TransitionOptions&, const optional<std::string>&)>
-optional<Error> setTransition(Layer& layer, const V& value, const optional<std::string>& klass) {
- L* typedLayer = layer.as<L>();
+template <class V, class L, void (L::*setter)(const TransitionOptions&)>
+optional<Error> setTransition(Layer& layer, const V& value) {
+ auto* typedLayer = layer.as<L>();
if (!typedLayer) {
return Error { "layer doesn't support this property" };
}
@@ -66,7 +46,7 @@ optional<Error> setTransition(Layer& layer, const V& value, const optional<std::
return error;
}
- (typedLayer->*setter)(*transition, klass);
+ (typedLayer->*setter)(*transition);
return {};
}