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 "YAJLParser.h"
00032
00033 typedef enum {
00034 YAJLDecoderCurrentTypeNone,
00035 YAJLDecoderCurrentTypeArray,
00036 YAJLDecoderCurrentTypeDict
00037 } YAJLDecoderCurrentType;
00038
00039 extern NSInteger YAJLDocumentStackCapacity;
00040
00041 @class YAJLDocument;
00042
00046 @protocol YAJLDocumentDelegate <NSObject>
00047 @optional
00053 - (void)document:(YAJLDocument *)document didAddDictionary:(NSDictionary *)dict;
00054
00060 - (void)document:(YAJLDocument *)document didAddArray:(NSArray *)array;
00061
00068 - (void)document:(YAJLDocument *)document didAddObject:(id)object toArray:(NSArray *)array;
00069
00077 - (void)document:(YAJLDocument *)document didSetObject:(id)object forKey:(id)key inDictionary:(NSDictionary *)dict;
00078 @end
00079
00113 @interface YAJLDocument : NSObject <YAJLParserDelegate> {
00114
00115 id root_;
00116 YAJLParser *parser_;
00117
00118
00119 id<YAJLDocumentDelegate> delegate_;
00120
00121 __weak NSMutableDictionary *dict_;
00122 __weak NSMutableArray *array_;
00123 __weak NSString *key_;
00124
00125 NSMutableArray *stack_;
00126 NSMutableArray *keyStack_;
00127
00128 YAJLDecoderCurrentType currentType_;
00129
00130 YAJLParserStatus parserStatus_;
00131
00132 }
00133
00134 @property (readonly, nonatomic) id root;
00135 @property (readonly, nonatomic) YAJLParserStatus parserStatus;
00136 @property (assign, nonatomic) id<YAJLDocumentDelegate> delegate;
00137
00148 - (id)initWithData:(NSData *)data parserOptions:(YAJLParserOptions)parserOptions error:(NSError **)error;
00149
00161 - (id)initWithData:(NSData *)data parserOptions:(YAJLParserOptions)parserOptions capacity:(NSInteger)capacity error:(NSError **)error;
00162
00171 - (id)initWithParserOptions:(YAJLParserOptions)parserOptions;
00172
00182 - (id)initWithParserOptions:(YAJLParserOptions)parserOptions capacity:(NSInteger)capacity;
00183
00194 - (YAJLParserStatus)parse:(NSData *)data error:(NSError **)error;
00195
00196 @end