#ifndef JEZUK_DOM_TRAVERSAL_TREEWALKER_H #define JEZUK_DOM_TRAVERSAL_TREEWALKER_H ///////////////////////////////////////// // C++ DOM Traversal Implementation // // $Id$ ///////////////////////////////////////// #include namespace DOM { namespace Traversal { template class TreeWalker_impl; template class TreeWalker : protected DOM::Proxy { public: TreeWalker() : Proxy(0) { } explicit TreeWalker(TreeWalker_impl* const impl) : Proxy(impl) { } TreeWalker(const TreeWalker& rhs) : Proxy(rhs) { } virtual ~TreeWalker() { } bool operator==(const TreeWalker& rhs) const { return Proxy::operator==(rhs); } bool operator!=(const TreeWalker& rhs) const { return Proxy::operator!=(rhs); } bool operator==(int dummy) const { return Proxy::operator==(dummy); } bool operator!=(int dummy) const { return Proxy::operator!=(dummy); } TreeWalker& operator=(const TreeWalker& rhs) { Proxy::operator=(rhs); return *this; } // operator= /////////////////////////////////////////////////////////////// // TreeWalker methods DOM::Node getRoot() const { return Impl()->getRoot(); } int getWhatToShow() const { return Impl()->getWhatToShow(); } NodeFilter* getFilter() const { return Impl()->getFilter(); } bool getExpandEntityReferences() const { return Impl()->getExpandEntityReferences(); } DOM::Node getCurrentNode() const { return Impl()->getCurretNode(); } void setCurrentNode(const DOM::Node& currentNode) { Impl()->setCurrentNode(currentNode); } DOM::Node parentNode() const { return Impl()->parentNode(); } DOM::Node firstChild() const { return Impl()->firstChild(); } DOM::Node lastChild() const { return Impl()->lastChild(); } DOM::Node previousSibling() const { return Impl()->previousSibling(); } DOM::Node nextSibling() { return Impl()->nextSibling(); } DOM::Node previousNode() { return Impl()->prevNode(); } DOM::Node nextNode() { return Impl()->nextNode(); } private: TreeWalker_impl* Impl() const { return dynamic_cast*>(impl()); } }; // class TreeWalker //////////////////////////////////////////////// template class TreeWalker_impl : virtual public DOM::Impl { public: virtual DOM::Node getRoot() const = 0; virtual int getWhatToShow() const = 0; virtual NodeFilter* getFilter() const = 0; virtual bool getExpandEntityReferences() const = 0; virtual DOM::Node getCurrentNode() const = 0; virtual void setCurrentNode(const DOM::Node& currentNode) = 0; virtual DOM::Node parentNode() const = 0; virtual DOM::Node firstChild() const = 0; virtual DOM::Node lastChild() const = 0; virtual DOM::Node previousSibling() const = 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