Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] map image type to string until we have a dedicated implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaefer committed Oct 14, 2019
1 parent e4e2a78 commit 5093a01
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions platform/android/scripts/generate-style-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ global.propertyType = function propertyType(property) {
case 'formatted':
return 'Formatted';
case 'string':
case 'image': // TODO: replace once we implement image expressions
return 'String';
case 'enum':
return 'String';
Expand All @@ -93,6 +94,7 @@ global.propertyJavaType = function propertyType(property) {
case 'formatted':
return 'Formatted';
case 'string':
case 'image': // TODO: replace once we implement image expressions
return 'String';
case 'enum':
return 'String';
Expand Down Expand Up @@ -141,6 +143,7 @@ global.propertyNativeType = function (property) {
return 'float';
case 'formatted':
case 'string':
case 'image': // TODO: replace once we implement image expressions
return 'std::string';
case 'enum':
if(property['light-property']){
Expand Down Expand Up @@ -177,6 +180,7 @@ global.defaultExpressionJava = function(property) {
case 'formatted':
return 'format';
case 'string':
case 'image': // TODO: replace once we implement image expressions
return "string";
case 'enum':
return "string";
Expand All @@ -203,6 +207,7 @@ global.defaultValueJava = function(property) {
case 'formatted':
return 'new Formatted(new FormattedSection("default"))'
case 'string':
case 'image': // TODO: replace once we implement image expressions
return '"' + property['default'] + '"';
case 'enum':
return snakeCaseUpper(property.name) + "_" + snakeCaseUpper(Object.keys(property.values)[0]);
Expand Down Expand Up @@ -335,6 +340,7 @@ global.evaluatedType = function (property) {
return 'float';
case 'formatted':
case 'string':
case 'image': // TODO: replace once we implement image expressions
return 'std::string';
case 'enum':
return (isLightProperty(property) ? 'Light' : '') + `${camelize(property.name)}Type`;
Expand Down
9 changes: 9 additions & 0 deletions platform/darwin/scripts/generate-style-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ global.objCTestValue = function (property, layerType, arraysAsStructs, indent) {
`@"'${_.startCase(propertyName)}'"` :
`@"${_.startCase(propertyName)}"`;
case 'string':
case 'image': // TODO: replace once we implement image expressions
return `@"'${_.startCase(propertyName)}'"`;
case 'enum':
return `@"'${_.last(_.keys(property.values))}'"`;
Expand Down Expand Up @@ -208,6 +209,7 @@ global.mbglTestValue = function (property, layerType) {
return '1.0';
case 'formatted':
case 'string':
case 'image': // TODO: replace once we implement image expressions
return `"${_.startCase(propertyName)}"`;
case 'enum': {
let type = camelize(originalPropertyName(property));
Expand Down Expand Up @@ -294,6 +296,7 @@ global.testHelperMessage = function (property, layerType, isFunction) {
return 'testNumber' + fnSuffix;
case 'formatted':
case 'string':
case 'image': // TODO: replace once we implement image expressions
return 'testString' + fnSuffix;
case 'enum':
let objCType = global.objCType(layerType, property.name);
Expand Down Expand Up @@ -474,6 +477,7 @@ global.describeType = function (property) {
return 'numeric';
case 'formatted':
case 'string':
case 'image': // TODO: replace once we implement image expressions
return 'string';
case 'enum':
return '`MGL' + camelize(property.name) + '`';
Expand Down Expand Up @@ -522,6 +526,7 @@ global.describeValue = function (value, property, layerType) {
return 'the float ' + '`' + formatNumber(value) + '`';
case 'formatted':
case 'string':
case 'image': // TODO: replace once we implement image expressions
if (value === '') {
return 'the empty string';
}
Expand Down Expand Up @@ -608,6 +613,7 @@ global.propertyType = function (property) {
return 'NSNumber *';
case 'formatted':
case 'string':
case 'image': // TODO: replace once we implement image expressions
return 'NSString *';
case 'enum':
return 'NSValue *';
Expand Down Expand Up @@ -640,6 +646,7 @@ global.isInterpolatable = function (property) {
return type !== 'boolean' &&
type !== 'enum' &&
type !== 'string' &&
type !== 'image' &&
type !== 'formatted';
};

Expand All @@ -653,6 +660,7 @@ global.valueTransformerArguments = function (property) {
case 'formatted':
return ['mbgl::style::expression::Formatted', objCType];
case 'string':
case 'image': // TODO: replace once we implement image expressions
return ['std::string', objCType];
case 'enum':
return [mbglType(property), 'NSValue *', mbglType(property), `MGL${camelize(property.name)}`];
Expand Down Expand Up @@ -692,6 +700,7 @@ global.mbglType = function(property) {
case 'formatted':
return 'mbgl::style::expression::Formatted';
case 'string':
case 'image': // TODO: replace once we implement image expressions
return 'std::string';
case 'enum': {
let type = camelize(originalPropertyName(property));
Expand Down
3 changes: 3 additions & 0 deletions scripts/generate-style-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ global.expressionType = function (property) {
case 'enum':
return 'NumberType';
case 'string':
case 'image': // TODO: replace once we implement image expressions
return 'StringType';
case 'color':
return `ColorType`;
Expand Down Expand Up @@ -68,6 +69,7 @@ global.evaluatedType = function (property) {
case 'formatted':
return 'expression::Formatted';
case 'string':
case 'image': // TODO: replace once we implement image expressions
return 'std::string';
case 'enum':
return (isLightProperty(property) ? 'Light' : '') + `${camelize(property.name)}Type`;
Expand Down Expand Up @@ -166,6 +168,7 @@ global.defaultValue = function (property) {
}
case 'formatted':
case 'string':
case 'image': // TODO: replace once we implement image expressions
return JSON.stringify(property.default || "");
case 'enum':
if (property.default === undefined) {
Expand Down

0 comments on commit 5093a01

Please sign in to comment.