diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2017-01-03 01:42:15 -0800 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2017-01-07 14:37:53 -0800 |
commit | d5d6bcee0f2f11cfccb3cc8ee7bc90c4f0ac74e7 (patch) | |
tree | 8da0ad24e34577dc6a4b44312a7ea1c9045c4864 /platform/darwin/src/MGLStyleLayer.mm.ejs | |
parent | 80df3090ecc92a4c04890222928f352aaf467b27 (diff) | |
download | qtlocation-mapboxgl-d5d6bcee0f2f11cfccb3cc8ee7bc90c4f0ac74e7.tar.gz |
[ios, macos] Keep style attribute NSValue categories near enum declarations
Eliminated the separate NSValue+MGLStyleLayerAddition files, moving the categories into their respective style layer headers to be closer to the enumeration declarations.
Diffstat (limited to 'platform/darwin/src/MGLStyleLayer.mm.ejs')
-rw-r--r-- | platform/darwin/src/MGLStyleLayer.mm.ejs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs index 30bec0c79e..c7e379eaa7 100644 --- a/platform/darwin/src/MGLStyleLayer.mm.ejs +++ b/platform/darwin/src/MGLStyleLayer.mm.ejs @@ -2,7 +2,7 @@ const type = locals.type; const layoutProperties = locals.layoutProperties; const paintProperties = locals.paintProperties; - const containsEnumerationProperties = locals.containsEnumerationProperties; + const enumProperties = locals.enumProperties; -%> // This file is generated. // Edit platform/darwin/scripts/generate-style-code.js, then run `make style-code-darwin`. @@ -15,7 +15,7 @@ #import "MGL<%- camelize(type) %>StyleLayer.h" #include <mbgl/style/layers/<%- type %>_layer.hpp> -<% if (containsEnumerationProperties) { -%> +<% if (enumProperties) { -%> namespace mbgl { <% if (layoutProperties.length) { -%> @@ -243,3 +243,21 @@ namespace mbgl { <% } -%> @end +<% if (enumProperties) { -%> + +@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) %>)]; +} + +- (MGL<%- camelize(property.name) %>)MGL<%- camelize(property.name) %>Value { + MGL<%- camelize(property.name) %> <%- objCName(property) %>; + [self getValue:&<%- objCName(property) %>]; + return <%- objCName(property) %>; +} + +<% } -%> +@end +<% } -%>
\ No newline at end of file |