diff --git a/SBJson.xcodeproj/project.pbxproj b/SBJson.xcodeproj/project.pbxproj index 7884f237..be6f037c 100644 --- a/SBJson.xcodeproj/project.pbxproj +++ b/SBJson.xcodeproj/project.pbxproj @@ -16,8 +16,6 @@ BC417FF913A1008F00C8BC49 /* ProxyTest.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8852301391D6DD00370E55 /* ProxyTest.m */; }; BC417FFB13A1008F00C8BC49 /* StreamSuite.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8852971391D6DE00370E55 /* StreamSuite.m */; }; BC417FFC13A1008F00C8BC49 /* WriterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8852981391D6DE00370E55 /* WriterTest.m */; }; - BC88513F1391D6CD00370E55 /* NSObject+SBJson.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8851251391D6CD00370E55 /* NSObject+SBJson.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BC8851401391D6CD00370E55 /* NSObject+SBJson.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8851261391D6CD00370E55 /* NSObject+SBJson.m */; }; BC8851411391D6CD00370E55 /* SBJson.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8851271391D6CD00370E55 /* SBJson.h */; settings = {ATTRIBUTES = (Public, ); }; }; BC8851421391D6CD00370E55 /* SBJsonParser.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8851281391D6CD00370E55 /* SBJsonParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; BC8851431391D6CD00370E55 /* SBJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8851291391D6CD00370E55 /* SBJsonParser.m */; }; @@ -48,7 +46,6 @@ BC8853911391D6DE00370E55 /* StreamSuite.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8852971391D6DE00370E55 /* StreamSuite.m */; }; BC8853921391D6DE00370E55 /* WriterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8852981391D6DE00370E55 /* WriterTest.m */; }; BCADB7CE139210C90057A705 /* SBJson.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8851271391D6CD00370E55 /* SBJson.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BCADB7CF139210C90057A705 /* NSObject+SBJson.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8851251391D6CD00370E55 /* NSObject+SBJson.h */; settings = {ATTRIBUTES = (Public, ); }; }; BCADB7D0139210C90057A705 /* SBJsonParser.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8851281391D6CD00370E55 /* SBJsonParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; BCADB7D1139210C90057A705 /* SBJsonStreamParser.h in Headers */ = {isa = PBXBuildFile; fileRef = BC88512A1391D6CD00370E55 /* SBJsonStreamParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; BCADB7D2139210C90057A705 /* SBJsonStreamParserAccumulator.h in Headers */ = {isa = PBXBuildFile; fileRef = BC88512C1391D6CD00370E55 /* SBJsonStreamParserAccumulator.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -66,7 +63,6 @@ BCC2627613920FC7003D9994 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC8853981391D74C00370E55 /* Foundation.framework */; }; BCC2627B13920FC7003D9994 /* libsbjson-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BCC2626913920FC7003D9994 /* libsbjson-ios.a */; }; BCC2628113920FC7003D9994 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = BCC2627F13920FC7003D9994 /* InfoPlist.strings */; }; - BCC2628D13921035003D9994 /* NSObject+SBJson.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8851261391D6CD00370E55 /* NSObject+SBJson.m */; }; BCC2628E13921035003D9994 /* SBJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8851291391D6CD00370E55 /* SBJsonParser.m */; }; BCC2628F13921035003D9994 /* SBJsonStreamParser.m in Sources */ = {isa = PBXBuildFile; fileRef = BC88512B1391D6CD00370E55 /* SBJsonStreamParser.m */; }; BCC2629013921035003D9994 /* SBJsonStreamParserAccumulator.m in Sources */ = {isa = PBXBuildFile; fileRef = BC88512D1391D6CD00370E55 /* SBJsonStreamParserAccumulator.m */; }; @@ -118,8 +114,6 @@ BC1232591391D5CC00131607 /* SBJsonTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "SBJsonTests-Info.plist"; sourceTree = ""; }; BC12325B1391D5CC00131607 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; BC12325D1391D5CC00131607 /* SBJsonTests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SBJsonTests-Prefix.pch"; sourceTree = ""; }; - BC8851251391D6CD00370E55 /* NSObject+SBJson.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+SBJson.h"; sourceTree = ""; }; - BC8851261391D6CD00370E55 /* NSObject+SBJson.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+SBJson.m"; sourceTree = ""; }; BC8851271391D6CD00370E55 /* SBJson.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJson.h; sourceTree = ""; }; BC8851281391D6CD00370E55 /* SBJsonParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SBJsonParser.h; sourceTree = ""; }; BC8851291391D6CD00370E55 /* SBJsonParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SBJsonParser.m; sourceTree = ""; }; @@ -325,7 +319,6 @@ D7F64E221692549E009DF12E /* objc */ = { isa = PBXGroup; children = ( - BC8851261391D6CD00370E55 /* NSObject+SBJson.m */, BC8851271391D6CD00370E55 /* SBJson.h */, BC8851371391D6CD00370E55 /* SBJsonStreamWriterState.m */, BC8851361391D6CD00370E55 /* SBJsonStreamWriterState.h */, @@ -337,7 +330,6 @@ BC8851281391D6CD00370E55 /* SBJsonParser.h */, BC8851331391D6CD00370E55 /* SBJsonStreamWriter.m */, BC8851391391D6CD00370E55 /* SBJsonTokeniser.m */, - BC8851251391D6CD00370E55 /* NSObject+SBJson.h */, BC88512D1391D6CD00370E55 /* SBJsonStreamParserAccumulator.m */, BC88512A1391D6CD00370E55 /* SBJsonStreamParser.h */, BC88512E1391D6CD00370E55 /* SBJsonStreamParserAdapter.h */, @@ -397,7 +389,6 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - BC88513F1391D6CD00370E55 /* NSObject+SBJson.h in Headers */, BC8851421391D6CD00370E55 /* SBJsonParser.h in Headers */, BC8851441391D6CD00370E55 /* SBJsonStreamParser.h in Headers */, BC8851461391D6CD00370E55 /* SBJsonStreamParserAccumulator.h in Headers */, @@ -423,7 +414,6 @@ BCADB7D1139210C90057A705 /* SBJsonStreamParser.h in Headers */, BCADB7D3139210C90057A705 /* SBJsonStreamParserAdapter.h in Headers */, BCADB7D5139210C90057A705 /* SBJsonStreamWriter.h in Headers */, - BCADB7CF139210C90057A705 /* NSObject+SBJson.h in Headers */, BCADB7D2139210C90057A705 /* SBJsonStreamParserAccumulator.h in Headers */, BCADB7D6139210C90057A705 /* SBJsonStreamWriterAccumulator.h in Headers */, BCADB7D4139210C90057A705 /* SBJsonStreamParserState.h in Headers */, @@ -609,7 +599,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - BC8851401391D6CD00370E55 /* NSObject+SBJson.m in Sources */, BC8851431391D6CD00370E55 /* SBJsonParser.m in Sources */, BC8851451391D6CD00370E55 /* SBJsonStreamParser.m in Sources */, BC8851471391D6CD00370E55 /* SBJsonStreamParserAccumulator.m in Sources */, @@ -642,7 +631,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - BCC2628D13921035003D9994 /* NSObject+SBJson.m in Sources */, BCC2628E13921035003D9994 /* SBJsonParser.m in Sources */, BCC2628F13921035003D9994 /* SBJsonStreamParser.m in Sources */, BCC2629013921035003D9994 /* SBJsonStreamParserAccumulator.m in Sources */, diff --git a/src/main/objc/NSObject+SBJson.h b/src/main/objc/NSObject+SBJson.h deleted file mode 100644 index 9a60b593..00000000 --- a/src/main/objc/NSObject+SBJson.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2009 Stig Brautaset. 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 author 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. - */ - -#import - -#pragma mark JSON Writing - -/// Adds JSON generation to NSObject -@interface NSObject (NSObject_SBJsonWriting) - -/** - Encodes the receiver into a JSON string - - Although defined as a category on NSObject it is only defined for NSArray and NSDictionary. - - @return the receiver encoded in JSON, or nil on error. - - @warning Deprecated in Version 3.2; will be removed in 4.0 - - */ -- (NSString *)JSONRepresentation __attribute__ ((deprecated)); - -@end - - -#pragma mark JSON Parsing - -/// Adds JSON parsing methods to NSString -@interface NSString (NSString_SBJsonParsing) - -/** - Decodes the receiver's JSON text - - @return the NSDictionary or NSArray represented by the receiver, or nil on error. - - @warning Deprecated in Version 3.2; will be removed in 4.0 - - */ -- (id)JSONValue __attribute__ ((deprecated)); - -@end - -/// Adds JSON parsing methods to NSData -@interface NSData (NSData_SBJsonParsing) - -/** - Decodes the receiver's JSON data - - @return the NSDictionary or NSArray represented by the receiver, or nil on error. - - @warning Deprecated in Version 3.2; will be removed in 4.0 - - */ -- (id)JSONValue __attribute__ ((deprecated)); - -@end diff --git a/src/main/objc/NSObject+SBJson.m b/src/main/objc/NSObject+SBJson.m deleted file mode 100644 index 192dcb73..00000000 --- a/src/main/objc/NSObject+SBJson.m +++ /dev/null @@ -1,76 +0,0 @@ -/* - Copyright (C) 2009 Stig Brautaset. 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 author 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. - */ - -#if !__has_feature(objc_arc) -#error "This source file must be compiled with ARC enabled!" -#endif - -#import "NSObject+SBJson.h" -#import "SBJsonWriter.h" -#import "SBJsonParser.h" - -@implementation NSObject (NSObject_SBJsonWriting) - -- (NSString *)JSONRepresentation { - SBJsonWriter *writer = [[SBJsonWriter alloc] init]; - NSString *json = [writer stringWithObject:self]; - if (!json) - NSLog(@"-JSONRepresentation failed. Error is: %@", writer.error); - return json; -} - -@end - - - -@implementation NSString (NSString_SBJsonParsing) - -- (id)JSONValue { - SBJsonParser *parser = [[SBJsonParser alloc] init]; - id repr = [parser objectWithString:self]; - if (!repr) - NSLog(@"-JSONValue failed. Error is: %@", parser.error); - return repr; -} - -@end - - - -@implementation NSData (NSData_SBJsonParsing) - -- (id)JSONValue { - SBJsonParser *parser = [[SBJsonParser alloc] init]; - id repr = [parser objectWithData:self]; - if (!repr) - NSLog(@"-JSONValue failed. Error is: %@", parser.error); - return repr; -} - -@end diff --git a/src/main/objc/SBJson.h b/src/main/objc/SBJson.h index d37ffcd2..e51009cf 100644 --- a/src/main/objc/SBJson.h +++ b/src/main/objc/SBJson.h @@ -32,5 +32,4 @@ #import "SBJsonStreamParser.h" #import "SBJsonStreamParserAdapter.h" #import "SBJsonStreamWriter.h" -#import "NSObject+SBJson.h"