#ifndef JEZUK_DOM_TRAVERSAL_TREEWALKER_H #define JEZUK_DOM_TRAVERSAL_TREEWALKER_H ///////////////////////////////////////// // C++ DOM Traversal Implementation // // $Id$ ///////////////////////////////////////// #include #include #include namespace DOM { namespace Traversal { template class TreeWalker_impl; template class TreeWalker : protected DOM::Proxy > { private: typedef DOM::Proxy > proxy_t; typedef typename proxy_t::value_type impl_t; public: TreeWalker() : proxy_t(0) { } explicit TreeWalker(TreeWalker_impl* const impl) : proxy_t(impl) { } TreeWalker(const TreeWalker& rhs) : proxy_t(rhs) { } virtual ~TreeWalker() { } bool operator==(const TreeWalker& rhs) const { return proxy_t::operator==(rhs); } bool operator!=(const TreeWalker& rhs) const { return proxy_t::operator!=(rhs); } bool operator==(int dummy) const { return proxy_t::operator==(dummy); } bool operator!=(int dummy) const { return proxy_t::operator!=(dummy); } TreeWalker& operator=(const TreeWalker& rhs) { proxy_t::operator=(rhs); return *this; } // operator= /////////////////////////////////////////////////////////////// // TreeWalker methods DOM::Node getRoot() { return proxy_t::impl()->getRoot(); } unsigned long getWhatToShow() { return proxy_t::impl()->getWhatToShow(); } NodeFilter* getFilter() { return proxy_t::impl()->getFilter(); } bool getExpandEntityReferences() { return proxy_t::impl()->getExpandEntityReferences(); } DOM::Node getCurrentNode() { return proxy_t::impl()->getCurrentNode(); } void setCurrentNode(const DOM::Node& currentNode) { proxy_t::impl()->setCurrentNode(currentNode); } DOM::Node parentNode() { return proxy_t::impl()->parentNode(); } DOM::Node firstChild() { return proxy_t::impl()->firstChild(); } DOM::Node lastChild() { return proxy_t::impl()->lastChild(); } DOM::Node previousSibling() { return proxy_t::impl()->previousSibling(); } DOM::Node nextSibling() { return proxy_t::impl()->nextSibling(); } DOM::Node previousNode() { return proxy_t::impl()->previousNode(); } DOM::Node nextNode() { return proxy_t::impl()->nextNode(); } }; // class TreeWalker //////////////////////////////////////////////// template class TreeWalker_impl : public TraversalImpl { public: virtual DOM::Node getRoot() = 0; virtual unsigned long getWhatToShow() = 0; virtual NodeFilter* getFilter() = 0; virtual bool getExpandEntityReferences() = 0; virtual DOM::Node getCurrentNode() = 0; virtual void setCurrentNode(const DOM::Node& currentNode) = 0; virtual DOM::Node parentNode() = 0; virtual DOM::Node firstChild() = 0; virtual DOM::Node lastChild() = 0; virtual DOM::Node previousSibling() = 0; virtual DOM::Node nextSibling() = 0; virtual DOM::Node previousNode() = 0; virtual DOM::Node nextNode() = 0; }; // class TreeWalker_impl } // namespace Traversal } // namespace DOM #endif // end of file