UNICORN - iOS
SBJsonStreamParserAdapter.h
1 /*
2  Copyright (c) 2010, Stig Brautaset.
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions are
7  met:
8 
9  Redistributions of source code must retain the above copyright
10  notice, this list of conditions and the following disclaimer.
11 
12  Redistributions in binary form must reproduce the above copyright
13  notice, this list of conditions and the following disclaimer in the
14  documentation and/or other materials provided with the distribution.
15 
16  Neither the name of the the author nor the names of its contributors
17  may be used to endorse or promote products derived from this software
18  without specific prior written permission.
19 
20  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
23  PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #import <Foundation/Foundation.h>
34 #import "SBJsonStreamParser.h"
35 
36 typedef enum {
37  SBJsonStreamParserAdapterNone,
38  SBJsonStreamParserAdapterArray,
39  SBJsonStreamParserAdapterObject,
40 } SBJsonStreamParserAdapterType;
41 
48 
55 - (void)parser:(SBJsonStreamParser*)parser foundArray:(NSArray*)array;
56 
62 - (void)parser:(SBJsonStreamParser*)parser foundObject:(NSDictionary*)dict;
63 
64 @end
65 
120 @private
121  NSUInteger depth;
122  NSMutableArray *array;
123  NSMutableDictionary *dict;
124  NSMutableArray *keyStack;
125  NSMutableArray *stack;
126 
127  SBJsonStreamParserAdapterType currentType;
128 }
129 
140 @property NSUInteger levelsToSkip;
141 
146 @property (unsafe_unretained) id<SBJsonStreamParserAdapterDelegate> delegate;
147 
148 @end
Delegate for getting objects & arrays from the stream parser adapter.
Definition: SBJsonStreamParserAdapter.h:47
Parse a stream of JSON data.
Definition: SBJsonStreamParser.h:100
SBJsonStreamParserDelegate protocol adapter.
Definition: SBJsonStreamParserAdapter.h:119
NSUInteger levelsToSkip
How many levels to skip.
Definition: SBJsonStreamParserAdapter.h:140
Delegate for interacting directly with the stream parser.
Definition: SBJsonStreamParser.h:52