| # khtml Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# dom2_traversal.h

    00001 /*
    00002  * This file is part of the DOM implementation for KDE.
    00003  *
    00004  * (C) 1999 Lars Knoll (knoll@kde.org)
    00005  * (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
    00006  * This library is free software; you can redistribute it and/or
    00007  * modify it under the terms of the GNU Library General Public
    00008  * License as published by the Free Software Foundation; either
    00009  * version 2 of the License, or (at your option) any later version.
    00010  *
    00011  * This library is distributed in the hope that it will be useful,
    00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014  * Library General Public License for more details.
    00015  *
    00016  * You should have received a copy of the GNU Library General Public License
    00017  * along with this library; see the file COPYING.LIB.  If not, write to
    00018  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00019  * Boston, MA 02111-1307, USA.
    00020  *
    00021  * This file includes excerpts from the Document Object Model (DOM)
    00022  * Level 2 Specification (Candidate Recommendation)
    00023  * http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/
    00024  * Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
    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 #include <kdelibs_export.h>
    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 KHTML_EXPORT 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 KHTML_EXPORT 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     NodeFilter(NodeFilterImpl *i);
    00195
    00196     virtual NodeFilter & operator = (const NodeFilter &other);
    00197
    00198     virtual ~NodeFilter();
    00204     enum AcceptCode {
    00205         FILTER_ACCEPT = 1,
    00206         FILTER_REJECT = 2,
    00207         FILTER_SKIP   = 3
    00208     };
    00209
    00217     enum ShowCode {
    00218         SHOW_ALL                       = 0xFFFFFFFF,
    00219         SHOW_ELEMENT                   = 0x00000001,
    00220         SHOW_ATTRIBUTE                 = 0x00000002,
    00221         SHOW_TEXT                      = 0x00000004,
    00222         SHOW_CDATA_SECTION             = 0x00000008,
    00223         SHOW_ENTITY_REFERENCE          = 0x00000010,
    00224         SHOW_ENTITY                    = 0x00000020,
    00225         SHOW_PROCESSING_INSTRUCTION    = 0x00000040,
    00226         SHOW_COMMENT                   = 0x00000080,
    00227         SHOW_DOCUMENT                  = 0x00000100,
    00228         SHOW_DOCUMENT_TYPE             = 0x00000200,
    00229         SHOW_DOCUMENT_FRAGMENT         = 0x00000400,
    00230         SHOW_NOTATION                  = 0x00000800
    00231     };
    00232
    00247     virtual short acceptNode (const Node &n);
    00248
    00253     virtual NodeFilterImpl *handle() const;
    00254     virtual bool isNull() const;
    00255
    00256     void setCustomNodeFilter(CustomNodeFilter *custom);
    00257     CustomNodeFilter *customNodeFilter();
    00258     static NodeFilter createCustom(CustomNodeFilter *custom);
    00259
    00260 protected:
    00261     NodeFilterImpl *impl;
    00262 };
    00263
    00295 class KHTML_EXPORT 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 KHTML_EXPORT 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 // ### not sure if this this class is really needed - both methods are in
    00533 // Document
    00534
    00615 } // namespace
    00616
    00617 #endif

This file is part of the documentation for khtml Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:33:10 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003