From 603c02ccc21543473074787aaad7c89d282dddc9 Mon Sep 17 00:00:00 2001 From: Alexander Shalamov Date: Thu, 20 Jun 2019 08:39:31 +0300 Subject: [darwin] Generate plural version of property name, yet, keep singular version of an enum --- platform/darwin/src/MGLStyleLayer.h.ejs | 26 +++++++++---------- platform/darwin/src/MGLStyleLayer.mm.ejs | 16 ++++++------ platform/darwin/src/MGLSymbolStyleLayer.h | 40 +++++++++++++++--------------- platform/darwin/src/MGLSymbolStyleLayer.mm | 18 +++++++------- 4 files changed, 50 insertions(+), 50 deletions(-) (limited to 'platform/darwin/src') diff --git a/platform/darwin/src/MGLStyleLayer.h.ejs b/platform/darwin/src/MGLStyleLayer.h.ejs index 4bbb9e9f0d..91ba813b17 100644 --- a/platform/darwin/src/MGLStyleLayer.h.ejs +++ b/platform/darwin/src/MGLStyleLayer.h.ejs @@ -21,17 +21,17 @@ NS_ASSUME_NONNULL_BEGIN <% for (const property of layoutProperties) { -%> <% if (definesEnum(property, layoutProperties)) { -%> /** -<%- propertyDoc(property.name, property, type, 'enum').wrap(80, 1) %> +<%- propertyDoc(enumName(property), property, type, 'enum').wrap(80, 1) %> Values of this type are used in the `MGL<%- camelize(type) %>StyleLayer.<%- camelizeWithLeadingLowercase(property.name) %>` property. */ -typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) { +typedef NS_ENUM(NSUInteger, MGL<%- camelize(enumName(property)) %>) { <% for (const value in property.values) { -%> /** -<%- propertyDoc(property.name, property.values[value], type, 'enum').wrap(80, 4+1) %> +<%- propertyDoc(enumName(property), property.values[value], type, 'enum').wrap(80, 4+1) %> */ - MGL<%- camelize(property.name) %><%- camelize(value) %>, + MGL<%- camelize(enumName(property)) %><%- camelize(value) %>, <% } -%> }; @@ -40,17 +40,17 @@ typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) { <% for (const property of paintProperties) { -%> <% if (definesEnum(property, paintProperties)) { -%> /** -<%- propertyDoc(property.name, property, type, 'enum').wrap(80, 1) %> +<%- propertyDoc(enumName(property), property, type, 'enum').wrap(80, 1) %> - Values of this type are used in the `MGL<%- camelize(type) %>StyleLayer.<%- camelizeWithLeadingLowercase(property.name) %>` + Values of this type are used in the `MGL<%- camelize(type) %>StyleLayer.<%- camelizeWithLeadingLowercase(enumName(property)) %>` property. */ -typedef NS_ENUM(NSUInteger, MGL<%- camelize(property.name) %>) { +typedef NS_ENUM(NSUInteger, MGL<%- camelize(enumName(property)) %>) { <% for (const value in property.values) { -%> /** -<%- propertyDoc(property.name, property.values[value], type, 'enum').wrap(80, 4+1) %> +<%- propertyDoc(enumName(property), property.values[value], type, 'enum').wrap(80, 4+1) %> */ - MGL<%- camelize(property.name) %><%- camelize(value) %>, + MGL<%- camelize(enumName(property)) %><%- camelize(value) %>, <% } -%> }; @@ -180,17 +180,17 @@ which it is added. <% for (let property of enumProperties) { -%> /** - Creates a new value object containing the given `MGL<%- camelize(property.name) %>` enumeration. + Creates a new value object containing the given `MGL<%- camelize(enumName(property)) %>` enumeration. @param <%- objCName(property) %> The value for the new object. @return A new value object that contains the enumeration value. */ -+ (instancetype)valueWithMGL<%- camelize(property.name) %>:(MGL<%- camelize(property.name) %>)<%- objCName(property) %>; ++ (instancetype)valueWithMGL<%- camelize(enumName(property)) %>:(MGL<%- camelize(enumName(property)) %>)<%- objCName(property) %>; /** - The `MGL<%- camelize(property.name) %>` enumeration representation of the value. + The `MGL<%- camelize(enumName(property)) %>` enumeration representation of the value. */ -@property (readonly) MGL<%- camelize(property.name) %> MGL<%- camelize(property.name) %>Value; +@property (readonly) MGL<%- camelize(enumName(property)) %> MGL<%- camelize(enumName(property)) %>Value; <% } -%> @end diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs index e8c8d8cfd9..5d9f546cd7 100644 --- a/platform/darwin/src/MGLStyleLayer.mm.ejs +++ b/platform/darwin/src/MGLStyleLayer.mm.ejs @@ -26,9 +26,9 @@ namespace mbgl { <% if (layoutProperties.length) { -%> <% for (const property of layoutProperties) { -%> <% if (definesEnum(property, layoutProperties)) { -%> - MBGL_DEFINE_ENUM(MGL<%- camelize(property.name) %>, { + MBGL_DEFINE_ENUM(MGL<%- camelize(enumName(property)) %>, { <% for (const value in property.values) { -%> - { MGL<%- camelize(property.name) %><%- camelize(value) %>, "<%-value%>" }, + { MGL<%- camelize(enumName(property)) %><%- camelize(value) %>, "<%-value%>" }, <% } -%> }); @@ -38,9 +38,9 @@ namespace mbgl { <% if (paintProperties.length) { -%> <% for (const property of paintProperties) { -%> <% if (definesEnum(property, paintProperties)) { -%> - MBGL_DEFINE_ENUM(MGL<%- camelize(property.name) %>, { + MBGL_DEFINE_ENUM(MGL<%- camelize(enumName(property)) %>, { <% for (const value in property.values) { -%> - { MGL<%- camelize(property.name) %><%- camelize(value) %>, "<%-value%>" }, + { MGL<%- camelize(enumName(property)) %><%- camelize(value) %>, "<%-value%>" }, <% } -%> }); @@ -239,12 +239,12 @@ namespace mbgl { @implementation NSValue (MGL<%- camelize(type) %>StyleLayerAdditions) <% for (let property of enumProperties) { -%> -+ (NSValue *)valueWithMGL<%- camelize(property.name) %>:(MGL<%- camelize(property.name) %>)<%- objCName(property) %> { - return [NSValue value:&<%- objCName(property) %> withObjCType:@encode(MGL<%- camelize(property.name) %>)]; ++ (NSValue *)valueWithMGL<%- camelize(enumName(property)) %>:(MGL<%- camelize(enumName(property)) %>)<%- objCName(property) %> { + return [NSValue value:&<%- objCName(property) %> withObjCType:@encode(MGL<%- camelize(enumName(property)) %>)]; } -- (MGL<%- camelize(property.name) %>)MGL<%- camelize(property.name) %>Value { - MGL<%- camelize(property.name) %> <%- objCName(property) %>; +- (MGL<%- camelize(enumName(property)) %>)MGL<%- camelize(enumName(property)) %>Value { + MGL<%- camelize(enumName(property)) %> <%- objCName(property) %>; [self getValue:&<%- objCName(property) %>]; return <%- objCName(property) %>; } diff --git a/platform/darwin/src/MGLSymbolStyleLayer.h b/platform/darwin/src/MGLSymbolStyleLayer.h index cbbd4577d0..93c9e38477 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.h +++ b/platform/darwin/src/MGLSymbolStyleLayer.h @@ -317,27 +317,27 @@ typedef NS_ENUM(NSUInteger, MGLTextTransform) { }; /** - The property allows to control an orientation of a symbol. Note, that the - property values act as a hint, so that Symbols whose language doesn't support - provided orientation, will be laid out in their natural orientation. Example: - English point symbol will be rendered horizontally even if `"textWritingMode": - ["vertical"]` is set. The order of elements in an array define priority order - for the placement of an orientation variant. + The property allows to control an orientation of a symbol. Note that the + property values act as a hint, so that a symbol whose language doesn’t support + the provided orientation will be laid out in its natural orientation. Example: + English point symbol will be rendered horizontally even if array value contains + single 'vertical' enum value. The order of elements in an array define priority + order for the placement of an orientation variant. Values of this type are used in the `MGLSymbolStyleLayer.textWritingModes` property. */ -typedef NS_ENUM(NSUInteger, MGLTextWritingModes) { +typedef NS_ENUM(NSUInteger, MGLTextWritingMode) { /** If a text's language supports horizontal writing mode, symbols with point placement would be laid out horizontally. */ - MGLTextWritingModesHorizontal, + MGLTextWritingModeHorizontal, /** If a text's language supports vertical writing mode, symbols with point placement would be laid out vertically. */ - MGLTextWritingModesVertical, + MGLTextWritingModeVertical, }; /** @@ -1671,12 +1671,12 @@ MGL_EXPORT @property (nonatomic, null_resettable) NSExpression *textVariableAnchor; /** - The property allows to control an orientation of a symbol. Note, that the - property values act as a hint, so that Symbols whose language doesn't support - provided orientation, will be laid out in their natural orientation. Example: - English point symbol will be rendered horizontally even if `"textWritingMode": - ["vertical"]` is set. The order of elements in an array define priority order - for the placement of an orientation variant. + The property allows to control an orientation of a symbol. Note that the + property values act as a hint, so that a symbol whose language doesn’t support + the provided orientation will be laid out in its natural orientation. Example: + English point symbol will be rendered horizontally even if array value contains + single 'vertical' enum value. The order of elements in an array define priority + order for the placement of an orientation variant. This property is only applied to the style if `text` is non-`nil`, and `symbolPlacement` is set to an expression that evaluates to or @@ -1688,7 +1688,7 @@ MGL_EXPORT You can set this property to an expression containing any of the following: - * Constant `MGLTextWritingModes` array values + * Constant `MGLTextWritingMode` array values * Constant array, whose each element is any of the following constant string values: * `horizontal`: If a text's language supports horizontal writing mode, @@ -2446,17 +2446,17 @@ MGL_EXPORT @property (readonly) MGLTextTransform MGLTextTransformValue; /** - Creates a new value object containing the given `MGLTextWritingModes` enumeration. + Creates a new value object containing the given `MGLTextWritingMode` enumeration. @param textWritingModes The value for the new object. @return A new value object that contains the enumeration value. */ -+ (instancetype)valueWithMGLTextWritingModes:(MGLTextWritingModes)textWritingModes; ++ (instancetype)valueWithMGLTextWritingMode:(MGLTextWritingMode)textWritingModes; /** - The `MGLTextWritingModes` enumeration representation of the value. + The `MGLTextWritingMode` enumeration representation of the value. */ -@property (readonly) MGLTextWritingModes MGLTextWritingModesValue; +@property (readonly) MGLTextWritingMode MGLTextWritingModeValue; /** Creates a new value object containing the given `MGLIconTranslationAnchor` enumeration. diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm index e60da45a38..e89b9c3e88 100644 --- a/platform/darwin/src/MGLSymbolStyleLayer.mm +++ b/platform/darwin/src/MGLSymbolStyleLayer.mm @@ -96,9 +96,9 @@ namespace mbgl { { MGLTextTransformLowercase, "lowercase" }, }); - MBGL_DEFINE_ENUM(MGLTextWritingModes, { - { MGLTextWritingModesHorizontal, "horizontal" }, - { MGLTextWritingModesVertical, "vertical" }, + MBGL_DEFINE_ENUM(MGLTextWritingMode, { + { MGLTextWritingModeHorizontal, "horizontal" }, + { MGLTextWritingModeVertical, "vertical" }, }); MBGL_DEFINE_ENUM(MGLIconTranslationAnchor, { @@ -1032,7 +1032,7 @@ namespace mbgl { MGLAssertStyleLayerIsValid(); MGLLogDebug(@"Setting textWritingModes: %@", textWritingModes); - auto mbglValue = MGLStyleValueTransformer, NSArray *, mbgl::style::TextWritingModeType, MGLTextWritingModes>().toPropertyValue>>(textWritingModes, false); + auto mbglValue = MGLStyleValueTransformer, NSArray *, mbgl::style::TextWritingModeType, MGLTextWritingMode>().toPropertyValue>>(textWritingModes, false); self.rawLayer->setTextWritingMode(mbglValue); } @@ -1043,7 +1043,7 @@ namespace mbgl { if (propertyValue.isUndefined()) { propertyValue = self.rawLayer->getDefaultTextWritingMode(); } - return MGLStyleValueTransformer, NSArray *, mbgl::style::TextWritingModeType, MGLTextWritingModes>().toExpression(propertyValue); + return MGLStyleValueTransformer, NSArray *, mbgl::style::TextWritingModeType, MGLTextWritingMode>().toExpression(propertyValue); } - (void)setTextWritingMode:(NSExpression *)textWritingMode { @@ -1629,12 +1629,12 @@ namespace mbgl { return textTransform; } -+ (NSValue *)valueWithMGLTextWritingModes:(MGLTextWritingModes)textWritingModes { - return [NSValue value:&textWritingModes withObjCType:@encode(MGLTextWritingModes)]; ++ (NSValue *)valueWithMGLTextWritingMode:(MGLTextWritingMode)textWritingModes { + return [NSValue value:&textWritingModes withObjCType:@encode(MGLTextWritingMode)]; } -- (MGLTextWritingModes)MGLTextWritingModesValue { - MGLTextWritingModes textWritingModes; +- (MGLTextWritingMode)MGLTextWritingModeValue { + MGLTextWritingMode textWritingModes; [self getValue:&textWritingModes]; return textWritingModes; } -- cgit v1.2.1