dom2_traversal.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _dom2_traversal_h_
00029 #define _dom2_traversal_h_
00030 #include <dom/dom_node.h>
00031 #include <dom/dom_misc.h>
00032
00033
00034 namespace DOM {
00035 class Node;
00036 class NodeFilter;
00037 class NodeImpl;
00038 class NodeIteratorImpl;
00039 class NodeFilterImpl;
00040 class TreeWalkerImpl;
00041 class CustomNodeFilter;
00042 class CustomNodeFilterImpl;
00043
00060 class NodeIterator
00061 {
00062 friend class NodeIteratorImpl;
00063 friend class Document;
00064 public:
00065 NodeIterator();
00066 NodeIterator(const NodeIterator &other);
00067
00068 NodeIterator & operator = (const NodeIterator &other);
00069
00070 ~NodeIterator();
00071
00075 Node root();
00076
00084 unsigned long whatToShow();
00085
00089 NodeFilter filter();
00090
00107 bool expandEntityReferences();
00108
00123 Node nextNode();
00124
00138 Node previousNode();
00139
00146 void detach();
00147
00152 NodeIteratorImpl *handle() const;
00153 bool isNull() const;
00154
00155 protected:
00156 NodeIteratorImpl *impl;
00157 NodeIterator(NodeIteratorImpl *i);
00158 };
00159
00160
00184 class NodeFilter
00185 {
00186 friend class NodeIterator;
00187 friend class NodeIteratorImpl;
00188 friend class TreeWalker;
00189 friend class TreeWalkerImpl;
00190 friend class NodeFilterImpl;
00191 public:
00192 NodeFilter();
00193 NodeFilter(const NodeFilter &other);
00194
00195 virtual NodeFilter & operator = (const NodeFilter &other);
00196
00197 virtual ~NodeFilter();
00203 enum AcceptCode {
00204 FILTER_ACCEPT = 1,
00205 FILTER_REJECT = 2,
00206 FILTER_SKIP = 3
00207 };
00208
00216 enum ShowCode {
00217 SHOW_ALL = 0xFFFFFFFF,
00218 SHOW_ELEMENT = 0x00000001,
00219 SHOW_ATTRIBUTE = 0x00000002,
00220 SHOW_TEXT = 0x00000004,
00221 SHOW_CDATA_SECTION = 0x00000008,
00222 SHOW_ENTITY_REFERENCE = 0x00000010,
00223 SHOW_ENTITY = 0x00000020,
00224 SHOW_PROCESSING_INSTRUCTION = 0x00000040,
00225 SHOW_COMMENT = 0x00000080,
00226 SHOW_DOCUMENT = 0x00000100,
00227 SHOW_DOCUMENT_TYPE = 0x00000200,
00228 SHOW_DOCUMENT_FRAGMENT = 0x00000400,
00229 SHOW_NOTATION = 0x00000800
00230 };
00231
00246 virtual short acceptNode (const Node &n);
00247
00252 virtual NodeFilterImpl *handle() const;
00253 virtual bool isNull() const;
00254
00255 void setCustomNodeFilter(CustomNodeFilter *custom);
00256 CustomNodeFilter *customNodeFilter();
00257 static NodeFilter createCustom(CustomNodeFilter *custom);
00258
00259 protected:
00260 NodeFilter(NodeFilterImpl *i);
00261 NodeFilterImpl *impl;
00262 };
00263
00295 class CustomNodeFilter : public DomShared {
00296 public:
00297 CustomNodeFilter();
00298 virtual ~CustomNodeFilter();
00299 virtual short acceptNode (const Node &n);
00300 virtual bool isNull();
00301
00310 virtual DOMString customNodeFilterType();
00311
00312 protected:
00317 CustomNodeFilterImpl *impl;
00318 };
00319
00339 class TreeWalker
00340 {
00341 friend class Document;
00342 friend class TreeWalkerImpl;
00343 public:
00344 TreeWalker();
00345 TreeWalker(const TreeWalker &other);
00346
00347 TreeWalker & operator = (const TreeWalker &other);
00348
00349 ~TreeWalker();
00350
00351
00355 Node root();
00356
00364 unsigned long whatToShow();
00365
00369 NodeFilter filter();
00370
00385 bool expandEntityReferences();
00386
00400 Node currentNode();
00401
00405 void setCurrentNode(const Node _currentNode);
00406
00421 Node parentNode();
00422
00437 Node firstChild();
00438
00453 Node lastChild();
00454
00469 Node previousSibling();
00470
00485 Node nextSibling();
00486
00501 Node previousNode();
00502
00517 Node nextNode();
00518
00523 TreeWalkerImpl *handle() const;
00524 bool isNull() const;
00525
00526 protected:
00527 TreeWalker(TreeWalkerImpl *i);
00528 TreeWalkerImpl *impl;
00529 };
00530
00531
00532
00533
00534
00615 }
00616
00617 #endif
This file is part of the documentation for kdelibs Version 3.1.4.