• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdehtml
 

tdehtml

  • tdehtml
  • dom
dom2_traversal.cpp
1
23#include "dom/dom_exception.h"
24#include "dom/dom_string.h"
25#include "xml/dom2_traversalimpl.h"
26
27using namespace DOM;
28
29
30NodeIterator::NodeIterator()
31{
32 impl = 0;
33}
34
35NodeIterator::NodeIterator(const NodeIterator &other)
36{
37 impl = other.impl;
38 if (impl) impl->ref();
39}
40
41NodeIterator::NodeIterator(NodeIteratorImpl *i)
42{
43 impl = i;
44 if (impl) impl->ref();
45}
46
47NodeIterator &NodeIterator::operator = (const NodeIterator &other)
48{
49 if ( impl != other.impl ) {
50 if (impl) impl->deref();
51 impl = other.impl;
52 if (impl) impl->ref();
53 }
54 return *this;
55}
56
57NodeIterator::~NodeIterator()
58{
59 if (impl) impl->deref();
60}
61
62Node NodeIterator::root()
63{
64 if (impl) return impl->root();
65 return 0;
66}
67
68unsigned long NodeIterator::whatToShow()
69{
70 if (impl) return impl->whatToShow();
71 return 0;
72}
73
74NodeFilter NodeIterator::filter()
75{
76 if (impl) return impl->filter();
77 return 0;
78}
79
80bool NodeIterator::expandEntityReferences()
81{
82 if (impl) return impl->expandEntityReferences();
83 return 0;
84}
85
86Node NodeIterator::nextNode( )
87{
88 if (!impl)
89 throw DOMException(DOMException::INVALID_STATE_ERR);
90
91 int exceptioncode = 0;
92 NodeImpl *r = impl->nextNode(exceptioncode);
93 if (exceptioncode)
94 throw DOMException(exceptioncode);
95 return r;
96}
97
98Node NodeIterator::previousNode( )
99{
100 if (!impl)
101 throw DOMException(DOMException::INVALID_STATE_ERR);
102
103 int exceptioncode = 0;
104 NodeImpl *r = impl->previousNode(exceptioncode);
105 if (exceptioncode)
106 throw DOMException(exceptioncode);
107 return r;
108}
109
110void NodeIterator::detach()
111{
112 if (!impl)
113 throw DOMException(DOMException::INVALID_STATE_ERR);
114
115 int exceptioncode = 0;
116 impl->detach(exceptioncode);
117 if (exceptioncode)
118 throw DOMException(exceptioncode);
119}
120
121NodeIteratorImpl *NodeIterator::handle() const
122{
123 return impl;
124}
125
126bool NodeIterator::isNull() const
127{
128 return (impl == 0);
129}
130
131// -----------------------------------------------------------
132
133NodeFilter::NodeFilter()
134{
135 impl = 0;
136}
137
138NodeFilter::NodeFilter(const NodeFilter &other)
139{
140 impl = other.impl;
141 if (impl) impl->ref();
142}
143
144NodeFilter::NodeFilter(NodeFilterImpl *i)
145{
146 impl = i;
147 if (impl) impl->ref();
148}
149
150NodeFilter &NodeFilter::operator = (const NodeFilter &other)
151{
152 if ( impl != other.impl ) {
153 if (impl) impl->deref();
154 impl = other.impl;
155 if (impl) impl->ref();
156 }
157 return *this;
158}
159
160NodeFilter::~NodeFilter()
161{
162 if (impl) impl->deref();
163}
164
165short NodeFilter::acceptNode(const Node &n)
166{
167 if (impl) return impl->acceptNode(n);
168 return 0;
169}
170
171void NodeFilter::setCustomNodeFilter(CustomNodeFilter *custom)
172{
173 if (impl) impl->setCustomNodeFilter(custom);
174}
175
176CustomNodeFilter *NodeFilter::customNodeFilter()
177{
178 if (impl) return impl->customNodeFilter();
179 return 0;
180}
181
182NodeFilterImpl *NodeFilter::handle() const
183{
184 return impl;
185}
186
187bool NodeFilter::isNull() const
188{
189 return (impl == 0);
190}
191
192NodeFilter NodeFilter::createCustom(CustomNodeFilter *custom)
193{
194 NodeFilterImpl *i = new NodeFilterImpl();
195 i->setCustomNodeFilter(custom);
196 return i;
197}
198
199// --------------------------------------------------------------
200CustomNodeFilter::CustomNodeFilter()
201{
202 impl = 0;
203}
204
205CustomNodeFilter::~CustomNodeFilter()
206{
207}
208
209short CustomNodeFilter::acceptNode (const Node &/*n*/)
210{
211 return NodeFilter::FILTER_ACCEPT;
212}
213
214bool CustomNodeFilter::isNull()
215{
216 return false;
217}
218
219DOMString CustomNodeFilter::customNodeFilterType()
220{
221 return "";
222}
223
224// --------------------------------------------------------------
225
226TreeWalker::TreeWalker()
227{
228 impl = 0;
229}
230
231TreeWalker::TreeWalker(const TreeWalker &other)
232{
233 impl = other.impl;
234 if (impl) impl->ref();
235}
236
237TreeWalker::TreeWalker(TreeWalkerImpl *i)
238{
239 impl = i;
240 if (impl) impl->ref();
241}
242
243TreeWalker & TreeWalker::operator = (const TreeWalker &other)
244{
245 if ( impl != other.impl ) {
246 if (impl) impl->deref();
247 impl = other.impl;
248 if (impl) impl->ref();
249 }
250
251 return *this;
252}
253
254TreeWalker::~TreeWalker()
255{
256 if (impl) impl->deref();
257}
258
259Node TreeWalker::root()
260{
261 if (impl) return impl->getRoot();
262 return 0;
263}
264
265unsigned long TreeWalker::whatToShow()
266{
267 if (impl) return impl->getWhatToShow();
268 return 0;
269}
270
271NodeFilter TreeWalker::filter()
272{
273 if (impl) return impl->getFilter();
274 return 0;
275}
276
277bool TreeWalker::expandEntityReferences()
278{
279 if (impl) return impl->getExpandEntityReferences();
280 return false;
281}
282
283Node TreeWalker::currentNode()
284{
285 if (impl) return impl->getCurrentNode();
286 return 0;
287}
288
289void TreeWalker::setCurrentNode(const Node& _currentNode)
290{
291 if (impl) impl->setCurrentNode(_currentNode.handle());
292}
293
294Node TreeWalker::parentNode()
295{
296 if (impl) return impl->parentNode();
297 return 0;
298}
299
300Node TreeWalker::firstChild()
301{
302 if (impl) return impl->firstChild();
303 return 0;
304}
305
306Node TreeWalker::lastChild()
307{
308 if (impl) return impl->lastChild();
309 return 0;
310}
311
312Node TreeWalker::previousSibling()
313{
314 if (impl) return impl->previousSibling();
315 return 0;
316}
317
318Node TreeWalker::nextSibling()
319{
320 if (impl) return impl->nextSibling();
321 return 0;
322}
323
324Node TreeWalker::previousNode()
325{
326 if (impl) return impl->previousNode();
327 return 0;
328}
329
330Node TreeWalker::nextNode()
331{
332 if (impl) return impl->nextNode();
333 return 0;
334}
335
336TreeWalkerImpl *TreeWalker::handle() const
337{
338 return impl;
339}
340
341bool TreeWalker::isNull() const
342{
343 return (impl == 0);
344}
345
346// -----------------------------------------------------------------------
347
348/*DocumentTraversal::DocumentTraversal()
349{
350}
351
352DocumentTraversal::DocumentTraversal(const DocumentTraversal &other)
353{
354}
355
356DocumentTraversal &DocumentTraversal::operator = (const DocumentTraversal &other)
357{
358 DocumentTraversal::operator = (other);
359 return *this;
360}
361
362DocumentTraversal::~DocumentTraversal()
363{
364}
365
366NodeIterator DocumentTraversal::createNodeIterator( const Node &root, long whatToShow,
367 const NodeFilter &filter,
368 bool entityReferenceExpansion )
369{
370 return NodeIterator();
371}
372
373TreeWalker DocumentTraversal::createTreeWalker( const Node &root, long whatToShow,
374 const NodeFilter &filter,
375 bool entityReferenceExpansion )
376{
377 return TreeWalker();
378}
379
380*/
381
DOM::CustomNodeFilter
CustomNodeFilter can be used to define your own NodeFilter for use with NodeIterators and TreeWalkers...
Definition: dom2_traversal.h:295
DOM::DOMException
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
Definition: dom_exception.h:58
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
DOM::NodeFilter
Filters are objects that know how to "filter out" nodes.
Definition: dom2_traversal.h:185
DOM::NodeFilter::acceptNode
virtual short acceptNode(const Node &n)
Test whether a specified node is visible in the logical view of a TreeWalker or NodeIterator.
Definition: dom2_traversal.cpp:165
DOM::NodeIterator
NodeIterators are used to step through a set of nodes, e.g.
Definition: dom2_traversal.h:61
DOM::NodeIterator::root
Node root()
The root node of the NodeIterator, as specified when it was created.
Definition: dom2_traversal.cpp:62
DOM::NodeIterator::detach
void detach()
Detaches the NodeIterator from the set which it iterated over, releasing any computational resources ...
Definition: dom2_traversal.cpp:110
DOM::NodeIterator::filter
NodeFilter filter()
The NodeFilter used to screen nodes.
Definition: dom2_traversal.cpp:74
DOM::NodeIterator::whatToShow
unsigned long whatToShow()
This attribute determines which node types are presented via the iterator.
Definition: dom2_traversal.cpp:68
DOM::NodeIterator::nextNode
Node nextNode()
Returns the next node in the set and advances the position of the Iterator in the set.
Definition: dom2_traversal.cpp:86
DOM::NodeIterator::previousNode
Node previousNode()
Returns the previous node in the set and moves the position of the Iterator backwards in the set.
Definition: dom2_traversal.cpp:98
DOM::NodeIterator::expandEntityReferences
bool expandEntityReferences()
The value of this flag determines whether the children of entity reference nodes are visible to the i...
Definition: dom2_traversal.cpp:80
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:275
DOM::TreeWalker
TreeWalker objects are used to navigate a document tree or subtree using the view of the document def...
Definition: dom2_traversal.h:340
DOM::TreeWalker::previousNode
Node previousNode()
Moves the TreeWalker to the previous node in document order relative to the current node,...
Definition: dom2_traversal.cpp:324
DOM::TreeWalker::lastChild
Node lastChild()
Moves the TreeWalker to the last child of the current node, and returns the new node.
Definition: dom2_traversal.cpp:306
DOM::TreeWalker::parentNode
Node parentNode()
Moves to and returns the parent node of the current node.
Definition: dom2_traversal.cpp:294
DOM::TreeWalker::firstChild
Node firstChild()
Moves the TreeWalker to the first child of the current node, and returns the new node.
Definition: dom2_traversal.cpp:300
DOM::TreeWalker::root
Node root()
The root node of the TreeWalker, as specified when it was created.
Definition: dom2_traversal.cpp:259
DOM::TreeWalker::whatToShow
unsigned long whatToShow()
This attribute determines which node types are presented via the TreeWalker.
Definition: dom2_traversal.cpp:265
DOM::TreeWalker::setCurrentNode
void setCurrentNode(const Node &_currentNode)
see currentNode
Definition: dom2_traversal.cpp:289
DOM::TreeWalker::expandEntityReferences
bool expandEntityReferences()
The value of this flag determines whether the children of entity reference nodes are visible to the T...
Definition: dom2_traversal.cpp:277
DOM::TreeWalker::nextNode
Node nextNode()
Moves the TreeWalker to the next node in document order relative to the current node,...
Definition: dom2_traversal.cpp:330
DOM::TreeWalker::currentNode
Node currentNode()
The node at which the TreeWalker is currently positioned.
Definition: dom2_traversal.cpp:283
DOM::TreeWalker::filter
NodeFilter filter()
The filter used to screen nodes.
Definition: dom2_traversal.cpp:271
DOM::TreeWalker::nextSibling
Node nextSibling()
Moves the TreeWalker to the next sibling of the current node, and returns the new node.
Definition: dom2_traversal.cpp:318
DOM::TreeWalker::previousSibling
Node previousSibling()
Moves the TreeWalker to the previous sibling of the current node, and returns the new node.
Definition: dom2_traversal.cpp:312
DOM
The Document Object Model (DOM) is divided into two parts, the COREDOM core DOM, specifying some core...
Definition: design.h:57

tdehtml

Skip menu "tdehtml"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdehtml

Skip menu "tdehtml"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdehtml by doxygen 1.9.4
This website is maintained by Timothy Pearson.