This repository was archived by the owner on Aug 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMPWMAXParser_private.h
131 lines (94 loc) · 4.03 KB
/
MPWMAXParser_private.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//
// MPWMAXParser_private.h
// MPWXmlKit
//
// Created by Marcel Weiher on 22/04/2008.
// Copyright 2008 Marcel Weiher. All rights reserved.
//
#import "MPWMAXParser.h"
#import "MPWXmlAttributes.h"
#import "AccessorMacros.h"
@class MPWTagAction,MPWTagHandler;
@interface MPWXMLAttributes(privateProtocol)
//--- append values with keys and tags
-(void)setValue:(id)anObject forAttribute:(id)aKey ;
-(void)setValueAndRelease:(id)anObject forAttribute:(id)aKey namespace:aNamespace;
-(id*)_pointerToObjects;
@end
typedef struct _NSXMLElementInfo {
id elementName;
id attributes;
id children;
const char *start;
const char *end;
BOOL isIncomplete;
long integerTag;
long fullyQualifiedLen;
MPWTagAction *action;
MPWTagHandler *handler;
} NSXMLElementInfo;
#define INITIALTAGSTACKDEPTH 20
//#define DEOPTIMIZE_ALLOCATION 1
#if DEOPTIMIZE_ALLOCATION
#define MAKEDATA( dataStart, dataLength ) [NSData dataWithBytes:dataStart length:dataLength]
#else
#define MAKEDATA( start, lengthBytes ) initDataBytesLength( getData( dataCache, @selector(getObject)),@selector(reInitWithData:bytes:length:), data, start , lengthBytes )
#endif
/* cached IMPs from SAX document handler methods */
#define BEGINELEMENTSELECTOR @selector(parser:didStartElement:namespaceURI:qualifiedName:attributes:)
#define ENDELEMENTSELECTOR @selector(parser:didEndElement:namespaceURI:qualifiedName:)
#define CHARACTERSSELECTOR @selector(parser:foundCharacters:)
#define CDATASELECTOR @selector(parser:foundCDATA:)
#define BEGINELEMENT(tag,namespaceURI,fullyQualified,attr) beginElement(documentHandler, BEGINELEMENTSELECTOR ,self, tag,namespaceURI,fullyQualified,attr)
#define ENDELEMENT(tag,namespaceURI,fullyQualified) endElement(documentHandler, ENDELEMENTSELECTOR , self,tag,namespaceURI,fullyQualified )
#define RECORDSCANPOSITION( start, length ) lastGoodPosition=start+length
#if DEOPTIMIZE_ALLOCATION
#define TAGFORCSTRING( cstr, cstrlen) [[[NSString alloc] initWithBytes:cstr length:cstrlen encoding:NSUTF8StringEncoding] autorelease]
#else
#define TAGFORCSTRING( cstr, cstrlen) MAKEDATA( cstr, cstrlen )
#endif
#define CHARACTERDATAALLOWED characterDataAllowed( self, @selector(characterDataAllowed:), self )
#define CHARACTERS( c ) characters( characterHandler , CHARACTERSSELECTOR,self, c )
#define CDATA( c ) cdata( characterHandler ,CDATASELECTOR,self, c )
#define POPTAG ( [((NSXMLElementInfo*)_elementStack)[--tagStackLen].elementName release])
#define PUSHTAG(aTag) {\
if ( tagStackLen > tagStackCapacity ) {\
[self _growTagStack:tagStackCapacity * 2];\
}\
((NSXMLElementInfo*)_elementStack)[tagStackLen++].elementName=[aTag retain];\
}
#define CURRENTOBJECT [self currentObject]
#define PUSHOBJECT(anObject, key, aNamespace) {\
[self pushObject:anObject forKey:key withNamespace:aNamespace];\
}
#define CURRENTELEMENT (((NSXMLElementInfo*)_elementStack)[tagStackLen-1] )
#define CURRENTTAG ((tagStackLen > 0) ? CURRENTELEMENT.elementName : nil)
#define CURRENTINTEGERTAG ((tagStackLen > 0) ? CURRENTELEMENT.integerTag : -3)
@interface MPWMAXParser(private)
objectAccessor_h( NSError, parserError, setParserError )
-(void)_growTagStack:(long)newCapacity;
-currentTag;
-(void)pushTag:aTag;
-(void)popTag;
-getTagForCString:(const char*)cstr length:(int)len;
-currentObject;
-(void)handleNameSpaceAttribute:name withValue:value;
-(void)setScanner:newScanner;
-(void)setAutotranslateUTF8:(BOOL)shouldTranslate;
-(void)flushPureSpace;
-(void)clearAttributes;
-(void)_setAttributes:newAttributes;
-(void)setDelegate:newDelegate;
-(void)rebuildPrefixHandlerMap;
-(id)_attributes;
-_fullTagStackString;
-(void)setData:newData;
-(BOOL)makeText:(const char*)start length:(long)len firstEntityOffset:(long)entityOffset;
-(void)pushObject:anObject forKey:aKey withNamespace:aNamespace;
-(long)dataEncoding;
-(void)setDataEncoding:(long)newEncoding;
-(BOOL)parseSource:(NSEnumerator*)source;
-htmlAttributeLowerCaseNamed:(NSString*)lowerCaseAttributeName;
-(BOOL)handleMetaTag;
-currentChildren;
@end