Permalink
Browse files

Fixing iOS build. Sharing same header file so import is now import

<YAJL/YAJL.h> for mac and iOS. Updating docs.
  • Loading branch information...
1 parent b61cbbb commit ce4446261914e180f45359d4f4526bffb273fcb0 @gabriel committed Nov 2, 2010
Showing with 3,007 additions and 1,624 deletions.
  1. +4 −0 CHANGELOG.md
  2. +1 −7 Classes/YAJL.h
  3. +15 −3 Example/TestApp/Frameworks/YAJL.framework/Versions/A/Headers/NSBundle+YAJL.h
  4. +40 −4 Example/TestApp/Frameworks/YAJL.framework/Versions/A/Headers/NSObject+YAJL.h
  5. +143 −0 Example/TestApp/Frameworks/YAJL.framework/Versions/A/Headers/YAJL.h
  6. +78 −4 Example/TestApp/Frameworks/YAJL.framework/Versions/A/Headers/YAJLDocument.h
  7. +80 −13 Example/TestApp/Frameworks/YAJL.framework/Versions/A/Headers/YAJLGen.h
  8. +88 −36 Example/TestApp/Frameworks/YAJL.framework/Versions/A/Headers/YAJLParser.h
  9. +1 −1 Example/TestApp/Frameworks/YAJL.framework/Versions/A/Headers/yajl_gen.h
  10. +1 −1 Example/TestApp/Frameworks/YAJL.framework/Versions/A/Headers/yajl_parse.h
  11. +23 −0 Example/TestApp/Frameworks/YAJL.framework/Versions/A/Headers/yajl_version.h
  12. +0 −83 Example/TestApp/Frameworks/YAJL.framework/Versions/A/Resources/CMakeLists.txt
  13. +1 −1 Example/TestApp/Frameworks/YAJL.framework/Versions/A/Resources/Info.plist
  14. +0 −1,258 Example/TestApp/Frameworks/YAJL.framework/Versions/A/Resources/YAJL.dxy
  15. +0 −196 Example/TestApp/Frameworks/YAJL.framework/Versions/A/Resources/yajl
  16. BIN Example/TestApp/Frameworks/YAJL.framework/Versions/A/YAJL
  17. +22 −0 Example/TestAppIOS/Classes/TestAppIOSAppDelegate.h
  18. +91 −0 Example/TestAppIOS/Classes/TestAppIOSAppDelegate.m
  19. +16 −0 Example/TestAppIOS/Classes/TestAppIOSViewController.h
  20. +65 −0 Example/TestAppIOS/Classes/TestAppIOSViewController.m
  21. +1 −0 Example/TestAppIOS/Frameworks/YAJL.framework/Headers
  22. +1 −0 Example/TestAppIOS/Frameworks/YAJL.framework/Resources
  23. +33 −5 Classes/YAJLIOS.h → Example/TestAppIOS/Frameworks/YAJL.framework/Versions/A/Headers/NSBundle+YAJL.h
  24. +154 −0 Example/TestAppIOS/Frameworks/YAJL.framework/Versions/A/Headers/NSObject+YAJL.h
  25. +209 −0 Example/TestAppIOS/Frameworks/YAJL.framework/Versions/A/Headers/YAJL.h
  26. +172 −0 Example/TestAppIOS/Frameworks/YAJL.framework/Versions/A/Headers/YAJLDocument.h
  27. +171 −0 Example/TestAppIOS/Frameworks/YAJL.framework/Versions/A/Headers/YAJLGen.h
  28. +181 −0 Example/TestAppIOS/Frameworks/YAJL.framework/Versions/A/Headers/YAJLParser.h
  29. +85 −0 Example/TestAppIOS/Frameworks/YAJL.framework/Versions/A/Headers/yajl_common.h
  30. +159 −0 Example/TestAppIOS/Frameworks/YAJL.framework/Versions/A/Headers/yajl_gen.h
  31. +193 −0 Example/TestAppIOS/Frameworks/YAJL.framework/Versions/A/Headers/yajl_parse.h
  32. +23 −0 Example/TestAppIOS/Frameworks/YAJL.framework/Versions/A/Headers/yajl_version.h
  33. +18 −0 Example/TestAppIOS/Frameworks/YAJL.framework/Versions/A/Resources/Info.plist
  34. BIN Example/TestAppIOS/Frameworks/YAJL.framework/Versions/A/YAJL
  35. +1 −0 Example/TestAppIOS/Frameworks/YAJL.framework/Versions/Current
  36. +1 −0 Example/TestAppIOS/Frameworks/YAJL.framework/YAJL
  37. +444 −0 Example/TestAppIOS/MainWindow.xib
  38. +30 −0 Example/TestAppIOS/TestAppIOS-Info.plist
  39. +274 −0 Example/TestAppIOS/TestAppIOS.xcodeproj/project.pbxproj
  40. +156 −0 Example/TestAppIOS/TestAppIOSViewController.xib
  41. +8 −0 Example/TestAppIOS/TestAppIOS_Prefix.pch
  42. +17 −0 Example/TestAppIOS/main.m
  43. +0 −6 Project-IPhone/YAJLIPhone.xcodeproj/project.pbxproj
  44. +5 −4 README.md
  45. +1 −1 Scripts/iPhoneFramework.sh
  46. +1 −1 XCConfig/Shared.xcconfig
