dom2_traversal.h
/*
* This file is part of the DOM implementation for KDE.
*
* (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 2000 Frederik Holljen (frederik.holljen@hig.no)
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
* This file includes excerpts from the Document Object Model (DOM)
* Level 2 Specification (Candidate Recommendation)
* http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510/
* Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved.
*
*/
#ifndef _dom2_traversal_h_
#define _dom2_traversal_h_
#include <dom/dom_node.h>
#include <dom/dom_misc.h>
#include <kdelibs_export.h>
namespace DOM {
class Node;
class NodeFilter;
class NodeImpl;
class NodeIteratorImpl;
class NodeFilterImpl;
class TreeWalkerImpl;
class CustomNodeFilter;
class CustomNodeFilterImpl;
class KHTML_EXPORT NodeIterator
{
friend class NodeIteratorImpl;
friend class Document;
public:
NodeIterator();
NodeIterator(const NodeIterator &other);
NodeIterator & operator = (const NodeIterator &other);
~NodeIterator();
Node root();
unsigned long whatToShow();
NodeFilter filter();
bool expandEntityReferences();
Node nextNode();
Node previousNode();
void detach();
NodeIteratorImpl *handle() const;
bool isNull() const;
protected:
NodeIteratorImpl *impl;
NodeIterator(NodeIteratorImpl *i);
};
class KHTML_EXPORT NodeFilter
{
friend class NodeIterator;
friend class NodeIteratorImpl;
friend class TreeWalker;
friend class TreeWalkerImpl;
friend class NodeFilterImpl;
public:
NodeFilter();
NodeFilter(const NodeFilter &other);
NodeFilter(NodeFilterImpl *i);
virtual NodeFilter & operator = (const NodeFilter &other);
virtual ~NodeFilter();
enum AcceptCode {
FILTER_ACCEPT = 1,
FILTER_REJECT = 2,
FILTER_SKIP = 3
};
enum ShowCode {
SHOW_ALL = 0xFFFFFFFF,
SHOW_ELEMENT = 0x00000001,
SHOW_ATTRIBUTE = 0x00000002,
SHOW_TEXT = 0x00000004,
SHOW_CDATA_SECTION = 0x00000008,
SHOW_ENTITY_REFERENCE = 0x00000010,
SHOW_ENTITY = 0x00000020,
SHOW_PROCESSING_INSTRUCTION = 0x00000040,
SHOW_COMMENT = 0x00000080,
SHOW_DOCUMENT = 0x00000100,
SHOW_DOCUMENT_TYPE = 0x00000200,
SHOW_DOCUMENT_FRAGMENT = 0x00000400,
SHOW_NOTATION = 0x00000800
};
virtual short acceptNode (const Node &n);
virtual NodeFilterImpl *handle() const;
virtual bool isNull() const;
void setCustomNodeFilter(CustomNodeFilter *custom);
CustomNodeFilter *customNodeFilter();
static NodeFilter createCustom(CustomNodeFilter *custom);
protected:
NodeFilterImpl *impl;
};
class KHTML_EXPORT CustomNodeFilter : public DomShared {
public:
CustomNodeFilter();
virtual ~CustomNodeFilter();
virtual short acceptNode (const Node &n);
virtual bool isNull();
virtual DOMString customNodeFilterType();
protected:
CustomNodeFilterImpl *impl;
};
class KHTML_EXPORT TreeWalker
{
friend class Document;
friend class TreeWalkerImpl;
public:
TreeWalker();
TreeWalker(const TreeWalker &other);
TreeWalker & operator = (const TreeWalker &other);
~TreeWalker();
Node root();
unsigned long whatToShow();
NodeFilter filter();
bool expandEntityReferences();
Node currentNode();
void setCurrentNode(const Node &_currentNode);
Node parentNode();
Node firstChild();
Node lastChild();
Node previousSibling();
Node nextSibling();
Node previousNode();
Node nextNode();
TreeWalkerImpl *handle() const;
bool isNull() const;
protected:
TreeWalker(TreeWalkerImpl *i);
TreeWalkerImpl *impl;
};
// ### not sure if this this class is really needed - both methods are in
// Document
} // namespace
#endif
DOM::CustomNodeFilter
CustomNodeFilter can be used to define your own NodeFilter for use with NodeIterators and TreeWalkers...
Definition: dom2_traversal.h:295
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:274
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::TreeWalker
TreeWalker objects are used to navigate a document tree or subtree using the view of the document def...
Definition: dom2_traversal.h:339
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:184
DOM::NodeIterator
NodeIterators are used to step through a set of nodes, e.g.
Definition: dom2_traversal.h:60

KDE Home | KDE Accessibility Home | Description of Access Keys