diff --git a/iTrakt.xcodeproj/project.pbxproj b/iTrakt.xcodeproj/project.pbxproj index 8713754..22eaf5f 100755 --- a/iTrakt.xcodeproj/project.pbxproj +++ b/iTrakt.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ 2458FBC612EB6978001B7590 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 2458FBBB12EB6978001B7590 /* Default.png */; }; 2458FBC712EB6978001B7590 /* Default-Portrait.png in Resources */ = {isa = PBXBuildFile; fileRef = 2458FBBC12EB6978001B7590 /* Default-Portrait.png */; }; 2458FBC812EB6978001B7590 /* Default-Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 2458FBBD12EB6978001B7590 /* Default-Landscape.png */; }; + 2479A22C12EC83DB00E2AD4E /* YAJL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2479A22B12EC83DB00E2AD4E /* YAJL.framework */; }; 2484C6AE12E9F568000D3871 /* BroadcastDate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2484C6AD12E9F568000D3871 /* BroadcastDate.m */; }; 24EF210712EA3A2A00B54F6F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 2892E4100DC94CBA00A64D0F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */; }; @@ -51,6 +52,7 @@ 2458FBBB12EB6978001B7590 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = Images/Default.png; sourceTree = ""; }; 2458FBBC12EB6978001B7590 /* Default-Portrait.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-Portrait.png"; path = "Images/Default-Portrait.png"; sourceTree = ""; }; 2458FBBD12EB6978001B7590 /* Default-Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-Landscape.png"; path = "Images/Default-Landscape.png"; sourceTree = ""; }; + 2479A22B12EC83DB00E2AD4E /* YAJL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = YAJL.framework; path = vendor/YAJL.framework; sourceTree = ""; }; 2484C6AC12E9F568000D3871 /* BroadcastDate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BroadcastDate.h; sourceTree = ""; }; 2484C6AD12E9F568000D3871 /* BroadcastDate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BroadcastDate.m; sourceTree = ""; }; 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; @@ -77,6 +79,7 @@ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 2892E4100DC94CBA00A64D0F /* CoreGraphics.framework in Frameworks */, + 2479A22C12EC83DB00E2AD4E /* YAJL.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -134,6 +137,7 @@ 29B97317FDCFA39411CA2CEA /* Resources */, 29B97323FDCFA39411CA2CEA /* Frameworks */, 19C28FACFE9D520D11CA2CBB /* Products */, + 2479A22B12EC83DB00E2AD4E /* YAJL.framework */, ); name = CustomTemplate; sourceTree = ""; @@ -263,6 +267,10 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/vendor\"", + ); GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -277,6 +285,10 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/vendor\"", + ); GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = iTrakt_Prefix.pch; INFOPLIST_FILE = "iTrakt-Info.plist"; diff --git a/vendor/YAJL.framework/Headers b/vendor/YAJL.framework/Headers new file mode 120000 index 0000000..a177d2a --- /dev/null +++ b/vendor/YAJL.framework/Headers @@ -0,0 +1 @@ +Versions/Current/Headers \ No newline at end of file diff --git a/vendor/YAJL.framework/Resources b/vendor/YAJL.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/vendor/YAJL.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/vendor/YAJL.framework/Versions/A/Headers/NSBundle+YAJL.h b/vendor/YAJL.framework/Versions/A/Headers/NSBundle+YAJL.h new file mode 100644 index 0000000..4b8a41b --- /dev/null +++ b/vendor/YAJL.framework/Versions/A/Headers/NSBundle+YAJL.h @@ -0,0 +1,62 @@ +// +// NSBundle+YAJL.h +// YAJL +// +// Created by Gabriel Handford on 7/23/09. +// Copyright 2009. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +#import "YAJLParser.h" + +/*! + Utilities for loading JSON from resource bundles. + + @code + id JSONValue = [[NSBundle mainBundle] yajl_JSONFromResource:@"kegs.json"]; + @endcode + */ +@interface NSBundle(YAJL) + +/*! + Load JSON from bundle. + @param resource Resource name with extension, for example, file.json + @throws YAJLParserException On parse error + */ +- (id)yajl_JSONFromResource:(NSString *)resource; + +/*! + Load JSON from bundle. + @param resource Resource name with extension, for example, file.json + @param options Parser options + - YAJLParserOptionsNone: No options + - YAJLParserOptionsAllowComments: Javascript style comments will be allowed in the input (both /&asterisk; &asterisk;/ and //) + - YAJLParserOptionsCheckUTF8: Invalid UTF8 strings will cause a parse error + - YAJLParserOptionsStrictPrecision: If YES will force strict precision and return integer overflow error + + @param error Out error + @result JSON value (NSArray, NSDictionary) or nil if errored + */ +- (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error; + +@end diff --git a/vendor/YAJL.framework/Versions/A/Headers/NSObject+YAJL.h b/vendor/YAJL.framework/Versions/A/Headers/NSObject+YAJL.h new file mode 100644 index 0000000..e2a49da --- /dev/null +++ b/vendor/YAJL.framework/Versions/A/Headers/NSObject+YAJL.h @@ -0,0 +1,154 @@ +// +// NSObject+YAJL.h +// YAJL +// +// Created by Gabriel Handford on 7/23/09. +// Copyright 2009. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +#import "YAJLGen.h" +#import "YAJLParser.h" + +/*! + Generate JSON string from NSArray, NSDictionary or custom object or parse JSON from NSString or custom object. + + Parse JSON: + @code + NSData *JSONData = [NSData dataWithContentsOfFile:@"example.json"]; + NSArray *arrayFromData = [JSONData yajl_JSON]; + + NSString *JSONString = @"[\"Test\"]"; + NSArray *arrayFromString = [JSONString yajl_JSON]; + + // With options and out error + NSError *error = nil; + NSArray *arrayFromString = [JSONString yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:&error]; + @endcode + + Generate JSON: + @code + NSDictionary *dict = [NSDictionary dictionaryWithObject:@"value" forKey:@"key"]; + NSString *JSONString = [dict yajl_JSONString]; + + // Beautified with custon indent string + NSArray *array = [NSArray arrayWithObjects:@"value1", @"value2", nil]; + NSString *JSONString = [dict yajl_JSONStringWithOptions:YAJLGenOptionsBeautify indentString:@" "]; + @endcode + */ +@interface NSObject(YAJL) + +#pragma mark Gen + +/*! + Create JSON string from object. + Supported objects include: NSArray, NSDictionary, NSNumber, NSString, NSNull + To override JSON value to encode (or support custom objects), implement (id)JSON; See YAJLCoding in YAJLGen.h + @throws YAJLGenInvalidObjectException If object is invalid + @result JSON String + */ +- (NSString *)yajl_JSONString; + +/*! + Create JSON string from object. + Supported objects include: NSArray, NSDictionary, NSNumber, NSString, NSNull + To override JSON value to encode (or support custom objects), implement (id)JSON; See YAJLCoding in YAJLGen.h + @throws YAJLGenInvalidObjectException If object is invalid + @param options + - YAJLGenOptionsNone: No options + - YAJLGenOptionsBeautify: Beautifiy JSON output + - YAJLGenOptionsIgnoreUnknownTypes: Ignore unknown types (will use null value) + - YAJLGenOptionsIncludeUnsupportedTypes: Handle non-JSON types (including NSDate, NSData, NSURL) + + @param indentString + @result JSON String + */ +- (NSString *)yajl_JSONStringWithOptions:(YAJLGenOptions)options indentString:(NSString *)indentString; + + +#pragma mark Parsing + +/*! + Parse JSON (NSString or NSData or dataUsingEncoding:). + @result JSON object + @throws YAJLParserException If a parse error occured + @throws YAJLParsingUnsupportedException If not NSData or doesn't respond to dataUsingEncoding: + + @code + NSString *JSONString = @"{'foo':['bar', true]}"; + id JSONValue = [JSONString yajl_JSON]; + + NSData *JSONData = ...; + id JSONValue = [JSONData yajl_JSON]; + @endcode + */ +- (id)yajl_JSON; + +/*! + Parse JSON (NSString or NSData or dataUsingEncoding:) with out error. + + If an error occurs, the returned object will be the current state of the object when + the error occurred. + + @param error Error to set if we failed to parse + @result JSON object + @throws YAJLParserException If a parse error occured + @throws YAJLParsingUnsupportedException If not NSData or doesn't respond to dataUsingEncoding: + + @code + NSString *JSONString = @"{'foo':['bar', true]}"; + NSError *error = nil; + [JSONString yajl_JSON:error]; + if (error) ...; + @endcode + */ +- (id)yajl_JSON:(NSError **)error; + +/*! + Parse JSON (NSString or NSData or dataUsingEncoding:) with options and out error. + + If an error occurs, the returned object will be the current state of the object when + the error occurred. + + @param options Parse options + - YAJLParserOptionsNone: No options + - YAJLParserOptionsAllowComments: Javascript style comments will be allowed in the input (both /&asterisk; &asterisk;/ and //) + - YAJLParserOptionsCheckUTF8: Invalid UTF8 strings will cause a parse error + - YAJLParserOptionsStrictPrecision: If YES will force strict precision and return integer overflow error + + @param error Error to set if we failed to parse + @result JSON object + @throws YAJLParserException If a parse error occured + @throws YAJLParsingUnsupportedException If not NSData or doesn't respond to dataUsingEncoding: + + @code + NSString *JSONString = @"{'foo':['bar', true]} // comment"; + NSError *error = nil; + [JSONString yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error]; + if (error) ...; + @endcode + */ +- (id)yajl_JSONWithOptions:(YAJLParserOptions)options error:(NSError **)error; + +@end + diff --git a/vendor/YAJL.framework/Versions/A/Headers/YAJL.h b/vendor/YAJL.framework/Versions/A/Headers/YAJL.h new file mode 100644 index 0000000..b34426c --- /dev/null +++ b/vendor/YAJL.framework/Versions/A/Headers/YAJL.h @@ -0,0 +1,209 @@ +// +// YAJL.h +// YAJL +// +// Created by Gabriel Handford on 7/23/09. +// Copyright 2009. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +#import "YAJLParser.h" +#import "YAJLDocument.h" +#import "YAJLGen.h" +#import "NSObject+YAJL.h" +#import "NSBundle+YAJL.h" + +/*! + @mainpage YAJL + + The YAJL framework is an Objective-C wrapper around the http://lloyd.github.com/yajl/ SAX-style JSON parser. + + @section Links + + Source: http://github.com/gabriel/yajl-objc + + View docs online: http://gabriel.github.com/yajl-objc/ + + YAJL C docs: http://lloyd.github.com/yajl/ + + @section Usage Usage + + To use the framework (for Mac OS X or iOS): + + @code + #import + @endcode + + @section Examples Examples + + @subsection Example1 To parse JSON from NSData + + @code + NSData *JSONData = [NSData dataWithContentsOfFile:@"example.json"]; + NSArray *arrayFromData = [JSONData yajl_JSON]; + @endcode + + @subsection Example2 To parse JSON from NSString + + @code + NSString *JSONString = @"[1, 2, 3]"; + NSArray *arrayFromString = [JSONString yajl_JSON]; + @endcode + + @subsection Example2 To parse JSON from NSString with error and comments + + @code + // With options and out error + NSString *JSONString = @"[1, 2, 3] // Allow comments"; + NSError *error = nil; + NSArray *arrayFromString = [JSONString yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:&error]; + @endcode + + @subsection Example3 To generate JSON from an object, NSArray, NSDictionary, etc. + + @code + NSDictionary *dict = [NSDictionary dictionaryWithObject:@"value" forKey:@"key"]; + NSString *JSONString = [dict yajl_JSONString]; + @endcode + + @subsection Example4 To generate JSON from an object, beautified with custom indent + + @code + // Beautified with custon indent string + NSArray *array = [NSArray arrayWithObjects:@"value1", @"value2", nil]; + NSString *JSONString = [dict yajl_JSONStringWithOptions:YAJLGenOptionsBeautify indentString:@" "]; + @endcode + + @subsection Example5 To use the streaming (or SAX style) parser, use YAJLParser + + @code + NSData *data = [NSData dataWithContentsOfFile:@"example.json"]; + + YAJLParser *parser = [[YAJLParser alloc] initWithParserOptions:YAJLParserOptionsAllowComments]; + parser.delegate = self; + [parser parse:data]; + if (parser.parserError) + NSLog(@"Error:\n%@", parser.parserError); + + parser.delegate = nil; + [parser release]; + + // Include delegate methods from YAJLParserDelegate + - (void)parserDidStartDictionary:(YAJLParser *)parser { } + - (void)parserDidEndDictionary:(YAJLParser *)parser { } + + - (void)parserDidStartArray:(YAJLParser *)parser { } + - (void)parserDidEndArray:(YAJLParser *)parser { } + + - (void)parser:(YAJLParser *)parser didMapKey:(NSString *)key { } + - (void)parser:(YAJLParser *)parser didAdd:(id)value { } + @endcode + + @subsection ParserOptions Parser Options + + There are options when parsing that can be specified with YAJLParser#initWithParserOptions:. + + - YAJLParserOptionsAllowComments: Allows comments in JSON + - YAJLParserOptionsCheckUTF8: Will verify UTF-8 + - YAJLParserOptionsStrictPrecision: Will force strict precision and return integer overflow error, if number is greater than long long. + + @subsection Example6 Parsing as data becomes available + + @code + YAJLParser *parser = [[[YAJLParser alloc] init] autorelease]; + parser.delegate = self; + + // A chunk of data comes... + YAJLParserStatus status = [parser parse:chunk1]; + // 'status' should be YAJLParserStatusInsufficientData, if its not finished + if (parser.parserError) + NSLog(@"Error:\n%@", parser.parserError); + + // Another chunk of data comes... + YAJLParserStatus status = [parser parse:chunk2]; + // 'status' should be YAJLParserStatusOK if its finished + if (parser.parserError) + NSLog(@"Error:\n%@", parser.parserError); + @endcode + + @subsection Example7 Document style parsing + + To use the document style, use YAJLDocument. Usage should be very similar to NSXMLDocument. + + @code + NSData *data = [NSData dataWithContentsOfFile:@"example.json"]; + NSError *error = nil; + YAJLDocument *document = [[YAJLDocument alloc] initWithData:data parserOptions:YAJLParserOptionsNone error:&error]; + // Access root element at document.root + NSLog(@"Root: %@", document.root); + [document release]; + @endcode + + @subsection Example8 Document style parsing as data becomes available + + @code + YAJLDocument *document = [[YAJLDocument alloc] init]; + document.delegate = self; + + NSError *error = nil; + [document parse:chunk1 error:error]; + [document parse:chunk2 error:error]; + + // You can access root element at document.root + NSLog(@"Root: %@", document.root); + [document release]; + + // Or via the YAJLDocumentDelegate delegate methods + + - (void)document:(YAJLDocument *)document didAddDictionary:(NSDictionary *)dict { } + - (void)document:(YAJLDocument *)document didAddArray:(NSArray *)array { } + - (void)document:(YAJLDocument *)document didAddObject:(id)object toArray:(NSArray *)array { } + - (void)document:(YAJLDocument *)document didSetObject:(id)object forKey:(id)key inDictionary:(NSDictionary *)dict { } + @endcode + + @subsection Example9 Load JSON from Bundle + + @code + id JSONValue = [[NSBundle mainBundle] yajl_JSONFromResource:@"kegs.json"]; + @endcode + + @section CustomizedEncoding Customized Encoding + + To implement JSON encodable value for custom objects or override for existing objects, implement - (id)JSON; + + For example: + + @code + @interface CustomObject : NSObject + @end + + @implementation CustomObject + + - (id)JSON { + return [NSArray arrayWithObject:[NSNumber numberWithInteger:1]]; + } + + @end + @endcode + + */ \ No newline at end of file diff --git a/vendor/YAJL.framework/Versions/A/Headers/YAJLDocument.h b/vendor/YAJL.framework/Versions/A/Headers/YAJLDocument.h new file mode 100644 index 0000000..60612c1 --- /dev/null +++ b/vendor/YAJL.framework/Versions/A/Headers/YAJLDocument.h @@ -0,0 +1,172 @@ +// +// YAJLDecoder.h +// YAJL +// +// Created by Gabriel Handford on 3/1/09. +// Copyright 2009. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + + +#include "YAJLParser.h" + +typedef enum { + YAJLDecoderCurrentTypeNone, + YAJLDecoderCurrentTypeArray, + YAJLDecoderCurrentTypeDict +} YAJLDecoderCurrentType; + +extern NSInteger YAJLDocumentStackCapacity; + +@class YAJLDocument; + +/*! + YAJLDocument delegate notified when objects are added. + */ +@protocol YAJLDocumentDelegate +@optional +/*! + Did add dictionary. + @param document Sender + @param dict Dictionary that was added + */ +- (void)document:(YAJLDocument *)document didAddDictionary:(NSDictionary *)dict; + +/*! + Did add array. + @param document Sender + @param array Array that was added + */ +- (void)document:(YAJLDocument *)document didAddArray:(NSArray *)array; + +/*! + Did add object to array. + @param document Sender + @param object Object added + @param array Array objct was added to + */ +- (void)document:(YAJLDocument *)document didAddObject:(id)object toArray:(NSArray *)array; + +/*! + Did set object for key on dictionary. + @param document Sender + @param object Object that was set + @param key Key + @param dict Dictionary object was set for key on + */ +- (void)document:(YAJLDocument *)document didSetObject:(id)object forKey:(id)key inDictionary:(NSDictionary *)dict; +@end + +/*! + JSON document interface. + + @code + NSData *data = [NSData dataWithContentsOfFile:@"example.json"]; + NSError *error = nil; + YAJLDocument *document = [[YAJLDocument alloc] initWithData:data parserOptions:YAJLParserOptionsNone error:&error]; + // Access root element at document.root + NSLog(@"Root: %@", document.root); + [document release]; + @endcode + + Example for streaming: + @code + YAJLDocument *document = [[YAJLDocument alloc] init]; + document.delegate = self; + + NSError *error = nil; + [document parse:chunk1 error:error]; + [document parse:chunk2 error:error]; + + // You can access root element at document.root + NSLog(@"Root: %@", document.root); + [document release]; + + // Or via the YAJLDocumentDelegate delegate methods + + - (void)document:(YAJLDocument *)document didAddDictionary:(NSDictionary *)dict { } + - (void)document:(YAJLDocument *)document didAddArray:(NSArray *)array { } + - (void)document:(YAJLDocument *)document didAddObject:(id)object toArray:(NSArray *)array { } + - (void)document:(YAJLDocument *)document didSetObject:(id)object forKey:(id)key inDictionary:(NSDictionary *)dict { } + @endcode + */ +@interface YAJLDocument : NSObject { + + id root_; // NSArray or NSDictionary + YAJLParser *parser_; + + // TODO(gabe): This should be __weak + id delegate_; + + __weak NSMutableDictionary *dict_; // weak; if map in progress, points to the current map + __weak NSMutableArray *array_; // weak; If array in progress, points the current array + __weak NSString *key_; // weak; If map in progress, points to current key + + NSMutableArray *stack_; + NSMutableArray *keyStack_; + + YAJLDecoderCurrentType currentType_; + + YAJLParserStatus parserStatus_; + +} + +@property (readonly, nonatomic) id root; //! The root element of the document, either NSArray or NSDictionary +@property (readonly, nonatomic) YAJLParserStatus parserStatus; //! The current status of parsing +@property (assign, nonatomic) id delegate; //! Delegate + +/*! + Create document from data. + @param data Data to parse + @param parserOptions Parse options + - YAJLParserOptionsNone: No options + - YAJLParserOptionsAllowComments: Javascript style comments will be allowed in the input (both /&asterisk; &asterisk;/ and //) + - YAJLParserOptionsCheckUTF8: Invalid UTF8 strings will cause a parse error + - YAJLParserOptionsStrictPrecision: If YES will force strict precision and return integer overflow error + @param error Error to set on failure + */ +- (id)initWithData:(NSData *)data parserOptions:(YAJLParserOptions)parserOptions error:(NSError **)error; + +/*! + Create empty document with parser options. + @param parserOptions Parse options + - YAJLParserOptionsNone: No options + - YAJLParserOptionsAllowComments: Javascript style comments will be allowed in the input (both /&asterisk; &asterisk;/ and //) + - YAJLParserOptionsCheckUTF8: Invalid UTF8 strings will cause a parse error + - YAJLParserOptionsStrictPrecision: If YES will force strict precision and return integer overflow error + */ +- (id)initWithParserOptions:(YAJLParserOptions)parserOptions; + +/*! + Parse data. + @param data Data to parse + @param error Out error to set on failure + @result Parser status + - YAJLParserStatusNone: No status + - YAJLParserStatusOK: Parsed OK + - YAJLParserStatusInsufficientData: There was insufficient data + - YAJLParserStatusError: Parser errored + */ +- (YAJLParserStatus)parse:(NSData *)data error:(NSError **)error; + +@end diff --git a/vendor/YAJL.framework/Versions/A/Headers/YAJLGen.h b/vendor/YAJL.framework/Versions/A/Headers/YAJLGen.h new file mode 100644 index 0000000..ef8eed2 --- /dev/null +++ b/vendor/YAJL.framework/Versions/A/Headers/YAJLGen.h @@ -0,0 +1,171 @@ +// +// YAJLGen.h +// YAJL +// +// Created by Gabriel Handford on 7/19/09. +// Copyright 2009. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + +#include "yajl_gen.h" + + +extern NSString *const YAJLGenInvalidObjectException; //! Exception type if we encounter invalid object + +//! JSON generate options +enum YAJLGenOptions { + YAJLGenOptionsNone = 0, //!< No options + YAJLGenOptionsBeautify = 1 << 0, //!< Beautifiy JSON output + YAJLGenOptionsIgnoreUnknownTypes = 1 << 1, //!< Ignore unknown types (will use null value) + YAJLGenOptionsIncludeUnsupportedTypes = 1 << 2, //!< Handle non-JSON types (including NSDate, NSData, NSURL) +}; +typedef NSUInteger YAJLGenOptions; + +/*! + YAJL JSON string generator. + Supports the following types: + - NSArray + - NSDictionary + - NSString + - NSNumber + - NSNull + + We also support the following types (if using YAJLGenOptionsIncludeUnsupportedTypes option), + by converting to JSON supported types: + - NSDate: number representing number of milliseconds since (1970) epoch + - NSData: Base64 encoded string + - NSURL: URL (absolute) string + */ +@interface YAJLGen : NSObject { + yajl_gen gen_; + + YAJLGenOptions genOptions_; +} + +/*! + JSON generator with options. + @param genOptions Generate options + - YAJLGenOptionsNone: No options + - YAJLGenOptionsBeautify: Beautifiy JSON output + - YAJLGenOptionsIgnoreUnknownTypes: Ignore unknown types (will use null value) + - YAJLGenOptionsIncludeUnsupportedTypes: Handle non-JSON types (including NSDate, NSData, NSURL) + + @param indentString String for indentation + */ +- (id)initWithGenOptions:(YAJLGenOptions)genOptions indentString:(NSString *)indentString; + +/*! + Write JSON for object to buffer. + @param obj Supported or custom object + */ +- (void)object:(id)obj; + +/*! + Write null value to buffer. + */ +- (void)null; + +/*! + Write bool value to buffer. + @param b Output true or false + */ +- (void)bool:(BOOL)b; + +/*! + Write numeric value to buffer. + @param number Numeric value + */ +- (void)number:(NSNumber *)number; + +/*! + Write string value to buffer. + @param s String value + */ +- (void)string:(NSString *)s; + +/*! + Write dictionary start ('{') to buffer. + */ +- (void)startDictionary; + +/*! + Write dictionary end ('}') to buffer. + */ +- (void)endDictionary; + +/*! + Write array start ('[') to buffer. + */ +- (void)startArray; + +/*! + Write array end (']') to buffer. + */ +- (void)endArray; + +/*! + Clear JSON buffer. + */ +- (void)clear; + +/*! + Get current JSON buffer. + */ +- (NSString *)buffer; + +@end + + +/*! + Custom objects can support manual JSON encoding. + + @code + @interface CustomObject : NSObject + @end + + @implementation CustomObject + + - (id)JSON { + return [NSArray arrayWithObject:[NSNumber numberWithInteger:1]]; + } + + @end + @endcode + + And then: + + @code + CustomObject *customObject = [[CustomObject alloc] init]; + NSString *JSONString = [customObject yajl_JSON]; + // JSONString == "[1]"; + @endcode + */ +@protocol YAJLCoding + +/*! + Provide custom and/or encodable object to parse to JSON string. + @result Object encodable as JSON such as NSDictionary, NSArray, etc + */ +- (id)JSON; + +@end diff --git a/vendor/YAJL.framework/Versions/A/Headers/YAJLParser.h b/vendor/YAJL.framework/Versions/A/Headers/YAJLParser.h new file mode 100644 index 0000000..7db511c --- /dev/null +++ b/vendor/YAJL.framework/Versions/A/Headers/YAJLParser.h @@ -0,0 +1,181 @@ +// +// YAJLParser.h +// YAJL +// +// Created by Gabriel Handford on 6/14/09. +// Copyright 2009. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person +// obtaining a copy of this software and associated documentation +// files (the "Software"), to deal in the Software without +// restriction, including without limitation the rights to use, +// copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +// OTHER DEALINGS IN THE SOFTWARE. +// + + +#include "yajl_parse.h" + + +extern NSString *const YAJLErrorDomain; //! Error domain for YAJL +extern NSString *const YAJLParserException; //! Generic parse exception +extern NSString *const YAJLParsingUnsupportedException; //! Parsing unsupported exception + +extern NSString *const YAJLParserValueKey; //! Key in NSError userInfo for value we errored on + +//! Parser error codes +enum YAJLParserErrorCode { + YAJLParserErrorCodeAllocError = -1000, //!< Alloc error + YAJLParserErrorCodeDoubleOverflow = -1001, //!< Double overflow + YAJLParserErrorCodeIntegerOverflow = -1002 //!< Integer overflow +}; +typedef NSInteger YAJLParserErrorCode; //! Parser error codes + +//! Parser options +enum YAJLParserOptions { + YAJLParserOptionsNone = 0, //!< No options + YAJLParserOptionsAllowComments = 1 << 0, //!< Javascript style comments will be allowed in the input (both /&asterisk; &asterisk;/ and //) + YAJLParserOptionsCheckUTF8 = 1 << 1, //!< Invalid UTF8 strings will cause a parse error + YAJLParserOptionsStrictPrecision = 1 << 2, //!< If YES will force strict precision and return integer overflow error +}; +typedef NSUInteger YAJLParserOptions; //! Parser options + +//! Parser status +enum { + YAJLParserStatusNone = 0, //!< No status + YAJLParserStatusOK = 1, //!< Parsed OK + YAJLParserStatusInsufficientData = 2, //!< There was insufficient data + YAJLParserStatusError = 3 //!< Parser errored +}; +typedef NSUInteger YAJLParserStatus; //!< Status of the last parse event + + +@class YAJLParser; + +/*! + Delegate for YAJL JSON parser. + */ +@protocol YAJLParserDelegate + +/*! + Parser did start dictionary. + @param parser Sender + */ +- (void)parserDidStartDictionary:(YAJLParser *)parser; + +/*! + Parser did end dictionary. + @param parser Sender + */ +- (void)parserDidEndDictionary:(YAJLParser *)parser; + +/*! + Parser did start array. + @param parser Sender + */ +- (void)parserDidStartArray:(YAJLParser *)parser; + +/*! + Parser did end array. + @param parser Sender + */ +- (void)parserDidEndArray:(YAJLParser *)parser; + +/*! + Parser did map key. + @param parser Sender + @param key Key that was mapped + */ +- (void)parser:(YAJLParser *)parser didMapKey:(NSString *)key; + +/*! + Did add value. + @param parser Sender + @param value Value of type NSNull, NSString or NSNumber + */ +- (void)parser:(YAJLParser *)parser didAdd:(id)value; + +@end + +/*! + JSON parser. + + @code + NSData *data = [NSData dataWithContentsOfFile:@"example.json"]; + + YAJLParser *parser = [[YAJLParser alloc] initWithParserOptions:YAJLParserOptionsAllowComments]; + parser.delegate = self; + [parser parse:data]; + if (parser.parserError) { + NSLog(@"Error:\n%@", parser.parserError); + } + + parser.delegate = nil; + [parser release]; + + // Include delegate methods from YAJLParserDelegate + - (void)parserDidStartDictionary:(YAJLParser *)parser { } + - (void)parserDidEndDictionary:(YAJLParser *)parser { } + + - (void)parserDidStartArray:(YAJLParser *)parser { } + - (void)parserDidEndArray:(YAJLParser *)parser { } + + - (void)parser:(YAJLParser *)parser didMapKey:(NSString *)key { } + - (void)parser:(YAJLParser *)parser didAdd:(id)value { } + @endcode + */ +@interface YAJLParser : NSObject { + + yajl_handle handle_; + + __weak id delegate_; // weak + + YAJLParserOptions parserOptions_; + + NSError *parserError_; +} + +@property (assign, nonatomic) __weak id delegate; +@property (readonly, retain, nonatomic) NSError *parserError; +@property (readonly, nonatomic) YAJLParserOptions parserOptions; + +/*! + Create parser with data and options. + @param parserOptions Parser options + - YAJLParserOptionsNone: No options + - YAJLParserOptionsAllowComments: Javascript style comments will be allowed in the input (both /&asterisk; &asterisk;/ and //) + - YAJLParserOptionsCheckUTF8: Invalid UTF8 strings will cause a parse error + - YAJLParserOptionsStrictPrecision: If YES will force strict precision and return integer overflow error + */ +- (id)initWithParserOptions:(YAJLParserOptions)parserOptions; + +/*! + Parse data. + + If streaming, you can call parse multiple times as long as + previous calls return YAJLParserStatusInsufficientData. + + @param data + @result Parser status + - YAJLParserStatusNone: No status + - YAJLParserStatusOK: Parsed OK + - YAJLParserStatusInsufficientData: There was insufficient data + - YAJLParserStatusError: Parser errored + */ +- (YAJLParserStatus)parse:(NSData *)data; + +@end diff --git a/vendor/YAJL.framework/Versions/A/Headers/yajl_common.h b/vendor/YAJL.framework/Versions/A/Headers/yajl_common.h new file mode 100644 index 0000000..a227deb --- /dev/null +++ b/vendor/YAJL.framework/Versions/A/Headers/yajl_common.h @@ -0,0 +1,85 @@ +/* + * Copyright 2010, Lloyd Hilaiel. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. Neither the name of Lloyd Hilaiel 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 AUTHOR ``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 AUTHOR 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. + */ + +#ifndef __YAJL_COMMON_H__ +#define __YAJL_COMMON_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define YAJL_MAX_DEPTH 128 + +/* msft dll export gunk. To build a DLL on windows, you + * must define WIN32, YAJL_SHARED, and YAJL_BUILD. To use a shared + * DLL, you must define YAJL_SHARED and WIN32 */ +#if defined(WIN32) && defined(YAJL_SHARED) +# ifdef YAJL_BUILD +# define YAJL_API __declspec(dllexport) +# else +# define YAJL_API __declspec(dllimport) +# endif +#else +# define YAJL_API +#endif + +/** pointer to a malloc function, supporting client overriding memory + * allocation routines */ +typedef void * (*yajl_malloc_func)(void *ctx, unsigned int sz); + +/** pointer to a free function, supporting client overriding memory + * allocation routines */ +typedef void (*yajl_free_func)(void *ctx, void * ptr); + +/** pointer to a realloc function which can resize an allocation. */ +typedef void * (*yajl_realloc_func)(void *ctx, void * ptr, unsigned int sz); + +/** A structure which can be passed to yajl_*_alloc routines to allow the + * client to specify memory allocation functions to be used. */ +typedef struct +{ + /** pointer to a function that can allocate uninitialized memory */ + yajl_malloc_func malloc; + /** pointer to a function that can resize memory allocations */ + yajl_realloc_func realloc; + /** pointer to a function that can free memory allocated using + * reallocFunction or mallocFunction */ + yajl_free_func free; + /** a context pointer that will be passed to above allocation routines */ + void * ctx; +} yajl_alloc_funcs; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/vendor/YAJL.framework/Versions/A/Headers/yajl_gen.h b/vendor/YAJL.framework/Versions/A/Headers/yajl_gen.h new file mode 100644 index 0000000..a3fbd4c --- /dev/null +++ b/vendor/YAJL.framework/Versions/A/Headers/yajl_gen.h @@ -0,0 +1,159 @@ +/* + * Copyright 2010, Lloyd Hilaiel. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. Neither the name of Lloyd Hilaiel 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 AUTHOR ``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 AUTHOR 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. + */ + +/** + * \file yajl_gen.h + * Interface to YAJL's JSON generation facilities. + */ + +#include + +#ifndef __YAJL_GEN_H__ +#define __YAJL_GEN_H__ + +#ifdef __cplusplus +extern "C" { +#endif + /** generator status codes */ + typedef enum { + /** no error */ + yajl_gen_status_ok = 0, + /** at a point where a map key is generated, a function other than + * yajl_gen_string was called */ + yajl_gen_keys_must_be_strings, + /** YAJL's maximum generation depth was exceeded. see + * YAJL_MAX_DEPTH */ + yajl_max_depth_exceeded, + /** A generator function (yajl_gen_XXX) was called while in an error + * state */ + yajl_gen_in_error_state, + /** A complete JSON document has been generated */ + yajl_gen_generation_complete, + /** yajl_gen_double was passed an invalid floating point value + * (infinity or NaN). */ + yajl_gen_invalid_number, + /** A print callback was passed in, so there is no internal + * buffer to get from */ + yajl_gen_no_buf + } yajl_gen_status; + + /** an opaque handle to a generator */ + typedef struct yajl_gen_t * yajl_gen; + + /** a callback used for "printing" the results. */ + typedef void (*yajl_print_t)(void * ctx, + const char * str, + unsigned int len); + + /** configuration structure for the generator */ + typedef struct { + /** generate indented (beautiful) output */ + unsigned int beautify; + /** an opportunity to define an indent string. such as \\t or + * some number of spaces. default is four spaces ' '. This + * member is only relevant when beautify is true */ + const char * indentString; + } yajl_gen_config; + + /** allocate a generator handle + * \param config a pointer to a structure containing parameters which + * configure the behavior of the json generator + * \param allocFuncs an optional pointer to a structure which allows + * the client to overide the memory allocation + * used by yajl. May be NULL, in which case + * malloc/free/realloc will be used. + * + * \returns an allocated handle on success, NULL on failure (bad params) + */ + YAJL_API yajl_gen yajl_gen_alloc(const yajl_gen_config * config, + const yajl_alloc_funcs * allocFuncs); + + /** allocate a generator handle that will print to the specified + * callback rather than storing the results in an internal buffer. + * \param callback a pointer to a printer function. May be NULL + * in which case, the results will be store in an + * internal buffer. + * \param config a pointer to a structure containing parameters + * which configure the behavior of the json + * generator. + * \param allocFuncs an optional pointer to a structure which allows + * the client to overide the memory allocation + * used by yajl. May be NULL, in which case + * malloc/free/realloc will be used. + * \param ctx a context pointer that will be passed to the + * printer callback. + * + * \returns an allocated handle on success, NULL on failure (bad params) + */ + YAJL_API yajl_gen yajl_gen_alloc2(const yajl_print_t callback, + const yajl_gen_config * config, + const yajl_alloc_funcs * allocFuncs, + void * ctx); + + /** free a generator handle */ + YAJL_API void yajl_gen_free(yajl_gen handle); + + YAJL_API yajl_gen_status yajl_gen_integer(yajl_gen hand, long int number); + /** generate a floating point number. number may not be infinity or + * NaN, as these have no representation in JSON. In these cases the + * generator will return 'yajl_gen_invalid_number' */ + YAJL_API yajl_gen_status yajl_gen_double(yajl_gen hand, double number); + YAJL_API yajl_gen_status yajl_gen_number(yajl_gen hand, + const char * num, + unsigned int len); + YAJL_API yajl_gen_status yajl_gen_string(yajl_gen hand, + const unsigned char * str, + unsigned int len); + YAJL_API yajl_gen_status yajl_gen_null(yajl_gen hand); + YAJL_API yajl_gen_status yajl_gen_bool(yajl_gen hand, int boolean); + YAJL_API yajl_gen_status yajl_gen_map_open(yajl_gen hand); + YAJL_API yajl_gen_status yajl_gen_map_close(yajl_gen hand); + YAJL_API yajl_gen_status yajl_gen_array_open(yajl_gen hand); + YAJL_API yajl_gen_status yajl_gen_array_close(yajl_gen hand); + + /** access the null terminated generator buffer. If incrementally + * outputing JSON, one should call yajl_gen_clear to clear the + * buffer. This allows stream generation. */ + YAJL_API yajl_gen_status yajl_gen_get_buf(yajl_gen hand, + const unsigned char ** buf, + unsigned int * len); + + /** clear yajl's output buffer, but maintain all internal generation + * state. This function will not "reset" the generator state, and is + * intended to enable incremental JSON outputing. */ + YAJL_API void yajl_gen_clear(yajl_gen hand); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/vendor/YAJL.framework/Versions/A/Headers/yajl_parse.h b/vendor/YAJL.framework/Versions/A/Headers/yajl_parse.h new file mode 100644 index 0000000..1cbd930 --- /dev/null +++ b/vendor/YAJL.framework/Versions/A/Headers/yajl_parse.h @@ -0,0 +1,193 @@ +/* + * Copyright 2010, Lloyd Hilaiel. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. 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. + * + * 3. Neither the name of Lloyd Hilaiel 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 AUTHOR ``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 AUTHOR 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. + */ + +/** + * \file yajl_parse.h + * Interface to YAJL's JSON parsing facilities. + */ + +#include + +#ifndef __YAJL_PARSE_H__ +#define __YAJL_PARSE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + /** error codes returned from this interface */ + typedef enum { + /** no error was encountered */ + yajl_status_ok, + /** a client callback returned zero, stopping the parse */ + yajl_status_client_canceled, + /** The parse cannot yet complete because more json input text + * is required, call yajl_parse with the next buffer of input text. + * (pertinent only when stream parsing) */ + yajl_status_insufficient_data, + /** An error occured during the parse. Call yajl_get_error for + * more information about the encountered error */ + yajl_status_error + } yajl_status; + + /** attain a human readable, english, string for an error */ + YAJL_API const char * yajl_status_to_string(yajl_status code); + + /** an opaque handle to a parser */ + typedef struct yajl_handle_t * yajl_handle; + + /** yajl is an event driven parser. this means as json elements are + * parsed, you are called back to do something with the data. The + * functions in this table indicate the various events for which + * you will be called back. Each callback accepts a "context" + * pointer, this is a void * that is passed into the yajl_parse + * function which the client code may use to pass around context. + * + * All callbacks return an integer. If non-zero, the parse will + * continue. If zero, the parse will be canceled and + * yajl_status_client_canceled will be returned from the parse. + * + * Note about handling of numbers: + * yajl will only convert numbers that can be represented in a double + * or a long int. All other numbers will be passed to the client + * in string form using the yajl_number callback. Furthermore, if + * yajl_number is not NULL, it will always be used to return numbers, + * that is yajl_integer and yajl_double will be ignored. If + * yajl_number is NULL but one of yajl_integer or yajl_double are + * defined, parsing of a number larger than is representable + * in a double or long int will result in a parse error. + */ + typedef struct { + int (* yajl_null)(void * ctx); + int (* yajl_boolean)(void * ctx, int boolVal); + int (* yajl_integer)(void * ctx, long integerVal); + int (* yajl_double)(void * ctx, double doubleVal); + /** A callback which passes the string representation of the number + * back to the client. Will be used for all numbers when present */ + int (* yajl_number)(void * ctx, const char * numberVal, + unsigned int numberLen); + + /** strings are returned as pointers into the JSON text when, + * possible, as a result, they are _not_ null padded */ + int (* yajl_string)(void * ctx, const unsigned char * stringVal, + unsigned int stringLen); + + int (* yajl_start_map)(void * ctx); + int (* yajl_map_key)(void * ctx, const unsigned char * key, + unsigned int stringLen); + int (* yajl_end_map)(void * ctx); + + int (* yajl_start_array)(void * ctx); + int (* yajl_end_array)(void * ctx); + } yajl_callbacks; + + /** configuration structure for the generator */ + typedef struct { + /** if nonzero, javascript style comments will be allowed in + * the json input, both slash star and slash slash */ + unsigned int allowComments; + /** if nonzero, invalid UTF8 strings will cause a parse + * error */ + unsigned int checkUTF8; + } yajl_parser_config; + + /** allocate a parser handle + * \param callbacks a yajl callbacks structure specifying the + * functions to call when different JSON entities + * are encountered in the input text. May be NULL, + * which is only useful for validation. + * \param config configuration parameters for the parse. + * \param ctx a context pointer that will be passed to callbacks. + */ + YAJL_API yajl_handle yajl_alloc(const yajl_callbacks * callbacks, + const yajl_parser_config * config, + const yajl_alloc_funcs * allocFuncs, + void * ctx); + + /** free a parser handle */ + YAJL_API void yajl_free(yajl_handle handle); + + /** Parse some json! + * \param hand - a handle to the json parser allocated with yajl_alloc + * \param jsonText - a pointer to the UTF8 json text to be parsed + * \param jsonTextLength - the length, in bytes, of input text + */ + YAJL_API yajl_status yajl_parse(yajl_handle hand, + const unsigned char * jsonText, + unsigned int jsonTextLength); + + /** Parse any remaining buffered json. + * Since yajl is a stream-based parser, without an explicit end of + * input, yajl sometimes can't decide if content at the end of the + * stream is valid or not. For example, if "1" has been fed in, + * yajl can't know whether another digit is next or some character + * that would terminate the integer token. + * + * \param hand - a handle to the json parser allocated with yajl_alloc + */ + YAJL_API yajl_status yajl_parse_complete(yajl_handle hand); + + /** get an error string describing the state of the + * parse. + * + * If verbose is non-zero, the message will include the JSON + * text where the error occured, along with an arrow pointing to + * the specific char. + * + * \returns A dynamically allocated string will be returned which should + * be freed with yajl_free_error + */ + YAJL_API unsigned char * yajl_get_error(yajl_handle hand, int verbose, + const unsigned char * jsonText, + unsigned int jsonTextLength); + + /** + * get the amount of data consumed from the last chunk passed to YAJL. + * + * In the case of a successful parse this can help you understand if + * the entire buffer was consumed (which will allow you to handle + * "junk at end of input". + * + * In the event an error is encountered during parsing, this function + * affords the client a way to get the offset into the most recent + * chunk where the error occured. 0 will be returned if no error + * was encountered. + */ + YAJL_API unsigned int yajl_get_bytes_consumed(yajl_handle hand); + + /** free an error returned from yajl_get_error */ + YAJL_API void yajl_free_error(yajl_handle hand, unsigned char * str); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/vendor/YAJL.framework/Versions/A/Headers/yajl_version.h b/vendor/YAJL.framework/Versions/A/Headers/yajl_version.h new file mode 100644 index 0000000..e3e8d09 --- /dev/null +++ b/vendor/YAJL.framework/Versions/A/Headers/yajl_version.h @@ -0,0 +1,23 @@ +#ifndef YAJL_VERSION_H_ +#define YAJL_VERSION_H_ + +#include + +#define YAJL_MAJOR 1 +#define YAJL_MINOR 0 +#define YAJL_MICRO 11 + +#define YAJL_VERSION ((YAJL_MAJOR * 10000) + (YAJL_MINOR * 100) + YAJL_MICRO) + +#ifdef __cplusplus +extern "C" { +#endif + +extern int YAJL_API yajl_version(void); + +#ifdef __cplusplus +} +#endif + +#endif /* YAJL_VERSION_H_ */ + diff --git a/vendor/YAJL.framework/Versions/A/Resources/Info.plist b/vendor/YAJL.framework/Versions/A/Resources/Info.plist new file mode 100644 index 0000000..ffb8c5c --- /dev/null +++ b/vendor/YAJL.framework/Versions/A/Resources/Info.plist @@ -0,0 +1,18 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + me.rel.yajl + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + $(YAJL_VERSION) + + diff --git a/vendor/YAJL.framework/Versions/A/YAJL b/vendor/YAJL.framework/Versions/A/YAJL new file mode 100644 index 0000000..a59a3a8 Binary files /dev/null and b/vendor/YAJL.framework/Versions/A/YAJL differ diff --git a/vendor/YAJL.framework/Versions/Current b/vendor/YAJL.framework/Versions/Current new file mode 120000 index 0000000..8c7e5a6 --- /dev/null +++ b/vendor/YAJL.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/vendor/YAJL.framework/YAJL b/vendor/YAJL.framework/YAJL new file mode 120000 index 0000000..faa10c2 --- /dev/null +++ b/vendor/YAJL.framework/YAJL @@ -0,0 +1 @@ +Versions/Current/YAJL \ No newline at end of file