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

tdehtml

  • tdehtml
  • dom
dom2_traversal.h
1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * (C) 1999 Lars Knoll (knoll@kde.org)
5  * (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  * This file includes excerpts from the Document Object Model (DOM)
22  * Level 2 Specification (Candidate Recommendation)
23  * http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/
24  * Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
25  *
26  */
27 #ifndef _dom2_traversal_h_
28 #define _dom2_traversal_h_
29 #include <dom/dom_node.h>
30 #include <dom/dom_misc.h>
31 
32 #include <tdelibs_export.h>
33 
34 namespace DOM {
35 class Node;
36 class NodeFilter;
37 class NodeImpl;
38 class NodeIteratorImpl;
39 class NodeFilterImpl;
40 class TreeWalkerImpl;
41 class CustomNodeFilter;
42 class CustomNodeFilterImpl;
43 
60 class TDEHTML_EXPORT NodeIterator
61 {
62  friend class NodeIteratorImpl;
63  friend class Document;
64 public:
65  NodeIterator();
66  NodeIterator(const NodeIterator &other);
67 
68  NodeIterator & operator = (const NodeIterator &other);
69 
70  ~NodeIterator();
71 
75  Node root();
76 
84  unsigned long whatToShow();
85 
89  NodeFilter filter();
90 
107  bool expandEntityReferences();
108 
123  Node nextNode();
124 
138  Node previousNode();
139 
146  void detach();
147 
152  NodeIteratorImpl *handle() const;
153  bool isNull() const;
154 
155 protected:
156  NodeIteratorImpl *impl;
157  NodeIterator(NodeIteratorImpl *i);
158 };
159 
160 
184 class TDEHTML_EXPORT NodeFilter
185 {
186  friend class NodeIterator;
187  friend class NodeIteratorImpl;
188  friend class TreeWalker;
189  friend class TreeWalkerImpl;
190  friend class NodeFilterImpl;
191 public:
192  NodeFilter();
193  NodeFilter(const NodeFilter &other);
194  NodeFilter(NodeFilterImpl *i);
195 
196  virtual NodeFilter & operator = (const NodeFilter &other);
197 
198  virtual ~NodeFilter();
204  enum AcceptCode {
205  FILTER_ACCEPT = 1,
206  FILTER_REJECT = 2,
207  FILTER_SKIP = 3
208  };
209 
217  enum ShowCode {
218  SHOW_ALL = 0xFFFFFFFF,
219  SHOW_ELEMENT = 0x00000001,
220  SHOW_ATTRIBUTE = 0x00000002,
221  SHOW_TEXT = 0x00000004,
222  SHOW_CDATA_SECTION = 0x00000008,
223  SHOW_ENTITY_REFERENCE = 0x00000010,
224  SHOW_ENTITY = 0x00000020,
225  SHOW_PROCESSING_INSTRUCTION = 0x00000040,
226  SHOW_COMMENT = 0x00000080,
227  SHOW_DOCUMENT = 0x00000100,
228  SHOW_DOCUMENT_TYPE = 0x00000200,
229  SHOW_DOCUMENT_FRAGMENT = 0x00000400,
230  SHOW_NOTATION = 0x00000800
231  };
232 
247  virtual short acceptNode (const Node &n);
248 
253  virtual NodeFilterImpl *handle() const;
254  virtual bool isNull() const;
255 
256  void setCustomNodeFilter(CustomNodeFilter *custom);
257  CustomNodeFilter *customNodeFilter();
258  static NodeFilter createCustom(CustomNodeFilter *custom);
259 
260 protected:
261  NodeFilterImpl *impl;
262 };
263 
295 class TDEHTML_EXPORT CustomNodeFilter : public DomShared {
296 public:
297  CustomNodeFilter();
298  virtual ~CustomNodeFilter();
299  virtual short acceptNode (const Node &n);
300  virtual bool isNull();
301 
310  virtual DOMString customNodeFilterType();
311 
312 protected:
317  CustomNodeFilterImpl *impl;
318 };
319 
339 class TDEHTML_EXPORT TreeWalker
340 {
341  friend class Document;
342  friend class TreeWalkerImpl;
343 public:
344  TreeWalker();
345  TreeWalker(const TreeWalker &other);
346 
347  TreeWalker & operator = (const TreeWalker &other);
348 
349  ~TreeWalker();
350 
351 
355  Node root();
356 
364  unsigned long whatToShow();
365 
369  NodeFilter filter();
370 
385  bool expandEntityReferences();
386 
400  Node currentNode();
401 
405  void setCurrentNode(const Node &_currentNode);
406 
421  Node parentNode();
422 
437  Node firstChild();
438 
453  Node lastChild();
454 
469  Node previousSibling();
470 
485  Node nextSibling();
486 
501  Node previousNode();
502 
517  Node nextNode();
518 
523  TreeWalkerImpl *handle() const;
524  bool isNull() const;
525 
526 protected:
527  TreeWalker(TreeWalkerImpl *i);
528  TreeWalkerImpl *impl;
529 };
530 
531 
532 // ### not sure if this this class is really needed - both methods are in
533 // Document
534 
615 } // namespace
616 
617 #endif
DOM::CustomNodeFilter
CustomNodeFilter can be used to define your own NodeFilter for use with NodeIterators and TreeWalkers...
Definition: dom2_traversal.h:295
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:44
DOM::Document
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:246
DOM::NodeFilter
Filters are objects that know how to "filter out" nodes.
Definition: dom2_traversal.h:185
DOM::NodeFilter::AcceptCode
AcceptCode
The following constants are returned by the acceptNode() method:
Definition: dom2_traversal.h:204
DOM::NodeFilter::ShowCode
ShowCode
These are the available values for the whatToShow parameter.
Definition: dom2_traversal.h:217
DOM::NodeIterator
NodeIterators are used to step through a set of nodes, e.g.
Definition: dom2_traversal.h:61
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
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.1
This website is maintained by Timothy Pearson.