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 #ifndef _dom2_traversal_h_
00028 #define _dom2_traversal_h_
00029 #include <dom/dom_node.h>
00030 #include <dom/dom_misc.h>
00031 
00032 
00033 namespace DOM {
00034 class Node;
00035 class NodeFilter;
00036 class NodeImpl;
00037 class NodeIteratorImpl;
00038 class NodeFilterImpl;
00039 class TreeWalkerImpl;
00040 class CustomNodeFilter;
00041 class CustomNodeFilterImpl;
00042 
00059 class NodeIterator
00060 {
00061     friend class NodeIteratorImpl;
00062     friend class Document;
00063 public:
00064     NodeIterator();
00065     NodeIterator(const NodeIterator &other);
00066 
00067     NodeIterator & operator = (const NodeIterator &other);
00068 
00069     ~NodeIterator();
00070 
00074     Node root();
00075 
00083     unsigned long whatToShow();
00084 
00088     NodeFilter filter();
00089 
00106     bool expandEntityReferences();
00107 
00122     Node nextNode();
00123 
00137     Node previousNode();
00138 
00145     void detach();
00146 
00151     NodeIteratorImpl *handle() const;
00152     bool isNull() const;
00153 
00154 protected:
00155     NodeIteratorImpl *impl;
00156     NodeIterator(NodeIteratorImpl *i);
00157 };
00158 
00159 
00183 class NodeFilter
00184 {
00185     friend class NodeIterator;
00186     friend class NodeIteratorImpl;
00187     friend class TreeWalker;
00188     friend class TreeWalkerImpl;
00189     friend class NodeFilterImpl;
00190 public:
00191     NodeFilter();
00192     NodeFilter(const NodeFilter &other);
00193 
00194     virtual NodeFilter & operator = (const NodeFilter &other);
00195 
00196     virtual ~NodeFilter();
00202     enum AcceptCode {
00203         FILTER_ACCEPT = 1,
00204         FILTER_REJECT = 2,
00205         FILTER_SKIP   = 3
00206     };
00207 
00215     enum ShowCode {
00216         SHOW_ALL                       = 0xFFFFFFFF,
00217         SHOW_ELEMENT                   = 0x00000001,
00218         SHOW_ATTRIBUTE                 = 0x00000002,
00219         SHOW_TEXT                      = 0x00000004,
00220         SHOW_CDATA_SECTION             = 0x00000008,
00221         SHOW_ENTITY_REFERENCE          = 0x00000010,
00222         SHOW_ENTITY                    = 0x00000020,
00223         SHOW_PROCESSING_INSTRUCTION    = 0x00000040,
00224         SHOW_COMMENT                   = 0x00000080,
00225         SHOW_DOCUMENT                  = 0x00000100,
00226         SHOW_DOCUMENT_TYPE             = 0x00000200,
00227         SHOW_DOCUMENT_FRAGMENT         = 0x00000400,
00228         SHOW_NOTATION                  = 0x00000800
00229     };
00230 
00245     virtual short acceptNode (const Node &n);
00246 
00251     virtual NodeFilterImpl *handle() const;
00252     virtual bool isNull() const;
00253 
00254     void setCustomNodeFilter(CustomNodeFilter *custom);
00255     CustomNodeFilter *customNodeFilter();
00256     static NodeFilter createCustom(CustomNodeFilter *custom);
00257 
00258 protected:
00259     NodeFilter(NodeFilterImpl *i);
00260     NodeFilterImpl *impl;
00261 };
00262 
00294 class CustomNodeFilter : public DomShared {
00295 public:
00296     CustomNodeFilter();
00297     virtual ~CustomNodeFilter();
00298     virtual short acceptNode (const Node &n);
00299     virtual bool isNull();
00300 
00309     virtual DOMString customNodeFilterType();
00310 
00311 protected:
00316     CustomNodeFilterImpl *impl;
00317 };
00318 
00338 class TreeWalker
00339 {
00340     friend class Document;
00341     friend class TreeWalkerImpl;
00342 public:
00343     TreeWalker();
00344     TreeWalker(const TreeWalker &other);
00345 
00346     TreeWalker & operator = (const TreeWalker &other);
00347 
00348     ~TreeWalker();
00349 
00350 
00354     Node root();
00355 
00363     unsigned long whatToShow();
00364 
00368     NodeFilter filter();
00369 
00384     bool expandEntityReferences();
00385 
00399     Node currentNode();
00400 
00404     void setCurrentNode(const Node _currentNode);
00405 
00420     Node parentNode();
00421 
00436     Node firstChild();
00437 
00452     Node lastChild();
00453 
00468     Node previousSibling();
00469 
00484     Node nextSibling();
00485 
00500     Node previousNode();
00501 
00516     Node nextNode();
00517 
00522     TreeWalkerImpl *handle() const;
00523     bool isNull() const;
00524 
00525 protected:
00526     TreeWalker(TreeWalkerImpl *i);
00527     TreeWalkerImpl *impl;
00528 };
00529 
00530 
00531 
00532 
00533 
00614 } 
00615 
00616 #endif
 
This file is part of the documentation for khtml Library Version 3.2.0.