diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-03-26 15:02:13 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-03-29 16:18:41 +0200 |
commit | 1eaae50ffe0fa6bc0be96d705d7a5bd18b4fdf4f (patch) | |
tree | cf80189f91d60abac96497982a0f90e07e166307 /platform/darwin/src/MGLStyleValue_Private.h | |
parent | 94d8cb4f7f23d829cee48cd9430b3c47c298a7c0 (diff) | |
download | qtlocation-mapboxgl-1eaae50ffe0fa6bc0be96d705d7a5bd18b4fdf4f.tar.gz |
[darwin] Support for variable text placement API
Diffstat (limited to 'platform/darwin/src/MGLStyleValue_Private.h')
-rw-r--r-- | platform/darwin/src/MGLStyleValue_Private.h | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/platform/darwin/src/MGLStyleValue_Private.h b/platform/darwin/src/MGLStyleValue_Private.h index 84d7ccccec..fee34b4b71 100644 --- a/platform/darwin/src/MGLStyleValue_Private.h +++ b/platform/darwin/src/MGLStyleValue_Private.h @@ -307,10 +307,8 @@ private: // Private utilities for converting from mbgl to mgl values // Enumerations template <typename MBGLEnum = MBGLType, typename MGLEnum = ObjCEnum> - static NSValue *toMGLRawStyleValue(const MBGLEnum &value) { - auto str = mbgl::Enum<MBGLEnum>::toString(value); - MGLEnum mglType = *mbgl::Enum<MGLEnum>::toEnum(str); - return [NSValue value:&mglType withObjCType:@encode(MGLEnum)]; + static NSString *toMGLRawStyleValue(const MBGLEnum &value) { + return @(mbgl::Enum<MBGLEnum>::toString(value)); } /// Converts all types of mbgl property values into an equivalent NSExpression. @@ -320,15 +318,6 @@ private: // Private utilities for converting from mbgl to mgl values return nil; } - /** - As hack to allow converting enum => string values, we accept a second, dummy parameter in - the toRawStyleSpecValue() methods for converting 'atomic' (non-style-function) values. - This allows us to use `std::enable_if` to test (at compile time) whether or not MBGLType is an Enum. - */ - template <typename MBGLEnum = MBGLType, - class = typename std::enable_if<!std::is_enum<MBGLEnum>::value>::type, - typename MGLEnum = ObjCEnum, - class = typename std::enable_if<!std::is_enum<MGLEnum>::value>::type> NSExpression *operator()(const MBGLType &value) const { id constantValue = toMGLRawStyleValue(value); if ([constantValue isKindOfClass:[NSArray class]]) { @@ -337,15 +326,6 @@ private: // Private utilities for converting from mbgl to mgl values return [NSExpression expressionForConstantValue:constantValue]; } - template <typename MBGLEnum = MBGLType, - class = typename std::enable_if<std::is_enum<MBGLEnum>::value>::type, - typename MGLEnum = ObjCEnum, - class = typename std::enable_if<std::is_enum<MGLEnum>::value>::type> - NSExpression *operator()(const MBGLEnum &value) const { - NSString *constantValue = @(mbgl::Enum<MBGLEnum>::toString(value)); - return [NSExpression expressionForConstantValue:constantValue]; - } - NSExpression *operator()(const mbgl::style::PropertyExpression<MBGLType> &mbglValue) const { return [NSExpression expressionWithMGLJSONObject:MGLJSONObjectFromMBGLExpression(mbglValue.getExpression())]; } |