Overview
| Comment: | Remove blocks support in OFXMLParser as it was useless. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
9975294bb11f600ef38352e9c1f91a8e |
| User & Date: | js on 2011-09-11 00:09:21 |
| Other Links: | manifest | tags |
Context
|
2011-09-11
| ||
| 01:28 | Fix ObjC++. (check-in: f786163cf8 user: js tags: trunk) | |
| 00:09 | Remove blocks support in OFXMLParser as it was useless. (check-in: 9975294bb1 user: js tags: trunk) | |
| 00:06 | Fix missing @try. (check-in: 6f18cbc1ea user: js tags: trunk) | |
Changes
Modified src/OFXMLParser.h from [dcec4d0e65] to [7d8e91b03c].
| ︙ | ︙ | |||
20 21 22 23 24 25 26 | @class OFXMLParser; @class OFArray; @class OFMutableArray; @class OFDataArray; @class OFStream; | < < < < < < < < < < < < < | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | @class OFXMLParser; @class OFArray; @class OFMutableArray; @class OFDataArray; @class OFStream; /** * \brief A protocol that needs to be implemented by delegates for OFXMLParser. */ #ifndef OF_XML_PARSER_M @protocol OFXMLParserDelegate <OFObject> #else @protocol OFXMLParserDelegate |
| ︙ | ︙ | |||
166 167 168 169 170 171 172 | OFString *prefix; OFMutableArray *namespaces; OFMutableArray *attributes; OFString *attributeName; OFString *attributePrefix; char delimiter; OFMutableArray *previous; | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | OFString *prefix; OFMutableArray *namespaces; OFMutableArray *attributes; OFString *attributeName; OFString *attributePrefix; char delimiter; OFMutableArray *previous; size_t level; BOOL acceptProlog; size_t lineNumber; BOOL lastCarriageReturn; BOOL finishedParsing; of_string_encoding_t encoding; } #ifdef OF_HAVE_PROPERTIES @property (retain) id <OFXMLParserDelegate> delegate; #endif /** * \return A new, autoreleased OFXMLParser */ + parser; /** * \return The delegate that is used by the XML parser */ - (id <OFXMLParserDelegate>)delegate; /** * Sets the delegate the OFXMLParser should use. * * \param delegate The delegate to use */ - (void)setDelegate: (id <OFXMLParserDelegate>)delegate; /** * Parses a buffer with the specified size. * * \param buffer The buffer to parse * \param length The length of the buffer */ - (void)parseBuffer: (const char*)buffer |
| ︙ | ︙ |
Modified src/OFXMLParser.m from [2217f932b7] to [3bdc0c658c].
| ︙ | ︙ | |||
124 125 126 127 128 129 130 | prefix: attributePrefix]; [attribute->ns release]; attribute->ns = [attributeNS retain]; } @implementation OFXMLParser | < < < < < < | 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
prefix: attributePrefix];
[attribute->ns release];
attribute->ns = [attributeNS retain];
}
@implementation OFXMLParser
+ (void)initialize
{
size_t i;
const SEL selectors_[] = {
@selector(_parseOutsideTagWithBuffer:i:last:),
@selector(_parseTagOpenedWithBuffer:i:last:),
|
| ︙ | ︙ | |||
215 216 217 218 219 220 221 | [name release]; [prefix release]; [namespaces release]; [attributes release]; [attributeName release]; [attributePrefix release]; [previous release]; | < < < < < < < < | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
[name release];
[prefix release];
[namespaces release];
[attributes release];
[attributeName release];
[attributePrefix release];
[previous release];
[super dealloc];
}
- (id <OFXMLParserDelegate>)delegate
{
OF_GETTER(delegate, YES)
|
| ︙ | ︙ | |||
330 331 332 333 334 335 336 |
if ([cache count] > 0) {
OFString *characters;
OFAutoreleasePool *pool;
pool = [[OFAutoreleasePool alloc] init];
characters = transform_string(cache, 0, YES, self);
| < < < < < | | | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
if ([cache count] > 0) {
OFString *characters;
OFAutoreleasePool *pool;
pool = [[OFAutoreleasePool alloc] init];
characters = transform_string(cache, 0, YES, self);
[delegate parser: self
foundCharacters: characters];
[pool release];
}
[cache removeNItems: [cache count]];
*last = *i + 1;
|
| ︙ | ︙ | |||
561 562 563 564 565 566 567 | if (prefix != nil && ns == nil) @throw [OFUnboundNamespaceException newWithClass: isa prefix: prefix]; pool2 = [[OFAutoreleasePool alloc] init]; | < < < < < | | | | | < < < < < | | | | | 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 |
if (prefix != nil && ns == nil)
@throw
[OFUnboundNamespaceException newWithClass: isa
prefix: prefix];
pool2 = [[OFAutoreleasePool alloc] init];
[delegate parser: self
didStartElement: name
withPrefix: prefix
namespace: ns
attributes: nil];
if (buffer[*i] == '/') {
[delegate parser: self
didEndElement: name
withPrefix: prefix
namespace: ns];
if ([previous count] == 0)
finishedParsing = YES;
} else
[previous addObject: cacheString];
[pool2 release];
|
| ︙ | ︙ | |||
662 663 664 665 666 667 668 | [cache removeNItems: [cache count]]; ns = namespace_for_prefix(prefix, namespaces); if (prefix != nil && ns == nil) @throw [OFUnboundNamespaceException newWithClass: isa prefix: prefix]; | < < < < < | | | | | 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 | [cache removeNItems: [cache count]]; ns = namespace_for_prefix(prefix, namespaces); if (prefix != nil && ns == nil) @throw [OFUnboundNamespaceException newWithClass: isa prefix: prefix]; [delegate parser: self didEndElement: name withPrefix: prefix namespace: ns]; [pool release]; [namespaces removeLastObject]; [name release]; [prefix release]; name = prefix = nil; |
| ︙ | ︙ | |||
725 726 727 728 729 730 731 | for (j = 0; j < attributesCount; j++) resolve_attribute_namespace(attributesCArray[j], namespaces, isa); pool = [[OFAutoreleasePool alloc] init]; | < < < < < | | | | | < < < < < | | | | | 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 |
for (j = 0; j < attributesCount; j++)
resolve_attribute_namespace(attributesCArray[j], namespaces,
isa);
pool = [[OFAutoreleasePool alloc] init];
[delegate parser: self
didStartElement: name
withPrefix: prefix
namespace: ns
attributes: attributes];
if (buffer[*i] == '/') {
[delegate parser: self
didEndElement: name
withPrefix: prefix
namespace: ns];
if ([previous count] == 0)
finishedParsing = YES;
[namespaces removeLastObject];
} else if (prefix != nil) {
OFString *str = [OFString stringWithFormat: @"%@:%@",
|
| ︙ | ︙ | |||
982 983 984 985 986 987 988 | } pool = [[OFAutoreleasePool alloc] init]; cache_append(cache, buffer + *last, encoding, *i - *last); CDATA = transform_string(cache, 2, NO, nil); | < < < < < | | | 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 | } pool = [[OFAutoreleasePool alloc] init]; cache_append(cache, buffer + *last, encoding, *i - *last); CDATA = transform_string(cache, 2, NO, nil); [delegate parser: self foundCDATA: CDATA]; [pool release]; [cache removeNItems: [cache count]]; *last = *i + 1; state = OF_XMLPARSER_OUTSIDE_TAG; |
| ︙ | ︙ | |||
1041 1042 1043 1044 1045 1046 1047 | parser: self]; pool = [[OFAutoreleasePool alloc] init]; cache_append(cache, buffer + *last, encoding, *i - *last); comment = transform_string(cache, 2, NO, nil); | < < < < < | | | 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 | parser: self]; pool = [[OFAutoreleasePool alloc] init]; cache_append(cache, buffer + *last, encoding, *i - *last); comment = transform_string(cache, 2, NO, nil); [delegate parser: self foundComment: comment]; [pool release]; [cache removeNItems: [cache count]]; *last = *i + 1; state = OF_XMLPARSER_OUTSIDE_TAG; |
| ︙ | ︙ | |||
1094 1095 1096 1097 1098 1099 1100 |
{
return finishedParsing;
}
- (OFString*)string: (OFString*)string
containsUnknownEntityNamed: (OFString*)entity
{
| < < < < < | 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 |
{
return finishedParsing;
}
- (OFString*)string: (OFString*)string
containsUnknownEntityNamed: (OFString*)entity
{
return [delegate parser: self
foundUnknownEntityNamed: entity];
}
@end
@implementation OFObject (OFXMLParserDelegate)
- (void)parser: (OFXMLParser*)parser
|
| ︙ | ︙ |