Overview
Comment: | Add -[parseStream] to OFXMLParser. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
964b6c41f0df12b6b937c59088b73db3 |
User & Date: | js on 2010-12-09 19:19:52 |
Other Links: | manifest | tags |
Context
2010-12-09
| ||
19:40 | Add -[finishedParsing] to OFXMLParser. check-in: 58a72fc69b user: js tags: trunk | |
19:19 | Add -[parseStream] to OFXMLParser. check-in: 964b6c41f0 user: js tags: trunk | |
19:04 | Move -[setBlocking] to OFStream. check-in: beb4a0d036 user: js tags: trunk | |
Changes
Modified src/OFXMLParser.h from [009e03e7ac] to [58cfc81be7].
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #import "OFObject.h" #import "OFString.h" #import "OFXMLAttribute.h" @class OFXMLParser; @class OFArray; @class OFMutableArray; #if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) typedef void (^of_xml_parser_processing_instructions_block_t)( OFXMLParser *parser, OFString *pi); typedef void (^of_xml_parser_element_start_block_t)(OFXMLParser *parser, OFString *name, OFString *prefix, OFString *ns, OFArray *attrs); typedef void (^of_xml_parser_element_end_block_t)(OFXMLParser *parser, | > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #import "OFObject.h" #import "OFString.h" #import "OFXMLAttribute.h" @class OFXMLParser; @class OFArray; @class OFMutableArray; @class OFStream; #if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) typedef void (^of_xml_parser_processing_instructions_block_t)( OFXMLParser *parser, OFString *pi); typedef void (^of_xml_parser_element_start_block_t)(OFXMLParser *parser, OFString *name, OFString *prefix, OFString *ns, OFArray *attrs); typedef void (^of_xml_parser_element_end_block_t)(OFXMLParser *parser, |
︙ | ︙ | |||
298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | /** * Parses the specified string. * * \param str The string to parse */ - (void)parseString: (OFString*)str; /** * Parses the specified file. * * \param path The path to the file to parse */ - (void)parseFile: (OFString*)path; @end @interface OFObject (OFXMLParserDelegate) <OFXMLParserDelegate> @end | > > > > > > > | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | /** * Parses the specified string. * * \param str The string to parse */ - (void)parseString: (OFString*)str; /** * Parses the specified stream. * * \param stream The stream to parse */ - (void)parseStream: (OFStream*)stream; /** * Parses the specified file. * * \param path The path to the file to parse */ - (void)parseFile: (OFString*)path; @end @interface OFObject (OFXMLParserDelegate) <OFXMLParserDelegate> @end |
Modified src/OFXMLParser.m from [d31bdbf69b] to [e24ed84b06].
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include <unistd.h> #import "OFXMLParser.h" #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFXMLAttribute.h" #import "OFFile.h" #import "OFAutoreleasePool.h" #import "OFExceptions.h" #import "macros.h" typedef void (*state_function)(id, SEL, const char*, size_t*, size_t*); static SEL selectors[OF_XMLPARSER_NUM_STATES]; | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include <unistd.h> #import "OFXMLParser.h" #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFXMLAttribute.h" #import "OFStream.h" #import "OFFile.h" #import "OFAutoreleasePool.h" #import "OFExceptions.h" #import "macros.h" typedef void (*state_function)(id, SEL, const char*, size_t*, size_t*); static SEL selectors[OF_XMLPARSER_NUM_STATES]; |
︙ | ︙ | |||
204 205 206 207 208 209 210 211 212 213 214 215 216 217 | } - (void)parseString: (OFString*)str { [self parseBuffer: [str cString] withSize: [str cStringLength]]; } - (void)parseFile: (OFString*)path { OFFile *file = [[OFFile alloc] initWithPath: path mode: @"rb"]; @try { | > > > > > > > > > > > > > > > > > < < < < < < < < | < < < < < | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | } - (void)parseString: (OFString*)str { [self parseBuffer: [str cString] withSize: [str cStringLength]]; } - (void)parseStream: (OFStream*)stream { char *buf = [self allocMemoryWithSize: of_pagesize]; @try { while (![stream isAtEndOfStream]) { size_t len = [stream readNBytes: of_pagesize intoBuffer: buf]; [self parseBuffer: buf withSize: len]; } } @finally { [self freeMemory: buf]; } } - (void)parseFile: (OFString*)path { OFFile *file = [[OFFile alloc] initWithPath: path mode: @"rb"]; @try { [self parseStream: file]; } @finally { [file release]; } } /* * The following methods handle the different states of the parser. They are |
︙ | ︙ |