Mercurial > illumos > onarm
annotate usr/src/cmd/man/src/util/nsgmls.src/include/OpenElement.h @ 4:1a15d5aaf794
synchronized with onnv_86 (6202) in onnv-gate
author | Koji Uno <koji.uno@sun.com> |
---|---|
date | Mon, 31 Aug 2009 14:38:03 +0900 |
parents | c9caec207d52 |
children |
rev | line source |
---|---|
0 | 1 // Copyright (c) 1994 James Clark |
2 // See the file COPYING for copying permission. | |
4
1a15d5aaf794
synchronized with onnv_86 (6202) in onnv-gate
Koji Uno <koji.uno@sun.com>
parents:
0
diff
changeset
|
3 #pragma ident "%Z%%M% %I% %E% SMI" |
0 | 4 |
5 #ifndef OpenElement_INCLUDED | |
6 #define OpenElement_INCLUDED 1 | |
7 #ifdef __GNUG__ | |
8 #pragma interface | |
9 #endif | |
10 | |
11 #include "Boolean.h" | |
12 #include "ContentToken.h" | |
13 #include "ElementType.h" | |
14 #include "Link.h" | |
15 #include "Mode.h" | |
16 #include "Allocator.h" | |
17 #include "Location.h" | |
18 | |
19 #ifdef SP_NAMESPACE | |
20 namespace SP_NAMESPACE { | |
21 #endif | |
22 | |
23 class SP_API OpenElement : public Link { | |
24 public: | |
25 void *operator new(size_t sz, Allocator &alloc) { return alloc.alloc(sz); } | |
26 void *operator new(size_t sz) { return Allocator::allocSimple(sz); } | |
27 void operator delete(void *p) { Allocator::free(p); } | |
28 OpenElement(const ElementType *, Boolean net, Boolean included, | |
29 const ShortReferenceMap *currentMap, | |
30 const Location &startLocation); | |
31 Boolean isFinished() const; | |
32 Boolean tryTransition(const ElementType *); | |
33 const LeafContentToken *invalidExclusion(const ElementType *) const; | |
34 // This doesn't handle declared content of EMPTY. | |
35 // If this situation can arise must use declaredEmpty(). | |
36 Boolean tryTransitionPcdata(); | |
37 const LeafContentToken *impliedStartTag() const; | |
38 void doRequiredTransition(); | |
39 const ElementType *type() const; | |
40 Boolean netEnabling() const; | |
41 Boolean included() const; | |
42 const MatchState &matchState() const; | |
43 void setMatchState(const MatchState &); | |
44 Mode mode(Boolean netEnabled) const; | |
45 const ShortReferenceMap *map() const; | |
46 void setMap(const ShortReferenceMap *); | |
47 Boolean requiresSpecialParse() const; | |
48 const Location &startLocation() const; | |
49 const LeafContentToken *currentPosition() const; | |
50 Boolean declaredEmpty() const; | |
51 void setConref(); | |
52 unsigned long index() const; | |
53 void setIndex(unsigned long); | |
54 private: | |
55 OpenElement(const OpenElement &); // undefined | |
56 void operator=(const OpenElement &); // undefined | |
57 const ElementType *elementType_; | |
58 PackedBoolean netEnabling_; // start-tag was net-enabling | |
59 PackedBoolean included_; | |
60 MatchState matchState_; | |
61 ElementDefinition::DeclaredContent declaredContent_; | |
62 const ShortReferenceMap *map_; | |
63 Location startLocation_; | |
64 unsigned long index_; | |
65 }; | |
66 | |
67 inline | |
68 const ElementType *OpenElement::type() const | |
69 { | |
70 return elementType_; | |
71 } | |
72 | |
73 inline | |
74 Boolean OpenElement::netEnabling() const | |
75 { | |
76 return netEnabling_; | |
77 } | |
78 | |
79 inline | |
80 Boolean OpenElement::included() const | |
81 { | |
82 return included_; | |
83 } | |
84 | |
85 inline | |
86 const MatchState &OpenElement::matchState() const | |
87 { | |
88 return matchState_; | |
89 } | |
90 | |
91 inline | |
92 void OpenElement::setMatchState(const MatchState &state) | |
93 { | |
94 matchState_ = state; | |
95 } | |
96 | |
97 inline | |
98 Boolean OpenElement::isFinished() const | |
99 { | |
100 return (declaredContent_ != ElementDefinition::modelGroup | |
101 || matchState_.isFinished()); | |
102 } | |
103 | |
104 inline | |
105 Boolean OpenElement::tryTransition(const ElementType *e) | |
106 { | |
107 return (declaredContent_ == ElementDefinition::modelGroup | |
108 ? matchState_.tryTransition(e) | |
109 : (declaredContent_ == ElementDefinition::any)); | |
110 } | |
111 | |
112 inline | |
113 Boolean OpenElement::tryTransitionPcdata() | |
114 { | |
115 return (declaredContent_ == ElementDefinition::modelGroup | |
116 ? matchState_.tryTransitionPcdata() | |
117 : 1); // CDATA, RCDATA, ANY all ok | |
118 } | |
119 | |
120 inline | |
121 const LeafContentToken *OpenElement::invalidExclusion(const ElementType *e) | |
122 const | |
123 { | |
124 return (declaredContent_ == ElementDefinition::modelGroup | |
125 ? matchState_.invalidExclusion(e) | |
126 : 0); | |
127 } | |
128 | |
129 inline | |
130 void OpenElement::doRequiredTransition() | |
131 { | |
132 matchState_.doRequiredTransition(); | |
133 } | |
134 | |
135 inline | |
136 const LeafContentToken *OpenElement::impliedStartTag() const | |
137 { | |
138 return (declaredContent_ == ElementDefinition::modelGroup | |
139 ? matchState_.impliedStartTag() | |
140 : 0); | |
141 } | |
142 | |
143 inline | |
144 const ShortReferenceMap *OpenElement::map() const | |
145 { | |
146 return map_; | |
147 } | |
148 | |
149 inline | |
150 void OpenElement::setMap(const ShortReferenceMap *map) | |
151 { | |
152 map_ = map; | |
153 } | |
154 | |
155 inline | |
156 Boolean OpenElement::requiresSpecialParse() const | |
157 { | |
158 return (declaredContent_ == ElementDefinition::cdata | |
159 || declaredContent_ == ElementDefinition::rcdata); | |
160 } | |
161 | |
162 inline | |
163 Mode OpenElement::mode(Boolean netEnabled) const | |
164 { | |
165 return elementType_->definition()->mode(netEnabled); | |
166 } | |
167 | |
168 inline | |
169 const Location &OpenElement::startLocation() const | |
170 { | |
171 return startLocation_; | |
172 } | |
173 | |
174 inline | |
175 const LeafContentToken *OpenElement::currentPosition() const | |
176 { | |
177 return (declaredContent_ == ElementDefinition::modelGroup | |
178 ? matchState_.currentPosition() | |
179 : 0); | |
180 } | |
181 | |
182 inline | |
183 Boolean OpenElement::declaredEmpty() const | |
184 { | |
185 return declaredContent_ == ElementDefinition::empty; | |
186 } | |
187 | |
188 inline | |
189 void OpenElement::setConref() | |
190 { | |
191 declaredContent_ = ElementDefinition::empty; | |
192 } | |
193 | |
194 inline | |
195 unsigned long OpenElement::index() const | |
196 { | |
197 return index_; | |
198 } | |
199 | |
200 inline | |
201 void OpenElement::setIndex(unsigned long index) | |
202 { | |
203 index_ = index; | |
204 } | |
205 | |
206 #ifdef SP_NAMESPACE | |
207 } | |
208 #endif | |
209 | |
210 #endif /* not OpenElement_INCLUDED */ |