forked from pubnub/pubnub-api
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
3,505 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+40.5 KB
(620%)
...proj/project.xcworkspace/xcuserdata/dahiwadkar.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
10 changes: 10 additions & 0 deletions
10
...deproj/project.xcworkspace/xcuserdata/dahiwadkar.xcuserdatad/WorkspaceSettings.xcsettings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges</key> | ||
<true/> | ||
<key>SnapshotAutomaticallyBeforeSignificantChanges</key> | ||
<true/> | ||
</dict> | ||
</plist> |
Binary file modified
BIN
+6.16 KB
(140%)
...codeproj/project.xcworkspace/xcuserdata/pubnub.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2011 Cooliris, Inc. | ||
// | ||
// 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. | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
id JSONParseData(NSData* data); // Objects must be NSArray or NSDictionary - Assumes UTF8 encoding | ||
NSData* JSONWriteData(id object); // Objects must be NSArray or NSDictionary - Assumes UTF8 encoding | ||
|
||
id JSONParseString(NSString* string); // Objects must be NSArray or NSDictionary | ||
NSString* JSONWriteString(id object); // Objects must be NSArray or NSDictionary | ||
|
||
id JSONGetDictionaryValueForKey(NSDictionary* dictionary, NSString* key); // Converts NSNull to nil | ||
id JSONGetArrayValueAtIndex(NSArray* array, NSUInteger index); // Allows out of bounds and converts NSNull to nil | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// Copyright 2011 Cooliris, Inc. | ||
// | ||
// 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. | ||
|
||
#import "JSON.h" | ||
#import "JSONKit.h" | ||
|
||
#if 1 | ||
//#import "Logging.h" | ||
#else | ||
#define LOG_ERROR(...) NSLog(__VA_ARGS__) | ||
#define DCHECK(...) | ||
#endif | ||
|
||
id JSONParseData(NSData* data) { | ||
NSError* error = nil; | ||
id object = [data objectFromJSONDataWithParseOptions:JKParseOptionNone error:&error]; | ||
if (object == nil) { | ||
NSLog(@"JSON deserializing failed: %@", error); | ||
} | ||
return object; | ||
} | ||
|
||
NSData* JSONWriteData(id object) { | ||
NSData* data = nil; | ||
NSError* error = nil; | ||
if ([object isKindOfClass:[NSString class]]) { | ||
data = [(NSString*)object JSONDataWithOptions:JKSerializeOptionNone includeQuotes:YES error:&error]; | ||
} else if ([object isKindOfClass:[NSArray class]]) { | ||
data = [(NSArray*)object JSONDataWithOptions:JKSerializeOptionNone error:&error]; | ||
} else if ([object isKindOfClass:[NSDictionary class]]) { | ||
data = [(NSDictionary*)object JSONDataWithOptions:JKSerializeOptionNone error:&error]; | ||
} else { | ||
// NOT_REACHED(); | ||
} | ||
if (data == nil) { | ||
NSLog(@"JSON serializing failed: %@", error); | ||
} | ||
return data; | ||
} | ||
|
||
id JSONParseString(NSString* string) { | ||
NSError* error = nil; | ||
id object = [string objectFromJSONStringWithParseOptions:JKParseOptionNone error:&error]; | ||
if (object == nil) { | ||
NSLog(@"JSON deserializing failed: %@", error); | ||
} | ||
return object; | ||
} | ||
|
||
NSString* JSONWriteString(id object) { | ||
NSString* string = nil; | ||
NSError* error = nil; | ||
if ([object isKindOfClass:[NSString class]]) { | ||
string = [(NSString*)object JSONStringWithOptions:JKSerializeOptionNone includeQuotes:YES error:&error]; | ||
} else if ([object isKindOfClass:[NSArray class]]) { | ||
string = [(NSArray*)object JSONStringWithOptions:JKSerializeOptionNone error:&error]; | ||
} else if ([object isKindOfClass:[NSDictionary class]]) { | ||
string = [(NSDictionary*)object JSONStringWithOptions:JKSerializeOptionNone error:&error]; | ||
} else { | ||
// NOT_REACHED(); | ||
} | ||
if (string == nil) { | ||
NSLog(@"JSON serializing failed: %@", error); | ||
} | ||
return string; | ||
} | ||
|
||
id JSONGetDictionaryValueForKey(NSDictionary* dictionary, NSString* key) { | ||
// DCHECK(!dictionary || [dictionary isKindOfClass:[NSDictionary class]]); | ||
id value = nil; | ||
if(!dictionary || [dictionary isKindOfClass:[NSDictionary class]]) | ||
{ | ||
value = [dictionary objectForKey:key]; | ||
|
||
} | ||
return (value == [NSNull null] ? nil : value); | ||
} | ||
|
||
id JSONGetArrayValueAtIndex(NSArray* array, NSUInteger index) { | ||
// DCHECK(!array || [array isKindOfClass:[NSArray class]]); | ||
id value = index < array.count ? [array objectAtIndex:index] : nil; | ||
return (value == [NSNull null] ? nil : value); | ||
} |
Oops, something went wrong.