View
@@ -1,3 +1,7 @@
+== 0.2.25
+
+- Fixing YAJL (iOS) build.
+
== 0.2.22
- Fixing YAJL (Mac OSX) build.
View
@@ -48,13 +48,7 @@
@section Usage Usage
- To use the framework (for iOS):
-
- @code
- #import <YAJLIOS/YAJLIOS.h>
- @endcode
-
- To use the framework (for Mac OS X):
+ To use the framework (for Mac OS X or iOS):
@code
#import <YAJL/YAJL.h>
@@ -29,19 +29,31 @@
#import "YAJLParser.h"
-@interface NSBundle (YAJL)
+/*!
+ Utilities for loading JSON from resource bundles.
+
+ @code
+ id JSONValue = [[NSBundle mainBundle] yajl_JSONFromResource:@"kegs.json"];
+ @endcode
+ */
+@interface NSBundle(YAJL)
/*!
- Load JSON from bundle.
- Throws an YAJLParserException on parse error.
+ 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
*/
@@ -30,15 +30,41 @@
#import "YAJLGen.h"
#import "YAJLParser.h"
-@interface NSObject (YAJL)
+/*!
+ 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
- Otherwise throws YAJLGenInvalidObjectException.
+ @throws YAJLGenInvalidObjectException If object is invalid
@result JSON String
*/
- (NSString *)yajl_JSONString;
@@ -47,8 +73,13 @@
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
- Otherwise throws YAJLGenInvalidObjectException.
+ @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
*/
@@ -99,7 +130,12 @@
If an error occurs, the returned object will be the current state of the object when
the error occurred.
- @param options Options (see YAJLParserOptions)
+ @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
@@ -32,3 +32,146 @@
#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 Usage Usage
+
+ To parse JSON from an NSData (or NSString):
+
+ @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
+
+ To generate JSON from an object:
+
+ @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:@" "];
+
+ To use the streaming (or SAX style) parser, use YAJLParser. For higher level (document) streaming, see below.
+
+ 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 StreamingExample Streaming Example (Parser)
+
+ @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) ...;
+
+ // Another chunk of data comes...
+ YAJLParserStatus status = [parser parse:chunk2];
+ // 'status' should be YAJLParserStatusOK if its finished
+ if (parser.parserError) ...;
+ @encode
+
+ @subsection UsageDocument Usage (Document-style)
+
+ 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 StreamingExampleDocument Streaming Example (Document)
+
+ @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
+
+ @section LoadJSONBundle 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 <tt>- (id)JSON;</tt>
+
+ For example:
+
+ @code
+ @interface CustomObject : NSObject
+ @end
+
+ @implementation CustomObject
+
+ - (id)JSON {
+ return [NSArray arrayWithObject:[NSNumber numberWithInteger:1]];
+ }
+
+ @end
+ @endcode
+
+ */
Oops, something went wrong.

0 comments on commit ce44462

Please sign in to comment.