Playlist Generator
1.0
|
00001 /* 00002 Copyright (c) 2010, Stig Brautaset. 00003 All rights reserved. 00004 00005 Redistribution and use in source and binary forms, with or without 00006 modification, are permitted provided that the following conditions are 00007 met: 00008 00009 Redistributions of source code must retain the above copyright 00010 notice, this list of conditions and the following disclaimer. 00011 00012 Redistributions in binary form must reproduce the above copyright 00013 notice, this list of conditions and the following disclaimer in the 00014 documentation and/or other materials provided with the distribution. 00015 00016 Neither the name of the the author nor the names of its contributors 00017 may be used to endorse or promote products derived from this software 00018 without specific prior written permission. 00019 00020 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 00021 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00022 TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00023 PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00024 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00025 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00026 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00027 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00028 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00029 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00030 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00031 */ 00032 00033 #import <Foundation/Foundation.h> 00034 00035 @class SBJsonTokeniser; 00036 @class SBJsonStreamParser; 00037 @class SBJsonStreamParserState; 00038 00039 typedef enum { 00040 SBJsonStreamParserComplete, 00041 SBJsonStreamParserWaitingForData, 00042 SBJsonStreamParserError, 00043 } SBJsonStreamParserStatus; 00044 00045 00052 @protocol SBJsonStreamParserDelegate 00053 00055 - (void)parserFoundObjectStart:(SBJsonStreamParser*)parser; 00056 00058 - (void)parser:(SBJsonStreamParser*)parser foundObjectKey:(NSString*)key; 00059 00061 - (void)parserFoundObjectEnd:(SBJsonStreamParser*)parser; 00062 00064 - (void)parserFoundArrayStart:(SBJsonStreamParser*)parser; 00065 00067 - (void)parserFoundArrayEnd:(SBJsonStreamParser*)parser; 00068 00070 - (void)parser:(SBJsonStreamParser*)parser foundBoolean:(BOOL)x; 00071 00073 - (void)parserFoundNull:(SBJsonStreamParser*)parser; 00074 00076 - (void)parser:(SBJsonStreamParser*)parser foundNumber:(NSNumber*)num; 00077 00079 - (void)parser:(SBJsonStreamParser*)parser foundString:(NSString*)string; 00080 00081 @end 00082 00083 00100 @interface SBJsonStreamParser : NSObject { 00101 @private 00102 SBJsonTokeniser *tokeniser; 00103 } 00104 00105 @property (nonatomic, unsafe_unretained) SBJsonStreamParserState *state; // Private 00106 @property (nonatomic, readonly, strong) NSMutableArray *stateStack; // Private 00107 00120 @property BOOL supportMultipleDocuments; 00121 00132 @property (unsafe_unretained) id<SBJsonStreamParserDelegate> delegate; 00133 00141 @property NSUInteger maxDepth; 00142 00144 @property (copy) NSString *error; 00145 00159 - (SBJsonStreamParserStatus)parse:(NSData*)data; 00160 00161 @end