Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 61 lines (50 sloc) 1.666 kb
fbfc444 First pass at adding JSON support with YAJL.
Craig Hockenberry authored
1 //
2 // MGTwitterYAJLParser.h
3 // MGTwitterEngine
4 //
5 // Created by Matt Gemmell on 18/02/2008.
6 // Copyright 2008 Instinctive Code.
7 //
8
9 #import "MGTwitterEngineGlobalHeader.h"
fd65d2c Added delegate callback for each parsed object.
Craig Hockenberry authored
10
e946027 @stevestreza Added my MGTwitterEngine changes for 64-bit integers
stevestreza authored
11 //#include <yajl/yajl_parse.h>
12 #import "yajl_parse.h"
fbfc444 First pass at adding JSON support with YAJL.
Craig Hockenberry authored
13
14 #import "MGTwitterParserDelegate.h"
fe716cd Added delivery options for delegate callbacks.
Craig Hockenberry authored
15 #import "MGTwitterEngineDelegate.h"
fbfc444 First pass at adding JSON support with YAJL.
Craig Hockenberry authored
16
17 @interface MGTwitterYAJLParser : NSObject {
18 __weak NSObject <MGTwitterParserDelegate> *delegate; // weak ref
19 NSString *identifier;
20 MGTwitterRequestType requestType;
21 MGTwitterResponseType responseType;
22 NSURL *URL;
23 NSData *json;
24 NSMutableArray *parsedObjects;
fe716cd Added delivery options for delegate callbacks.
Craig Hockenberry authored
25 MGTwitterEngineDeliveryOptions deliveryOptions;
fbfc444 First pass at adding JSON support with YAJL.
Craig Hockenberry authored
26
27 yajl_handle _handle;
22c17d0 @stevestreza Fix for #9, YAJL parser handles double values and recursive arrays
stevestreza authored
28 NSUInteger arrayDepth;
fbfc444 First pass at adding JSON support with YAJL.
Craig Hockenberry authored
29 }
30
fe716cd Added delivery options for delegate callbacks.
Craig Hockenberry authored
31 + (id)parserWithJSON:(NSData *)theJSON
32 delegate:(NSObject *)theDelegate
33 connectionIdentifier:(NSString *)identifier
34 requestType:(MGTwitterRequestType)reqType
35 responseType:(MGTwitterResponseType)respType
36 URL:(NSURL *)URL
37 deliveryOptions:(MGTwitterEngineDeliveryOptions)deliveryOptions;
38 - (id)initWithJSON:(NSData *)theJSON
39 delegate:(NSObject *)theDelegate
40 connectionIdentifier:(NSString *)identifier
41 requestType:(MGTwitterRequestType)reqType
42 responseType:(MGTwitterResponseType)respType
43 URL:(NSURL *)URL
44 deliveryOptions:(MGTwitterEngineDeliveryOptions)deliveryOptions;
fbfc444 First pass at adding JSON support with YAJL.
Craig Hockenberry authored
45
46 // subclass utilities
a40780d Started work on YAJL callbacks to instantiate objects.
Craig Hockenberry authored
47 - (void)addValue:(id)value forKey:(NSString *)key;
48 - (void)addValue:(id)value forKey:(NSString *)key;
49 - (void)startDictionaryWithKey:(NSString *)key;
ff9733a Finished parsing code with YAJL: status, message, user and misc resul…
Craig Hockenberry authored
50 - (void)endDictionary;
a40780d Started work on YAJL callbacks to instantiate objects.
Craig Hockenberry authored
51 - (void)startArrayWithKey:(NSString *)key;
ff9733a Finished parsing code with YAJL: status, message, user and misc resul…
Craig Hockenberry authored
52 - (void)endArray;
fbfc444 First pass at adding JSON support with YAJL.
Craig Hockenberry authored
53
54 // delegate callbacks
55 - (void)_parsingDidEnd;
56 - (void)_parsingErrorOccurred:(NSError *)parseError;
fd65d2c Added delegate callback for each parsed object.
Craig Hockenberry authored
57 - (void)_parsedObject:(NSDictionary *)dictionary;
fbfc444 First pass at adding JSON support with YAJL.
Craig Hockenberry authored
58
59
60 @end
Something went wrong with that request. Please try again.