summaryrefslogtreecommitdiff
path: root/include/mbgl/style/conversion/property_value.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/mbgl/style/conversion/property_value.hpp')
-rw-r--r--include/mbgl/style/conversion/property_value.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/mbgl/style/conversion/property_value.hpp b/include/mbgl/style/conversion/property_value.hpp
index f6f36db983..9d619f7a02 100644
--- a/include/mbgl/style/conversion/property_value.hpp
+++ b/include/mbgl/style/conversion/property_value.hpp
@@ -28,6 +28,17 @@ struct Converter<PropertyValue<T>> {
? PropertyValue<T>(PropertyExpression<T>(convertTokenStringToExpression(t)))
: PropertyValue<T>(t);
}
+
+ PropertyValue<T> maybeConvertTokens(const expression::Formatted& t) const {
+ // This only works with a single-section `Formatted` created automatically
+ // by parsing a plain-text `text-field` property.
+ // Token conversion happens later than the initial string->Formatted conversion
+ // General purpose `format` expressions with embedded tokens are not supported
+ const std::string& firstUnformattedSection = t.sections[0].text;
+ return hasTokens(firstUnformattedSection)
+ ? PropertyValue<T>(PropertyExpression<T>(convertTokenStringToFormatExpression(firstUnformattedSection)))
+ : PropertyValue<T>(t);
+ }
};
} // namespace conversion