dom2_traversal.cpp
#include "dom/dom_exception.h"
#include "dom/dom_string.h"
#include "xml/dom2_traversalimpl.h"
using namespace DOM;
NodeIterator::NodeIterator()
{
impl = 0;
}
NodeIterator::NodeIterator(const NodeIterator &other)
{
impl = other.impl;
if (impl) impl->ref();
}
NodeIterator::NodeIterator(NodeIteratorImpl *i)
{
impl = i;
if (impl) impl->ref();
}
NodeIterator &NodeIterator::operator = (const NodeIterator &other)
{
if ( impl != other.impl ) {
if (impl) impl->deref();
impl = other.impl;
if (impl) impl->ref();
}
return *this;
}
NodeIterator::~NodeIterator()
{
if (impl) impl->deref();
}
Node NodeIterator::root()
{
if (impl) return impl->root();
return 0;
}
unsigned long NodeIterator::whatToShow()
{
if (impl) return impl->whatToShow();
return 0;
}
NodeFilter NodeIterator::filter()
{
if (impl) return impl->filter();
return 0;
}
bool NodeIterator::expandEntityReferences()
{
if (impl) return impl->expandEntityReferences();
return 0;
}
Node NodeIterator::nextNode( )
{
if (!impl)
throw DOMException(DOMException::INVALID_STATE_ERR);
int exceptioncode = 0;
NodeImpl *r = impl->nextNode(exceptioncode);
if (exceptioncode)
throw DOMException(exceptioncode);
return r;
}
Node NodeIterator::previousNode( )
{
if (!impl)
throw DOMException(DOMException::INVALID_STATE_ERR);
int exceptioncode = 0;
NodeImpl *r = impl->previousNode(exceptioncode);
if (exceptioncode)
throw DOMException(exceptioncode);
return r;
}
void NodeIterator::detach()
{
if (!impl)
throw DOMException(DOMException::INVALID_STATE_ERR);
int exceptioncode = 0;
impl->detach(exceptioncode);
if (exceptioncode)
throw DOMException(exceptioncode);
}
NodeIteratorImpl *NodeIterator::handle() const
{
return impl;
}
bool NodeIterator::isNull() const
{
return (impl == 0);
}
// -----------------------------------------------------------
NodeFilter::NodeFilter()
{
impl = 0;
}
NodeFilter::NodeFilter(const NodeFilter &other)
{
impl = other.impl;
if (impl) impl->ref();
}
NodeFilter::NodeFilter(NodeFilterImpl *i)
{
impl = i;
if (impl) impl->ref();
}
NodeFilter &NodeFilter::operator = (const NodeFilter &other)
{
if ( impl != other.impl ) {
if (impl) impl->deref();
impl = other.impl;
if (impl) impl->ref();
}
return *this;
}
NodeFilter::~NodeFilter()
{
if (impl) impl->deref();
}
short NodeFilter::acceptNode(const Node &n)
{
if (impl) return impl->acceptNode(n);
return 0;
}
void NodeFilter::setCustomNodeFilter(CustomNodeFilter *custom)
{
if (impl) impl->setCustomNodeFilter(custom);
}
CustomNodeFilter *NodeFilter::customNodeFilter()
{
if (impl) return impl->customNodeFilter();
return 0;
}
NodeFilterImpl *NodeFilter::handle() const
{
return impl;
}
bool NodeFilter::isNull() const
{
return (impl == 0);
}
NodeFilter NodeFilter::createCustom(CustomNodeFilter *custom)
{
NodeFilterImpl *i = new NodeFilterImpl();
i->setCustomNodeFilter(custom);
return i;
}
// --------------------------------------------------------------
CustomNodeFilter::CustomNodeFilter()
{
impl = 0;
}
CustomNodeFilter::~CustomNodeFilter()
{
}
short CustomNodeFilter::acceptNode (const Node &/*n*/)
{
return NodeFilter::FILTER_ACCEPT;
}
bool CustomNodeFilter::isNull()
{
return false;
}
DOMString CustomNodeFilter::customNodeFilterType()
{
return "";
}
// --------------------------------------------------------------
TreeWalker::TreeWalker()
{
impl = 0;
}
TreeWalker::TreeWalker(const TreeWalker &other)
{
impl = other.impl;
if (impl) impl->ref();
}
TreeWalker::TreeWalker(TreeWalkerImpl *i)
{
impl = i;
if (impl) impl->ref();
}
TreeWalker & TreeWalker::operator = (const TreeWalker &other)
{
if ( impl != other.impl ) {
if (impl) impl->deref();
impl = other.impl;
if (impl) impl->ref();
}
return *this;
}
TreeWalker::~TreeWalker()
{
if (impl) impl->deref();
}
Node TreeWalker::root()
{
if (impl) return impl->getRoot();
return 0;
}
unsigned long TreeWalker::whatToShow()
{
if (impl) return impl->getWhatToShow();
return 0;
}
NodeFilter TreeWalker::filter()
{
if (impl) return impl->getFilter();
return 0;
}
bool TreeWalker::expandEntityReferences()
{
if (impl) return impl->getExpandEntityReferences();
return false;
}
Node TreeWalker::currentNode()
{
if (impl) return impl->getCurrentNode();
return 0;
}
void TreeWalker::setCurrentNode(const Node& _currentNode)
{
if (impl) impl->setCurrentNode(_currentNode.handle());
}
Node TreeWalker::parentNode()
{
if (impl) return impl->parentNode();
return 0;
}
Node TreeWalker::firstChild()
{
if (impl) return impl->firstChild();
return 0;
}
Node TreeWalker::lastChild()
{
if (impl) return impl->lastChild();
return 0;
}
Node TreeWalker::previousSibling()
{
if (impl) return impl->previousSibling();
return 0;
}
Node TreeWalker::nextSibling()
{
if (impl) return impl->nextSibling();
return 0;
}
Node TreeWalker::previousNode()
{
if (impl) return impl->previousNode();
return 0;
}
Node TreeWalker::nextNode()
{
if (impl) return impl->nextNode();
return 0;
}
TreeWalkerImpl *TreeWalker::handle() const
{
return impl;
}
bool TreeWalker::isNull() const
{
return (impl == 0);
}
// -----------------------------------------------------------------------
/*DocumentTraversal::DocumentTraversal()
{
}
DocumentTraversal::DocumentTraversal(const DocumentTraversal &other)
{
}
DocumentTraversal &DocumentTraversal::operator = (const DocumentTraversal &other)
{
DocumentTraversal::operator = (other);
return *this;
}
DocumentTraversal::~DocumentTraversal()
{
}
NodeIterator DocumentTraversal::createNodeIterator( const Node &root, long whatToShow,
const NodeFilter &filter,
bool entityReferenceExpansion )
{
return NodeIterator();
}
TreeWalker DocumentTraversal::createTreeWalker( const Node &root, long whatToShow,
const NodeFilter &filter,
bool entityReferenceExpansion )
{
return TreeWalker();
}
*/
DOM::CustomNodeFilter
CustomNodeFilter can be used to define your own NodeFilter for use with NodeIterators and TreeWalkers...
Definition: dom2_traversal.h:295
DOM::TreeWalker::root
Node root()
The root node of the TreeWalker, as specified when it was created.
Definition: dom2_traversal.cpp:259
DOM::Node
The Node interface is the primary datatype for the entire Document Object Model.
Definition: dom_node.h:274
DOM::TreeWalker::filter
NodeFilter filter()
The filter used to screen nodes.
Definition: dom2_traversal.cpp:271
DOM::TreeWalker::previousSibling
Node previousSibling()
Moves the TreeWalker to the previous sibling of the current node, and returns the new node...
Definition: dom2_traversal.cpp:312
DOM::TreeWalker::nextSibling
Node nextSibling()
Moves the TreeWalker to the next sibling of the current node, and returns the new node...
Definition: dom2_traversal.cpp:318
DOM::TreeWalker::whatToShow
unsigned long whatToShow()
This attribute determines which node types are presented via the TreeWalker.
Definition: dom2_traversal.cpp:265
DOM::TreeWalker::previousNode
Node previousNode()
Moves the TreeWalker to the previous node in document order relative to the current node...
Definition: dom2_traversal.cpp:324
DOM::DOMException
DOM operations only raise exceptions in "exceptional" circumstances, i.e., when an operation is impos...
Definition: dom_exception.h:57
DOM::NodeIterator::whatToShow
unsigned long whatToShow()
This attribute determines which node types are presented via the iterator.
Definition: dom2_traversal.cpp:68
DOM::NodeIterator::nextNode
Node nextNode()
Returns the next node in the set and advances the position of the Iterator in the set...
Definition: dom2_traversal.cpp:86
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::NodeFilter::acceptNode
virtual short acceptNode(const Node &n)
Test whether a specified node is visible in the logical view of a TreeWalker or NodeIterator.
Definition: dom2_traversal.cpp:165
DOM::NodeIterator::filter
NodeFilter filter()
The NodeFilter used to screen nodes.
Definition: dom2_traversal.cpp:74
DOM::TreeWalker::currentNode
Node currentNode()
The node at which the TreeWalker is currently positioned.
Definition: dom2_traversal.cpp:283
DOM::DOMString
This class implements the basic string we use in the DOM.
Definition: dom_string.h:43
DOM::TreeWalker::firstChild
Node firstChild()
Moves the TreeWalker to the first child of the current node, and returns the new node.
Definition: dom2_traversal.cpp:300
DOM::NodeIterator::root
Node root()
The root node of the NodeIterator, as specified when it was created.
Definition: dom2_traversal.cpp:62
DOM::NodeIterator::previousNode
Node previousNode()
Returns the previous node in the set and moves the position of the Iterator backwards in the set...
Definition: dom2_traversal.cpp:98
DOM::NodeFilter
Filters are objects that know how to "filter out" nodes.
Definition: dom2_traversal.h:184
DOM::TreeWalker::setCurrentNode
void setCurrentNode(const Node &_currentNode)
see currentNode
Definition: dom2_traversal.cpp:289
DOM::TreeWalker::expandEntityReferences
bool expandEntityReferences()
The value of this flag determines whether the children of entity reference nodes are visible to the T...
Definition: dom2_traversal.cpp:277
DOM::NodeIterator
NodeIterators are used to step through a set of nodes, e.g.
Definition: dom2_traversal.h:60
DOM::TreeWalker::lastChild
Node lastChild()
Moves the TreeWalker to the last child of the current node, and returns the new node.
Definition: dom2_traversal.cpp:306
DOM::NodeIterator::detach
void detach()
Detaches the NodeIterator from the set which it iterated over, releasing any computational resources ...
Definition: dom2_traversal.cpp:110
DOM::NodeIterator::expandEntityReferences
bool expandEntityReferences()
The value of this flag determines whether the children of entity reference nodes are visible to the i...
Definition: dom2_traversal.cpp:80
DOM::TreeWalker::nextNode
Node nextNode()
Moves the TreeWalker to the next node in document order relative to the current node, and returns the new node.
Definition: dom2_traversal.cpp:330
DOM::TreeWalker::parentNode
Node parentNode()
Moves to and returns the parent node of the current node.
Definition: dom2_traversal.cpp:294

KDE Home | KDE Accessibility Home | Description of Access Keys