94
|
1 |
/*
|
|
2 |
* Copyright (c) 2000 - 2001 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef NW_CXML_DOM_DOMVISITOR_H
|
|
20 |
#define NW_CXML_DOM_DOMVISITOR_H
|
|
21 |
|
|
22 |
#include "nw_object_dynamic.h"
|
|
23 |
#include <nw_dom_node.h>
|
|
24 |
#include "BrsrStatusCodes.h"
|
|
25 |
|
|
26 |
#ifdef __cplusplus
|
|
27 |
extern "C" {
|
|
28 |
#endif /* __cplusplus */
|
|
29 |
|
|
30 |
|
|
31 |
/** ----------------------------------------------------------------------- **
|
|
32 |
@struct: NW_cXML_DOM_DOMVisitor_ClassPart
|
|
33 |
|
|
34 |
@synopsis: default
|
|
35 |
|
|
36 |
@scope: public
|
|
37 |
@variables:
|
|
38 |
void** unused
|
|
39 |
default
|
|
40 |
|
|
41 |
@description: default
|
|
42 |
** ----------------------------------------------------------------------- **/
|
|
43 |
typedef struct NW_cXML_DOM_DOMVisitor_ClassPart_s {
|
|
44 |
void** unused;
|
|
45 |
} NW_cXML_DOM_DOMVisitor_ClassPart_t;
|
|
46 |
|
|
47 |
|
|
48 |
/** ----------------------------------------------------------------------- **
|
|
49 |
@struct: NW_cXML_DOM_DOMVisitor_Class
|
|
50 |
|
|
51 |
@synopsis: default
|
|
52 |
|
|
53 |
@scope: public
|
|
54 |
@variables:
|
|
55 |
NW_Object_Core_ClassPart_t NW_Object_Core
|
|
56 |
default
|
|
57 |
|
|
58 |
NW_Object_Base_ClassPart_t NW_Object_Base
|
|
59 |
default
|
|
60 |
|
|
61 |
NW_Object_Dynamic_ClassPart_t NW_Object_Dynamic
|
|
62 |
default
|
|
63 |
|
|
64 |
NW_cXML_DOM_DOMVisitor_ClassPart_t NW_cXML_DOM_DOMVisitor
|
|
65 |
default
|
|
66 |
|
|
67 |
@description: default
|
|
68 |
** ----------------------------------------------------------------------- **/
|
|
69 |
typedef struct NW_cXML_DOM_DOMVisitor_Class_s {
|
|
70 |
NW_Object_Core_ClassPart_t NW_Object_Core;
|
|
71 |
NW_Object_Base_ClassPart_t NW_Object_Base;
|
|
72 |
NW_Object_Dynamic_ClassPart_t NW_Object_Dynamic;
|
|
73 |
NW_cXML_DOM_DOMVisitor_ClassPart_t NW_cXML_DOM_DOMVisitor;
|
|
74 |
}NW_cXML_DOM_DOMVisitor_Class_t;
|
|
75 |
|
|
76 |
|
|
77 |
/** ----------------------------------------------------------------------- **
|
|
78 |
@struct: NW_cXML_DOM_DOMVisitor
|
|
79 |
|
|
80 |
@synopsis: default
|
|
81 |
|
|
82 |
@scope: public
|
|
83 |
@variables:
|
|
84 |
NW_Object_Dynamic_t super
|
|
85 |
default
|
|
86 |
|
|
87 |
NW_DOM_Node_t* rootNode
|
|
88 |
default
|
|
89 |
|
|
90 |
NW_DOM_Node_t* currentNode
|
|
91 |
default
|
|
92 |
|
|
93 |
@description: default
|
|
94 |
** ----------------------------------------------------------------------- **/
|
|
95 |
typedef struct NW_cXML_DOM_DOMVisitor_s {
|
|
96 |
NW_Object_Dynamic_t super;
|
|
97 |
/* member variables */
|
|
98 |
NW_DOM_Node_t* rootNode;
|
|
99 |
NW_DOM_Node_t* currentNode;
|
|
100 |
}NW_cXML_DOM_DOMVisitor_t;
|
|
101 |
|
|
102 |
|
|
103 |
/* ------------------------------------------------------------------------- */
|
|
104 |
#define NW_cXML_DOM_DOMVisitor_GetClassPart(_object) \
|
|
105 |
(NW_Object_GetClassPart (_object, NW_cXML_DOM_DOMVisitor))
|
|
106 |
|
|
107 |
#define NW_cXML_DOM_DOMVisitorOf(_object) \
|
|
108 |
(NW_Object_Cast (_object, NW_cXML_DOM_DOMVisitor))
|
|
109 |
|
|
110 |
/* ------------------------------------------------------------------------- */
|
|
111 |
extern const NW_cXML_DOM_DOMVisitor_Class_t NW_cXML_DOM_DOMVisitor_Class;
|
|
112 |
|
|
113 |
/* ------------------------------------------------------------------------- *
|
|
114 |
final public methods
|
|
115 |
* ------------------------------------------------------------------------- */
|
|
116 |
|
|
117 |
|
|
118 |
/** ----------------------------------------------------------------------- **
|
|
119 |
@function: NW_cXML_DOM_DOMVisitor_SetRootNode
|
|
120 |
|
|
121 |
@synopsis: Sets root node.
|
|
122 |
|
|
123 |
@scope: public
|
|
124 |
|
|
125 |
@parameters:
|
|
126 |
[in-out] NW_cXML_DOM_DOMVisitor_t* visitor
|
|
127 |
default
|
|
128 |
|
|
129 |
[in-out] NW_DOM_Node_t* rootNode
|
|
130 |
default
|
|
131 |
|
|
132 |
@description: Sets root node.
|
|
133 |
|
|
134 |
@returns: TBrowserStatusCode
|
|
135 |
default
|
|
136 |
|
|
137 |
[default]
|
|
138 |
default
|
|
139 |
|
|
140 |
** ----------------------------------------------------------------------- **/
|
|
141 |
extern TBrowserStatusCode
|
|
142 |
NW_cXML_DOM_DOMVisitor_SetRootNode (NW_cXML_DOM_DOMVisitor_t* visitor,
|
|
143 |
NW_DOM_Node_t* rootNode);
|
|
144 |
|
|
145 |
/** ----------------------------------------------------------------------- **
|
|
146 |
@function: NW_cXML_DOM_DOMVisitor_GetRootNode
|
|
147 |
|
|
148 |
@synopsis: Gets root node.
|
|
149 |
|
|
150 |
@scope: public
|
|
151 |
|
|
152 |
@parameters:
|
|
153 |
[in-out] NW_cXML_DOM_DOMVisitor_t* visitor
|
|
154 |
default
|
|
155 |
|
|
156 |
@description: Returns the root node.
|
|
157 |
|
|
158 |
@returns: NW_DOM_Node_t*
|
|
159 |
default
|
|
160 |
|
|
161 |
** ----------------------------------------------------------------------- **/
|
|
162 |
extern
|
|
163 |
NW_DOM_Node_t*
|
|
164 |
NW_cXML_DOM_DOMVisitor_GetRootNode (NW_cXML_DOM_DOMVisitor_t* visitor);
|
|
165 |
|
|
166 |
|
|
167 |
/** ----------------------------------------------------------------------- **
|
|
168 |
@function: NW_cXML_DOM_DOMVisitor_Next
|
|
169 |
|
|
170 |
@synopsis: Gets next node.
|
|
171 |
|
|
172 |
@scope: public
|
|
173 |
|
|
174 |
@parameters:
|
|
175 |
[in] NW_cXML_DOM_DOMVisitor_t* visitor
|
|
176 |
default
|
|
177 |
|
|
178 |
[in] NW_Uint8 type
|
|
179 |
default
|
|
180 |
|
|
181 |
@description: Returns the next node of the given type. Starting with
|
|
182 |
the root node it returns nodes in a depth-first fashion.
|
|
183 |
NULL is returned when all of the nodes have been iterated
|
|
184 |
over.
|
|
185 |
|
|
186 |
@returns: NW_DOM_Node_t*
|
|
187 |
default
|
|
188 |
|
|
189 |
[default]
|
|
190 |
default
|
|
191 |
|
|
192 |
** ----------------------------------------------------------------------- **/
|
|
193 |
extern
|
|
194 |
NW_DOM_Node_t*
|
|
195 |
NW_cXML_DOM_DOMVisitor_Next (NW_cXML_DOM_DOMVisitor_t* visitor,
|
|
196 |
NW_Uint8 type);
|
|
197 |
|
|
198 |
|
|
199 |
/** ----------------------------------------------------------------------- **
|
|
200 |
@function: NW_cXML_DOM_DOMVisitor_NextChild
|
|
201 |
|
|
202 |
@synopsis: Like Next except that it only iterates over the root's
|
|
203 |
direct children. NULL is returned when all of the nodes
|
|
204 |
have been iterated over.
|
|
205 |
|
|
206 |
@scope: public
|
|
207 |
|
|
208 |
@parameters:
|
|
209 |
[in] NW_cXML_DOM_DOMVisitor_t* visitor
|
|
210 |
default
|
|
211 |
|
|
212 |
[in] NW_Uint8 type
|
|
213 |
default
|
|
214 |
|
|
215 |
@description: Like Next except that it only iterates over the root's direct children..
|
|
216 |
|
|
217 |
@returns: NW_DOM_Node_t*
|
|
218 |
default
|
|
219 |
|
|
220 |
** ----------------------------------------------------------------------- **/
|
|
221 |
extern
|
|
222 |
NW_DOM_Node_t*
|
|
223 |
NW_cXML_DOM_DOMVisitor_NextChild (NW_cXML_DOM_DOMVisitor_t* visitor,
|
|
224 |
NW_Uint8 type);
|
|
225 |
|
|
226 |
|
|
227 |
/** ----------------------------------------------------------------------- **
|
|
228 |
@function: NW_cXML_DOM_DOMVisitor_Reset
|
|
229 |
|
|
230 |
@synopsis: resets the visitor to its initial state.
|
|
231 |
|
|
232 |
@scope: public
|
|
233 |
|
|
234 |
@parameters:
|
|
235 |
[in] NW_cXML_DOM_DOMVisitor_t* visitor
|
|
236 |
default
|
|
237 |
|
|
238 |
@description: resets the visitor to its initial state.
|
|
239 |
|
|
240 |
@returns: TBrowserStatusCode
|
|
241 |
default
|
|
242 |
|
|
243 |
** ----------------------------------------------------------------------- **/
|
|
244 |
extern
|
|
245 |
TBrowserStatusCode
|
|
246 |
NW_cXML_DOM_DOMVisitor_Reset (NW_cXML_DOM_DOMVisitor_t* visitor);
|
|
247 |
|
|
248 |
/* ------------------------------------------------------------------------- */
|
|
249 |
/* Gets the next node using skipChildren functionality */
|
|
250 |
/* ------------------------------------------------------------------------- */
|
|
251 |
NW_DOM_Node_t*
|
|
252 |
NW_cXML_DOM_DOMVisitor_NextNode (NW_cXML_DOM_DOMVisitor_t* visitor,
|
|
253 |
NW_Uint8 type,
|
|
254 |
NW_Bool skipChildren);
|
|
255 |
|
|
256 |
|
|
257 |
/* ------------------------------------------------------------------------- *
|
|
258 |
convenience functions
|
|
259 |
* ------------------------------------------------------------------------- */
|
|
260 |
|
|
261 |
|
|
262 |
/** ----------------------------------------------------------------------- **
|
|
263 |
@function: NW_cXML_DOM_DOMVisitor_New
|
|
264 |
|
|
265 |
@synopsis: Creates new node.
|
|
266 |
|
|
267 |
@scope: public
|
|
268 |
|
|
269 |
@parameters:
|
|
270 |
[in] NW_DOM_Node_t* rootNode
|
|
271 |
default
|
|
272 |
|
|
273 |
@description: Creates new node.
|
|
274 |
|
|
275 |
@returns: NW_cXML_DOM_DOMVisitor_t*
|
|
276 |
default
|
|
277 |
|
|
278 |
[default]
|
|
279 |
default
|
|
280 |
|
|
281 |
** ----------------------------------------------------------------------- **/
|
|
282 |
extern
|
|
283 |
NW_cXML_DOM_DOMVisitor_t*
|
|
284 |
NW_cXML_DOM_DOMVisitor_New (NW_DOM_Node_t* rootNode);
|
|
285 |
|
|
286 |
|
|
287 |
extern
|
|
288 |
TBrowserStatusCode
|
|
289 |
NW_cXML_DOM_DOMVisitor_Initialize (NW_cXML_DOM_DOMVisitor_t* visitor, NW_DOM_Node_t* rootNode);
|
|
290 |
|
|
291 |
#ifdef __cplusplus
|
|
292 |
} // extern "C" {
|
|
293 |
#endif /* __cplusplus */
|
|
294 |
|
|
295 |
#endif /* NW_CXML_DOM_DOMVISITOR_H */
|