summaryrefslogtreecommitdiff
path: root/platform/darwin/src
diff options
context:
space:
mode:
authorAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-05-10 11:16:44 -0700
committerAsheem Mamoowala <asheem.mamoowala@mapbox.com>2017-06-01 15:38:01 -0700
commitc0c1028dcf57379db68a87d8d0a1780d9d901fe5 (patch)
tree0f3ee78d092dd8f010f6fe26554480a35b9b35f0 /platform/darwin/src
parent7a010df9560e8807b9be938bb5ff7360e8e730a6 (diff)
downloadqtlocation-mapboxgl-c0c1028dcf57379db68a87d8d0a1780d9d901fe5.tar.gz
[core] Add toDouble Conversion method for correctly parsing Lat Lng coordinates
Diffstat (limited to 'platform/darwin/src')
-rw-r--r--platform/darwin/src/MGLConversion.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/platform/darwin/src/MGLConversion.h b/platform/darwin/src/MGLConversion.h
index d51ebd775c..d6363b28eb 100644
--- a/platform/darwin/src/MGLConversion.h
+++ b/platform/darwin/src/MGLConversion.h
@@ -104,6 +104,14 @@ inline optional<float> toNumber(const id value) {
}
}
+inline optional<double> toDouble(const id value) {
+ if (_isNumber(value)) {
+ return ((NSNumber *)value).doubleValue;
+ } else {
+ return {};
+ }
+}
+
inline optional<std::string> toString(const id value) {
if (_isString(value)) {
return std::string(static_cast<const char *>([value UTF8String]));