diff options
author | Chris Loer <chris.loer@gmail.com> | 2018-09-19 15:20:03 -0700 |
---|---|---|
committer | Chris Loer <chris.loer@mapbox.com> | 2018-10-15 13:15:46 -0700 |
commit | d0cd49f516d053620147e9f047252bd88374ac5d (patch) | |
tree | 55681fefb455cc7e3d6305c86d9a1d88e9dced84 /platform/darwin/scripts/generate-style-code.js | |
parent | ce76bde13d0f4381ee861f81daf636defaff0bc5 (diff) | |
download | qtlocation-mapboxgl-d0cd49f516d053620147e9f047252bd88374ac5d.tar.gz |
[ios, macos] Minimal darwin wrappers of 'format' expression
Add support for `MGL_FUNCTION('format', <text>, <options dictionary>)`
Diffstat (limited to 'platform/darwin/scripts/generate-style-code.js')
-rwxr-xr-x | platform/darwin/scripts/generate-style-code.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/platform/darwin/scripts/generate-style-code.js b/platform/darwin/scripts/generate-style-code.js index bc676e9cba..c4c28c7946 100755 --- a/platform/darwin/scripts/generate-style-code.js +++ b/platform/darwin/scripts/generate-style-code.js @@ -103,6 +103,11 @@ global.objCTestValue = function (property, layerType, arraysAsStructs, indent) { case 'number': return '@"1"'; case 'formatted': + // Special 'string' case to handle constant expression text-field that automatically + // converts Formatted back to string. + return layerType === 'string' ? + `@"'${_.startCase(propertyName)}'"` : + `@"MGL_FUNCTION('format', '${_.startCase(propertyName)}', %@)", @{}`; case 'string': return `@"'${_.startCase(propertyName)}'"`; case 'enum': @@ -559,6 +564,7 @@ global.valueTransformerArguments = function (property) { case 'number': return ['float', objCType]; case 'formatted': + return ['mbgl::style::expression::Formatted', objCType]; case 'string': return ['std::string', objCType]; case 'enum': @@ -593,6 +599,7 @@ global.mbglType = function(property) { case 'number': return 'float'; case 'formatted': + return 'mbgl::style::expression::Formatted'; case 'string': return 'std::string'; case 'enum': { |