1
#ifndef __TRAVERSAL_H__
2
#define __TRAVERSAL_H__
5
* Phoebe DOM Implementation.
7
* This is a C++ approximation of the W3C DOM model, which follows
8
* fairly closely the specifications in the various .idl files, copies of
9
* which are provided for reference. Most important is this one:
11
* http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
16
* Copyright (C) 2005 Bob Jamison
18
* This library is free software; you can redistribute it and/or
19
* modify it under the terms of the GNU Lesser General Public
20
* License as published by the Free Software Foundation; either
21
* version 2.1 of the License, or (at your option) any later version.
23
* This library is distributed in the hope that it will be useful,
24
* but WITHOUT ANY WARRANTY; without even the implied warranty of
25
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26
* Lesser General Public License for more details.
28
* You should have received a copy of the GNU Lesser General Public
29
* License along with this library; if not, write to the Free Software
30
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
48
typedef dom::Node Node;
54
/*#########################################################################
56
#########################################################################*/
64
// Constants returned by acceptNode
74
// Constants for whatToShow
77
SHOW_ALL = 0xFFFFFFFF,
78
SHOW_ELEMENT = 0x00000001,
79
SHOW_ATTRIBUTE = 0x00000002,
80
SHOW_TEXT = 0x00000004,
81
SHOW_CDATA_SECTION = 0x00000008,
82
SHOW_ENTITY_REFERENCE = 0x00000010,
83
SHOW_ENTITY = 0x00000020,
84
SHOW_PROCESSING_INSTRUCTION = 0x00000040,
85
SHOW_COMMENT = 0x00000080,
86
SHOW_DOCUMENT = 0x00000100,
87
SHOW_DOCUMENT_TYPE = 0x00000200,
88
SHOW_DOCUMENT_FRAGMENT = 0x00000400,
89
SHOW_NOTATION = 0x00000800
95
virtual short acceptNode(const Node *n)
115
NodeFilter(const NodeFilter &other)
122
virtual ~NodeFilter() {}
127
/*#########################################################################
129
#########################################################################*/
140
virtual Node *getRoot()
148
virtual unsigned long getWhatToShow()
149
{ return whatToShow; }
154
virtual NodeFilter getFilter()
160
virtual bool getExpandEntityReferences()
161
{ return expandEntityReferences; }
166
virtual Node *nextNode() throw(dom::DOMException)
174
virtual Node *previousNode() throw(dom::DOMException)
182
virtual void detach()
199
NodeIterator(const NodeIterator &other)
201
whatToShow = other.whatToShow;
202
filter = other.filter;
203
expandEntityReferences = other.expandEntityReferences;
209
virtual ~NodeIterator() {}
213
unsigned long whatToShow;
215
bool expandEntityReferences;
222
/*#########################################################################
224
#########################################################################*/
237
virtual Node *getRoot()
245
virtual unsigned long getWhatToShow()
246
{ return whatToShow; }
251
virtual NodeFilter getFilter()
257
virtual bool getExpandEntityReferences()
258
{ return expandEntityReferences; }
263
virtual Node *getCurrentNode()
264
{ return currentNode; }
269
virtual void setCurrentNode(const Node *val) throw(dom::DOMException)
270
{ currentNode = (Node *)val; }
275
virtual Node *parentNode()
283
virtual Node *firstChild()
291
virtual Node *lastChild()
299
virtual Node *previousSibling()
307
virtual Node *nextSibling()
315
virtual Node *previousNode()
323
virtual Node *nextNode()
342
TreeWalker(const TreeWalker &other)
344
whatToShow = other.whatToShow;
345
filter = other.filter;
346
expandEntityReferences = other.expandEntityReferences;
347
currentNode = other.currentNode;
353
virtual ~TreeWalker() {}
358
unsigned long whatToShow;
360
bool expandEntityReferences;
368
/*#########################################################################
370
#########################################################################*/
375
class DocumentTraversal
382
virtual NodeIterator createNodeIterator(const Node *root,
383
unsigned long whatToShow,
384
const NodeFilter *filter,
385
bool entityReferenceExpansion)
386
throw (dom::DOMException)
395
virtual TreeWalker createTreeWalker(const Node *root,
396
unsigned long whatToShow,
397
const NodeFilter *filter,
398
bool entityReferenceExpansion)
399
throw (dom::DOMException)
413
DocumentTraversal() {}
418
DocumentTraversal(const DocumentTraversal &other)
424
virtual ~DocumentTraversal() {}
433
} //namespace traversal
438
#endif /* __TRAVERSAL_H__ */
441
/*#########################################################################
443
#########################################################################*/