arabica/include/DOM/Traversal/NodeIterator.hpp

98 lines
2.8 KiB
C++
Raw Normal View History

2002-06-21 13:16:28 +02:00
#ifndef JEZUK_DOM_TRAVERSAL_NODEITERATOR_H
#define JEZUK_DOM_TRAVERSAL_NODEITERATOR_H
/////////////////////////////////////////
// C++ DOM Traversal Implementation
//
// $Id$
/////////////////////////////////////////
2007-09-05 00:55:47 +02:00
#include <DOM/Traversal/NodeFilter.hpp>
#include <DOM/Node.hpp>
2002-06-21 13:16:28 +02:00
2007-09-05 13:47:13 +02:00
namespace Arabica
{
2002-06-21 13:16:28 +02:00
namespace DOM
{
namespace Traversal
{
template<class stringT, class string_adaptorT> class NodeIterator_impl;
2002-06-21 13:16:28 +02:00
template<class stringT, class string_adaptorT = Arabica::default_string_adaptor<stringT> >
class NodeIterator : protected DOM::Proxy<NodeIterator_impl<stringT, string_adaptorT> >
2002-06-21 13:16:28 +02:00
{
public:
typedef NodeFilter<stringT, string_adaptorT> NodeFilterT;
typedef NodeIterator_impl<stringT, string_adaptorT> NodeIterator_implT;
typedef DOM::Node<stringT, string_adaptorT> NodeT;
2007-01-12 15:52:14 +01:00
private:
typedef DOM::Proxy<NodeIterator_implT> proxy_t;
2007-01-12 15:52:14 +01:00
2002-06-21 13:16:28 +02:00
public:
2007-01-12 15:52:14 +01:00
NodeIterator() : proxy_t(0) { }
explicit NodeIterator(NodeIterator_implT* const impl) : proxy_t(impl) { }
2007-01-12 15:52:14 +01:00
NodeIterator(const NodeIterator& rhs) : proxy_t(rhs) { }
2002-06-21 13:16:28 +02:00
virtual ~NodeIterator() { }
2007-01-12 15:52:14 +01:00
bool operator==(const NodeIterator& rhs) const { return proxy_t::operator==(rhs); }
bool operator!=(const NodeIterator& 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); }
2002-06-21 13:16:28 +02:00
NodeIterator& operator=(const NodeIterator& rhs)
{
2007-01-12 15:52:14 +01:00
proxy_t::operator=(rhs);
2002-06-21 13:16:28 +02:00
return *this;
} // operator=
///////////////////////////////////////////////////////////////
// NodeIterator methods
NodeT getRoot() const { return proxy_t::impl()->getRoot(); }
2002-06-21 13:16:28 +02:00
2007-01-12 15:52:14 +01:00
unsigned long getWhatToShow() const { return proxy_t::impl()->getWhatToShow(); }
2002-06-21 13:16:28 +02:00
NodeFilterT* getFilter() const { return proxy_t::impl()->getFilter(); }
2002-06-21 13:16:28 +02:00
2007-01-12 15:52:14 +01:00
bool getExpandEntityReferences() const { return proxy_t::impl()->getExpandEntityReferences(); }
2002-06-21 13:16:28 +02:00
NodeT nextNode() { return proxy_t::impl()->nextNode(); }
2002-06-21 13:16:28 +02:00
NodeT previousNode() { return proxy_t::impl()->prevNode(); }
2002-06-21 13:16:28 +02:00
2007-01-12 15:52:14 +01:00
void detach() { return proxy_t::impl()->detach(); }
2002-06-21 13:16:28 +02:00
}; // class NodeIterator
////////////////////////////////////////////////
template<class stringT, class string_adaptorT>
class NodeIterator_impl
2002-06-21 13:16:28 +02:00
{
public:
typedef NodeFilter<stringT, string_adaptorT> NodeFilterT;
typedef DOM::Node<stringT, string_adaptorT> NodeT;
virtual NodeT getRoot() const = 0;
2002-06-21 13:16:28 +02:00
virtual unsigned long getWhatToShow() const = 0;
2002-06-21 13:16:28 +02:00
virtual NodeFilterT* getFilter() const = 0;
2002-06-21 13:16:28 +02:00
virtual bool getExpandEntityReferences() const = 0;
virtual NodeT nextNode() = 0;
2002-06-21 13:16:28 +02:00
virtual NodeT previousNode() = 0;
2002-06-21 13:16:28 +02:00
virtual void detach() = 0;
}; // class NodeIterator_impl
} // namespace Traversal
} // namespace DOM
2007-09-05 13:47:13 +02:00
} // namespace Arabica
2002-06-21 13:16:28 +02:00
#endif
2007-01-12 15:52:14 +01:00
// end of file