You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2013/01/11 00:37:28 UTC
[3/3] ios commit: [CB-1946] iOS: Switch JSON serialization to
NSJSONSerialization
Updated Branches:
refs/heads/master b4a2e4ae0 -> 192122feb
[CB-1946] iOS: Switch JSON serialization to NSJSONSerialization
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/192122fe
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/192122fe
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/192122fe
Branch: refs/heads/master
Commit: 192122feb427eab2f507d7c47b3ef5db47dce802
Parents: b4a2e4a
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu Jan 10 15:37:18 2013 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Jan 10 15:37:18 2013 -0800
----------------------------------------------------------------------
CordovaLib/Classes/CDV.h | 2 +-
CordovaLib/Classes/CDVCapture.m | 4 +-
CordovaLib/Classes/CDVCommandDelegateImpl.m | 4 +-
CordovaLib/Classes/CDVCommandQueue.m | 4 +-
CordovaLib/Classes/CDVDevice.m | 2 +-
CordovaLib/Classes/CDVFile.m | 4 +-
CordovaLib/Classes/CDVInvokedUrlCommand.m | 2 +-
CordovaLib/Classes/CDVJSON.h | 30 +
CordovaLib/Classes/CDVJSON.m | 77 +
CordovaLib/Classes/CDVPluginResult.m | 24 +-
CordovaLib/Classes/CDVSound.m | 3 +-
CordovaLib/Classes/CDVViewController.h | 2 +-
CordovaLib/Classes/JSON/JSONKit.h | 251 --
CordovaLib/Classes/JSON/JSONKit.m | 3061 ---------------
CordovaLib/CordovaLib.xcodeproj/project.pbxproj | 25 +-
.../CDVPluginResultJSONSerializationTests.m | 24 +-
16 files changed, 160 insertions(+), 3359 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/192122fe/CordovaLib/Classes/CDV.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDV.h b/CordovaLib/Classes/CDV.h
index 6474cfe..5a0ae6a 100644
--- a/CordovaLib/Classes/CDV.h
+++ b/CordovaLib/Classes/CDV.h
@@ -54,4 +54,4 @@
#import "NSMutableArray+QueueAdditions.h"
#import "UIDevice+Extensions.h"
-#import "JSONKit.h"
+#import "CDVJSON.h"
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/192122fe/CordovaLib/Classes/CDVCapture.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCapture.m b/CordovaLib/Classes/CDVCapture.m
index 6d52042..95c3f17 100644
--- a/CordovaLib/Classes/CDVCapture.m
+++ b/CordovaLib/Classes/CDVCapture.m
@@ -18,7 +18,7 @@
*/
#import "CDVCapture.h"
-#import "JSONKit.h"
+#import "CDVJSON.h"
#import "CDVAvailability.h"
#import "CDVViewController.h"
@@ -329,7 +329,7 @@
movieArray ? (NSObject*) movieArray:[NSNull null], @"video",
audioArray ? (NSObject*) audioArray:[NSNull null], @"audio",
nil];
- NSString* jsString = [NSString stringWithFormat:@"navigator.device.capture.setSupportedModes(%@);", [modes cdvjk_JSONString]];
+ NSString* jsString = [NSString stringWithFormat:@"navigator.device.capture.setSupportedModes(%@);", [modes JSONString]];
[self.commandDelegate evalJs:jsString];
}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/192122fe/CordovaLib/Classes/CDVCommandDelegateImpl.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandDelegateImpl.m b/CordovaLib/Classes/CDVCommandDelegateImpl.m
index 76413bd..b6a493b 100644
--- a/CordovaLib/Classes/CDVCommandDelegateImpl.m
+++ b/CordovaLib/Classes/CDVCommandDelegateImpl.m
@@ -18,7 +18,7 @@
*/
#import "CDVCommandDelegateImpl.h"
-
+#import "CDVJSON.h"
#import "CDVCommandQueue.h"
#import "CDVPluginResult.h"
#import "CDVViewController.h"
@@ -84,7 +84,7 @@
// Use an array to encode the message as JSON.
message = [NSArray arrayWithObject:message];
- NSString* encodedMessage = [message cdvjk_JSONString];
+ NSString* encodedMessage = [message JSONString];
// And then strip off the outer []s.
encodedMessage = [encodedMessage substringWithRange:NSMakeRange(1, [encodedMessage length] - 2)];
NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d)",
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/192122fe/CordovaLib/Classes/CDVCommandQueue.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVCommandQueue.m b/CordovaLib/Classes/CDVCommandQueue.m
index d88a730..a8a58b7 100644
--- a/CordovaLib/Classes/CDVCommandQueue.m
+++ b/CordovaLib/Classes/CDVCommandQueue.m
@@ -87,14 +87,14 @@
for (NSUInteger i = 0; i < [_queue count]; ++i) {
// Parse the returned JSON array.
- NSArray* commandBatch = [[_queue objectAtIndex:i] cdvjk_mutableObjectFromJSONString];
+ NSArray* commandBatch = [[_queue objectAtIndex:i] JSONObject];
// Iterate over and execute all of the commands.
for (NSArray* jsonEntry in commandBatch) {
CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry];
if (![self execute:command]) {
#ifdef DEBUG
- NSString* commandJson = [jsonEntry cdvjk_JSONString];
+ NSString* commandJson = [jsonEntry JSONString];
static NSUInteger maxLogLength = 1024;
NSString* commandString = ([commandJson length] > maxLogLength) ?
[NSString stringWithFormat:@"%@[...]", [commandJson substringToIndex:maxLogLength]] :
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/192122fe/CordovaLib/Classes/CDVDevice.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVDevice.m b/CordovaLib/Classes/CDVDevice.m
index 3fa4bb3..46195e8 100644
--- a/CordovaLib/Classes/CDVDevice.m
+++ b/CordovaLib/Classes/CDVDevice.m
@@ -58,7 +58,7 @@
NSDictionary* temp = [CDVViewController getBundlePlist:@"Settings"];
if ([temp respondsToSelector:@selector(JSONString)]) {
- NSString* js = [NSString stringWithFormat:@"window.Settings = %@;", [temp cdvjk_JSONString]];
+ NSString* js = [NSString stringWithFormat:@"window.Settings = %@;", [temp JSONString]];
[self.commandDelegate evalJs:js];
}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/192122fe/CordovaLib/Classes/CDVFile.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVFile.m b/CordovaLib/Classes/CDVFile.m
index bff91f9..977ae85 100644
--- a/CordovaLib/Classes/CDVFile.m
+++ b/CordovaLib/Classes/CDVFile.m
@@ -20,7 +20,7 @@
#import "CDVFile.h"
#import "NSArray+Comparisons.h"
#import "NSDictionary+Extensions.h"
-#import "JSONKit.h"
+#import "CDVJSON.h"
#import "NSData+Base64.h"
#import <MobileCoreServices/MobileCoreServices.h>
#import "CDVAvailability.h"
@@ -917,6 +917,7 @@ extern NSString * const NSURLIsExcludedFromBackupKey __attribute__((weak_import)
NSString* argPath = [command.arguments objectAtIndex:0];
NSInteger start = 0;
NSInteger end = -1;
+
if ([command.arguments count] >= 3) {
start = [[command.arguments objectAtIndex:2] integerValue];
}
@@ -972,6 +973,7 @@ extern NSString * const NSURLIsExcludedFromBackupKey __attribute__((weak_import)
NSString* argPath = [command.arguments objectAtIndex:0];
NSInteger start = 0;
NSInteger end = -1;
+
if ([command.arguments count] >= 2) {
start = [[command.arguments objectAtIndex:1] integerValue];
}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/192122fe/CordovaLib/Classes/CDVInvokedUrlCommand.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVInvokedUrlCommand.m b/CordovaLib/Classes/CDVInvokedUrlCommand.m
index 7a0bf84..17f3091 100644
--- a/CordovaLib/Classes/CDVInvokedUrlCommand.m
+++ b/CordovaLib/Classes/CDVInvokedUrlCommand.m
@@ -18,7 +18,7 @@
*/
#import "CDVInvokedUrlCommand.h"
-#import "JSONKit.h"
+#import "CDVJSON.h"
#import "NSData+Base64.h"
@implementation CDVInvokedUrlCommand
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/192122fe/CordovaLib/Classes/CDVJSON.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVJSON.h b/CordovaLib/Classes/CDVJSON.h
new file mode 100644
index 0000000..eaa895e
--- /dev/null
+++ b/CordovaLib/Classes/CDVJSON.h
@@ -0,0 +1,30 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+@interface NSArray (CDVJSONSerializing)
+- (NSString*)JSONString;
+@end
+
+@interface NSDictionary (CDVJSONSerializing)
+- (NSString*)JSONString;
+@end
+
+@interface NSString (CDVJSONSerializing)
+- (id)JSONObject;
+@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/192122fe/CordovaLib/Classes/CDVJSON.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVJSON.m b/CordovaLib/Classes/CDVJSON.m
new file mode 100644
index 0000000..78267e5
--- /dev/null
+++ b/CordovaLib/Classes/CDVJSON.m
@@ -0,0 +1,77 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import "CDVJSON.h"
+#import <Foundation/NSJSONSerialization.h>
+
+@implementation NSArray (CDVJSONSerializing)
+
+- (NSString*)JSONString
+{
+ NSError* error = nil;
+ NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self
+ options:NSJSONWritingPrettyPrinted
+ error:&error];
+
+ if (error != nil) {
+ NSLog(@"NSArray JSONString error: %@", [error localizedDescription]);
+ return nil;
+ } else {
+ return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
+ }
+}
+
+@end
+
+@implementation NSDictionary (CDVJSONSerializing)
+
+- (NSString*)JSONString
+{
+ NSError* error = nil;
+ NSData* jsonData = [NSJSONSerialization dataWithJSONObject:self
+ options:NSJSONWritingPrettyPrinted
+ error:&error];
+
+ if (error != nil) {
+ NSLog(@"NSDictionary JSONString error: %@", [error localizedDescription]);
+ return nil;
+ } else {
+ return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
+ }
+}
+
+@end
+
+@implementation NSString (CDVJSONSerializing)
+
+- (id)JSONObject
+{
+ NSError* error = nil;
+ id object = [NSJSONSerialization JSONObjectWithData:[self dataUsingEncoding:NSUTF8StringEncoding]
+ options:kNilOptions
+ error:&error];
+
+ if (error != nil) {
+ NSLog(@"NSString JSONObject error: %@", [error localizedDescription]);
+ }
+
+ return object;
+}
+
+@end
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/192122fe/CordovaLib/Classes/CDVPluginResult.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVPluginResult.m b/CordovaLib/Classes/CDVPluginResult.m
index 8939ac9..3103ad1 100644
--- a/CordovaLib/Classes/CDVPluginResult.m
+++ b/CordovaLib/Classes/CDVPluginResult.m
@@ -18,7 +18,7 @@
*/
#import "CDVPluginResult.h"
-#import "JSONKit.h"
+#import "CDVJSON.h"
#import "CDVDebug.h"
@interface CDVPluginResult ()
@@ -112,11 +112,23 @@ static NSArray* org_apache_cordova_CommandStatusMsgs;
- (NSString*)toJSONString
{
- NSString* resultString = [[NSDictionary dictionaryWithObjectsAndKeys:
- self.status, @"status",
- self.message ? self. message:[NSNull null], @"message",
- self.keepCallback, @"keepCallback",
- nil] cdvjk_JSONString];
+ NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
+ self.status, @"status",
+ self.message ? self. message:[NSNull null], @"message",
+ self.keepCallback, @"keepCallback",
+ nil];
+
+ NSError* error = nil;
+ NSData* jsonData = [NSJSONSerialization dataWithJSONObject:dict
+ options:NSJSONWritingPrettyPrinted
+ error:&error];
+ NSString* resultString = nil;
+
+ if (error != nil) {
+ NSLog(@"toJSONString error: %@", [error localizedDescription]);
+ } else {
+ resultString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
+ }
if ([[self class] isVerbose]) {
NSLog(@"PluginResult:toJSONString - %@", resultString);
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/192122fe/CordovaLib/Classes/CDVSound.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVSound.m b/CordovaLib/Classes/CDVSound.m
index f7a3adf..e6f729a 100644
--- a/CordovaLib/Classes/CDVSound.m
+++ b/CordovaLib/Classes/CDVSound.m
@@ -20,6 +20,7 @@
#import "CDVSound.h"
#import "CDVViewController.h"
#import "NSArray+Comparisons.h"
+#import "CDVJSON.h"
#define DOCUMENTS_SCHEME_PREFIX @"documents://"
#define HTTP_SCHEME_PREFIX @"http://"
@@ -141,7 +142,7 @@
[errorDict setObject:[NSNumber numberWithUnsignedInt:code] forKey:@"code"];
[errorDict setObject:message ? message:@"" forKey:@"message"];
- return [errorDict cdvjk_JSONString];
+ return [errorDict JSONString];
}
- (void)create:(CDVInvokedUrlCommand*)command
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/192122fe/CordovaLib/Classes/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.h b/CordovaLib/Classes/CDVViewController.h
index 5c1a814..9ec9a5c 100644
--- a/CordovaLib/Classes/CDVViewController.h
+++ b/CordovaLib/Classes/CDVViewController.h
@@ -18,7 +18,7 @@
*/
#import <UIKit/UIKit.h>
-#import "JSONKit.h"
+#import <Foundation/NSJSONSerialization.h>
#import "CDVAvailability.h"
#import "CDVInvokedUrlCommand.h"
#import "CDVCommandDelegate.h"
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/192122fe/CordovaLib/Classes/JSON/JSONKit.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/JSON/JSONKit.h b/CordovaLib/Classes/JSON/JSONKit.h
deleted file mode 100644
index 2b245cd..0000000
--- a/CordovaLib/Classes/JSON/JSONKit.h
+++ /dev/null
@@ -1,251 +0,0 @@
-//
-// JSONKit.h
-// http://github.com/johnezang/JSONKit
-// Dual licensed under either the terms of the BSD License, or alternatively
-// under the terms of the Apache License, Version 2.0, as specified below.
-//
-
-/*
- Copyright (c) 2011, John Engelhart
-
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of the Zang Industries nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
- Copyright 2011 John Engelhart
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-#include <stddef.h>
-#include <stdint.h>
-#include <limits.h>
-#include <TargetConditionals.h>
-#include <AvailabilityMacros.h>
-
-#ifdef __OBJC__
-#import <Foundation/NSArray.h>
-#import <Foundation/NSData.h>
-#import <Foundation/NSDictionary.h>
-#import <Foundation/NSError.h>
-#import <Foundation/NSObjCRuntime.h>
-#import <Foundation/NSString.h>
-#endif // __OBJC__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-// For Mac OS X < 10.5.
-#ifndef NSINTEGER_DEFINED
-#define NSINTEGER_DEFINED
-#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
-typedef long NSInteger;
-typedef unsigned long NSUInteger;
-#define NSIntegerMin LONG_MIN
-#define NSIntegerMax LONG_MAX
-#define NSUIntegerMax ULONG_MAX
-#else // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
-typedef int NSInteger;
-typedef unsigned int NSUInteger;
-#define NSIntegerMin INT_MIN
-#define NSIntegerMax INT_MAX
-#define NSUIntegerMax UINT_MAX
-#endif // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
-#endif // NSINTEGER_DEFINED
-
-
-#ifndef _CDVJSONKIT_H_
-#define _CDVJSONKIT_H_
-
-#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__APPLE_CC__) && (__APPLE_CC__ >= 5465)
-#define CDVJK_DEPRECATED_ATTRIBUTE __attribute__((deprecated))
-#else
-#define CDVJK_DEPRECATED_ATTRIBUTE
-#endif
-
-#define CDVJSONKIT_VERSION_MAJOR 1
-#define CDVJSONKIT_VERSION_MINOR 4
-
-typedef NSUInteger CDVJKFlags;
-
-/*
- CDVJKParseOptionComments : Allow C style // and /_* ... *_/ (without a _, obviously) comments in JSON.
- CDVJKParseOptionUnicodeNewlines : Allow Unicode recommended (?:\r\n|[\n\v\f\r\x85\p{Zl}\p{Zp}]) newlines.
- CDVJKParseOptionLooseUnicode : Normally the decoder will stop with an error at any malformed Unicode.
- This option allows JSON with malformed Unicode to be parsed without reporting an error.
- Any malformed Unicode is replaced with \uFFFD, or "REPLACEMENT CHARACTER".
- */
-
-enum {
- CDVJKParseOptionNone = 0,
- CDVJKParseOptionStrict = 0,
- CDVJKParseOptionComments = (1 << 0),
- CDVJKParseOptionUnicodeNewlines = (1 << 1),
- CDVJKParseOptionLooseUnicode = (1 << 2),
- CDVJKParseOptionPermitTextAfterValidJSON = (1 << 3),
- CDVJKParseOptionValidFlags = (CDVJKParseOptionComments | CDVJKParseOptionUnicodeNewlines | CDVJKParseOptionLooseUnicode | CDVJKParseOptionPermitTextAfterValidJSON),
-};
-typedef CDVJKFlags CDVJKParseOptionFlags;
-
-enum {
- CDVJKSerializeOptionNone = 0,
- CDVJKSerializeOptionPretty = (1 << 0),
- CDVJKSerializeOptionEscapeUnicode = (1 << 1),
- CDVJKSerializeOptionEscapeForwardSlashes = (1 << 4),
- CDVJKSerializeOptionValidFlags = (CDVJKSerializeOptionPretty | CDVJKSerializeOptionEscapeUnicode | CDVJKSerializeOptionEscapeForwardSlashes),
-};
-typedef CDVJKFlags CDVJKSerializeOptionFlags;
-
-#ifdef __OBJC__
-
-typedef struct CDVJKParseState CDVJKParseState; // Opaque internal, private type.
-
-// As a general rule of thumb, if you use a method that doesn't accept a CDVJKParseOptionFlags argument, it defaults to CDVJKParseOptionStrict
-
-@interface CDVJSONDecoder : NSObject {
- CDVJKParseState *parseState;
-}
-+ (id)decoder;
-+ (id)decoderWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags;
-- (id)initWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags;
-- (void)clearCache;
-
-// The parse... methods were deprecated in v1.4 in favor of the v1.4 objectWith... methods.
-- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length CDVJK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length: instead.
-- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error CDVJK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length:error: instead.
-// The NSData MUST be UTF8 encoded JSON.
-- (id)parseJSONData:(NSData *)jsonData CDVJK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData: instead.
-- (id)parseJSONData:(NSData *)jsonData error:(NSError **)error CDVJK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData:error: instead.
-
-// Methods that return immutable collection objects.
-- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length;
-- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error;
-// The NSData MUST be UTF8 encoded JSON.
-- (id)objectWithData:(NSData *)jsonData;
-- (id)objectWithData:(NSData *)jsonData error:(NSError **)error;
-
-// Methods that return mutable collection objects.
-- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length;
-- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error;
-// The NSData MUST be UTF8 encoded JSON.
-- (id)mutableObjectWithData:(NSData *)jsonData;
-- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error;
-
-@end
-
-////////////
-#pragma mark Deserializing methods
-////////////
-
-@interface NSString (CDVJSONKitDeserializing)
-- (id)cdvjk_objectFromJSONString;
-- (id)cdvjk_objectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags;
-- (id)cdvjk_objectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error;
-- (id)cdvjk_mutableObjectFromJSONString;
-- (id)cdvjk_mutableObjectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags;
-- (id)cdvjk_mutableObjectFromJSONStringWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error;
-@end
-
-@interface NSData (CDVJSONKitDeserializing)
-// The NSData MUST be UTF8 encoded JSON.
-- (id)cdvjk_objectFromJSONData;
-- (id)cdvjk_objectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags;
-- (id)cdvjk_objectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error;
-- (id)cdvjk_mutableObjectFromJSONData;
-- (id)cdvjk_mutableObjectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags;
-- (id)cdvjk_mutableObjectFromJSONDataWithParseOptions:(CDVJKParseOptionFlags)parseOptionFlags error:(NSError **)error;
-@end
-
-////////////
-#pragma mark Serializing methods
-////////////
-
-@interface NSString (CDVJSONKitSerializing)
-// Convenience methods for those that need to serialize the receiving NSString (i.e., instead of having to serialize a NSArray with a single NSString, you can "serialize to JSON" just the NSString).
-// Normally, a string that is serialized to JSON has quotation marks surrounding it, which you may or may not want when serializing a single string, and can be controlled with includeQuotes:
-// includeQuotes:YES `a "test"...` -> `"a \"test\"..."`
-// includeQuotes:NO `a "test"...` -> `a \"test\"...`
-- (NSData *)cdvjk_JSONData; // Invokes JSONDataWithOptions:CDVJKSerializeOptionNone includeQuotes:YES
-- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
-- (NSString *)cdvjk_JSONString; // Invokes JSONStringWithOptions:CDVJKSerializeOptionNone includeQuotes:YES
-- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
-@end
-
-@interface NSArray (CDVJSONKitSerializing)
-- (NSData *)cdvjk_JSONData;
-- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error;
-- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
-- (NSString *)cdvjk_JSONString;
-- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error;
-- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
-@end
-
-@interface NSDictionary (CDVJSONKitSerializing)
-- (NSData *)cdvjk_JSONData;
-- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error;
-- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
-- (NSString *)cdvjk_JSONString;
-- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions error:(NSError **)error;
-- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
-@end
-
-#ifdef __BLOCKS__
-
-@interface NSArray (CDVJSONKitSerializingBlockAdditions)
-- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
-- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
-@end
-
-@interface NSDictionary (CDVJSONKitSerializingBlockAdditions)
-- (NSData *)cdvjk_JSONDataWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
-- (NSString *)cdvjk_JSONStringWithOptions:(CDVJKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
-@end
-
-#endif
-
-
-#endif // __OBJC__
-
-#endif // _CDVJSONKIT_H_
-
-#ifdef __cplusplus
-} // extern "C"
-#endif