• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KHTML

  • sources
  • kde-4.12
  • kdelibs
  • khtml
  • dom
dom2_traversal.h
Go to the documentation of this file.
1 /*
2  * This file is part of the DOM implementation for KDE.
3  *
4  * Copyright 1999 Lars Knoll (knoll@kde.org)
5  * Copyright 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 
30 #include <khtml_export.h>
31 #include <dom/dom_node.h>
32 #include <dom/dom_misc.h>
33 
34 namespace DOM {
35 class Node;
36 class NodeFilter;
37 class NodeIteratorImpl;
38 class NodeFilterImpl;
39 class TreeWalkerImpl;
40 class CustomNodeFilter;
41 class CustomNodeFilterImpl;
42 
59 class KHTML_EXPORT NodeIterator
60 {
61  friend class NodeIteratorImpl;
62  friend class Document;
63 public:
64  NodeIterator();
65  NodeIterator(const NodeIterator &other);
66 
67  NodeIterator & operator = (const NodeIterator &other);
68 
69  ~NodeIterator();
70 
74  Node root();
75 
83  unsigned long whatToShow();
84 
88  NodeFilter filter();
89 
106  bool expandEntityReferences();
107 
122  Node nextNode();
123 
137  Node previousNode();
138 
145  void detach();
146 
151  NodeIteratorImpl *handle() const;
152  bool isNull() const;
153 
154 protected:
155  NodeIteratorImpl *impl;
156  NodeIterator(NodeIteratorImpl *i);
157 };
158 
159 
183 class KHTML_EXPORT NodeFilter
184 {
185  friend class NodeIterator;
186  friend class NodeIteratorImpl;
187  friend class TreeWalker;
188  friend class TreeWalkerImpl;
189  friend class NodeFilterImpl;
190 public:
191  NodeFilter();
192  NodeFilter(const NodeFilter &other);
193  NodeFilter(NodeFilterImpl *i);
194 
195  virtual NodeFilter & operator = (const NodeFilter &other);
196 
197  virtual ~NodeFilter();
203  enum AcceptCode {
204  FILTER_ACCEPT = 1,
205  FILTER_REJECT = 2,
206  FILTER_SKIP = 3
207  };
208 
216  enum ShowCode {
217  SHOW_ALL = 0xFFFFFFFF,
218  SHOW_ELEMENT = 0x00000001,
219  SHOW_ATTRIBUTE = 0x00000002,
220  SHOW_TEXT = 0x00000004,
221  SHOW_CDATA_SECTION = 0x00000008,
222  SHOW_ENTITY_REFERENCE = 0x00000010,
223  SHOW_ENTITY = 0x00000020,
224  SHOW_PROCESSING_INSTRUCTION = 0x00000040,
225  SHOW_COMMENT = 0x00000080,
226  SHOW_DOCUMENT = 0x00000100,
227  SHOW_DOCUMENT_TYPE = 0x00000200,
228  SHOW_DOCUMENT_FRAGMENT = 0x00000400,
229  SHOW_NOTATION = 0x00000800
230  };
231 
246  virtual short acceptNode (const Node &n);
247 
252  virtual NodeFilterImpl *handle() const;
253  virtual bool isNull() const;
254 
255  void setCustomNodeFilter(CustomNodeFilter *custom);
256  CustomNodeFilter *customNodeFilter();
257  static NodeFilter createCustom(CustomNodeFilter *custom);
258 
259 protected:
260  NodeFilterImpl *impl;
261 };
262 
294 class KHTML_EXPORT CustomNodeFilter : public DomShared {
295 public:
296  CustomNodeFilter();
297  virtual ~CustomNodeFilter();
298  virtual short acceptNode (const Node &n);
299  virtual bool isNull();
300 
309  virtual DOMString customNodeFilterType();
310 
311 protected:
316  CustomNodeFilterImpl *impl;
317 };
318 
338 class KHTML_EXPORT TreeWalker
339 {
340  friend class Document;
341  friend class TreeWalkerImpl;
342 public:
343  TreeWalker();
344  TreeWalker(const TreeWalker &other);
345 
346  TreeWalker & operator = (const TreeWalker &other);
347 
348  ~TreeWalker();
349 
350 
354  Node root();
355 
363  unsigned long whatToShow();
364 
368  NodeFilter filter();
369 
384  bool expandEntityReferences();
385 
399  Node currentNode();
400 
404  void setCurrentNode(const Node &_currentNode);
405 
420  Node parentNode();
421 
436  Node firstChild();
437 
452  Node lastChild();
453 
468  Node previousSibling();
469 
484  Node nextSibling();
485 
500  Node previousNode();
501 
516  Node nextNode();
517 
522  TreeWalkerImpl *handle() const;
523  bool isNull() const;
524 
525 protected:
526  TreeWalker(TreeWalkerImpl *i);
527  TreeWalkerImpl *impl;
528 };
529 
530 
531 } // namespace
532 
533 #endif
DOM::CustomNodeFilter
CustomNodeFilter can be used to define your own NodeFilter for use with NodeIterators and TreeWalkers...
Definition: dom2_traversal.h:294
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:270
DOM::TreeWalker::impl
TreeWalkerImpl * impl
Definition: dom2_traversal.h:527
DOM::NodeFilter::AcceptCode
AcceptCode
The following constants are returned by the acceptNode() method:
Definition: dom2_traversal.h:203
DOM::NodeFilter::ShowCode
ShowCode
These are the available values for the whatToShow parameter.
Definition: dom2_traversal.h:216
DOM::TreeWalker
TreeWalker objects are used to navigate a document tree or subtree using the view of the document def...
Definition: dom2_traversal.h:338
dom_node.h
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:43
DOM::Document
The Document interface represents the entire HTML or XML document.
Definition: dom_doc.h:245
DOM::NodeFilter
Filters are objects that know how to "filter out" nodes.
Definition: dom2_traversal.h:183
DOM::NodeFilter::impl
NodeFilterImpl * impl
Definition: dom2_traversal.h:260
DOM::CustomNodeFilter::impl
CustomNodeFilterImpl * impl
Definition: dom2_traversal.h:316
dom_misc.h
DOM::DomShared
Definition: dom_misc.h:36
DOM::NodeIterator::impl
NodeIteratorImpl * impl
Definition: dom2_traversal.h:155
khtml_export.h
DOM::NodeIterator
NodeIterators are used to step through a set of nodes, e.g.
Definition: dom2_traversal.h:59
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:51:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KHTML

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal