| // Copyright 2018 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #import "JsonConversions.h" |
| |
| @implementation FLTGoogleMapJsonConversions |
| |
| + (bool)toBool:(NSNumber*)data { |
| return data.boolValue; |
| } |
| |
| + (int)toInt:(NSNumber*)data { |
| return data.intValue; |
| } |
| |
| + (double)toDouble:(NSNumber*)data { |
| return data.doubleValue; |
| } |
| |
| + (float)toFloat:(NSNumber*)data { |
| return data.floatValue; |
| } |
| |
| + (CLLocationCoordinate2D)toLocation:(NSArray*)data { |
| return CLLocationCoordinate2DMake([FLTGoogleMapJsonConversions toDouble:data[0]], |
| [FLTGoogleMapJsonConversions toDouble:data[1]]); |
| } |
| |
| + (CGPoint)toPoint:(NSArray*)data { |
| return CGPointMake([FLTGoogleMapJsonConversions toDouble:data[0]], |
| [FLTGoogleMapJsonConversions toDouble:data[1]]); |
| } |
| |
| @end |