00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "yajl_parse.h"
00032
00033
00034 extern NSString *const YAJLErrorDomain;
00035 extern NSString *const YAJLParserException;
00036 extern NSString *const YAJLParsingUnsupportedException;
00037
00038 extern NSString *const YAJLParserValueKey;
00039
00041 enum YAJLParserErrorCode {
00042 YAJLParserErrorCodeAllocError = -1000,
00043 YAJLParserErrorCodeDoubleOverflow = -1001,
00044 YAJLParserErrorCodeIntegerOverflow = -1002
00045 };
00046 typedef NSInteger YAJLParserErrorCode;
00047
00049 enum YAJLParserOptions {
00050 YAJLParserOptionsNone = 0,
00051 YAJLParserOptionsAllowComments = 1 << 0,
00052 YAJLParserOptionsCheckUTF8 = 1 << 1,
00053 YAJLParserOptionsStrictPrecision = 1 << 2,
00054 };
00055 typedef NSUInteger YAJLParserOptions;
00056
00058 enum {
00059 YAJLParserStatusNone = 0,
00060 YAJLParserStatusOK = 1,
00061 YAJLParserStatusInsufficientData = 2,
00062 YAJLParserStatusError = 3
00063 };
00064 typedef NSUInteger YAJLParserStatus;
00065
00066
00067 @class YAJLParser;
00068
00072 @protocol YAJLParserDelegate <NSObject>
00073
00078 - (void)parserDidStartDictionary:(YAJLParser *)parser;
00079
00084 - (void)parserDidEndDictionary:(YAJLParser *)parser;
00085
00090 - (void)parserDidStartArray:(YAJLParser *)parser;
00091
00096 - (void)parserDidEndArray:(YAJLParser *)parser;
00097
00103 - (void)parser:(YAJLParser *)parser didMapKey:(NSString *)key;
00104
00110 - (void)parser:(YAJLParser *)parser didAdd:(id)value;
00111
00112 @end
00113
00141 @interface YAJLParser : NSObject {
00142
00143 yajl_handle handle_;
00144
00145 __weak id <YAJLParserDelegate> delegate_;
00146
00147 YAJLParserOptions parserOptions_;
00148
00149 NSError *parserError_;
00150 }
00151
00152 @property (assign, nonatomic) __weak id <YAJLParserDelegate> delegate;
00153 @property (readonly, retain, nonatomic) NSError *parserError;
00154 @property (readonly, nonatomic) YAJLParserOptions parserOptions;
00155
00164 - (id)initWithParserOptions:(YAJLParserOptions)parserOptions;
00165
00179 - (YAJLParserStatus)parse:(NSData *)data;
00180
00181 @end