2002-06-21 13:16:28 +02:00
|
|
|
#ifndef JEZUK_DOM_NODELIST_H
|
|
|
|
#define JEZUK_DOM_NODELIST_H
|
|
|
|
|
|
|
|
////////////////////////////
|
|
|
|
// C++ DOM definition
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
////////////////////////////
|
|
|
|
|
2007-09-05 00:55:47 +02:00
|
|
|
#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
|
|
|
|
{
|
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
template<class stringT, class string_adaptorT> class Node;
|
|
|
|
template<class stringT, class string_adaptorT> class NodeList_impl;
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2007-09-09 00:31:24 +02:00
|
|
|
template<class stringT, class string_adaptorT = Arabica::default_string_adaptor<stringT> >
|
2002-06-21 13:16:28 +02:00
|
|
|
class NodeList
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NodeList() : impl_(0) { }
|
2007-09-08 00:03:27 +02:00
|
|
|
explicit NodeList(NodeList_impl<stringT, string_adaptorT>* const impl) : impl_(impl) { }
|
2002-06-21 13:16:28 +02:00
|
|
|
NodeList(const NodeList& rhs) : impl_(rhs.impl_) { }
|
|
|
|
virtual ~NodeList() { }
|
|
|
|
|
|
|
|
bool operator==(const NodeList& rhs) const { return impl_ == rhs.impl_; }
|
|
|
|
bool operator!=(const NodeList& rhs) const { return impl_ != rhs.impl_; }
|
|
|
|
bool operator==(int dummy) const { return impl_ == dummy; }
|
|
|
|
bool operator!=(int dummy) const { return impl_ != dummy; }
|
|
|
|
|
|
|
|
NodeList& operator=(const NodeList& rhs)
|
|
|
|
{
|
|
|
|
impl_ = rhs.impl_;
|
|
|
|
return *this;
|
|
|
|
} // operator=
|
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
Node<stringT, string_adaptorT> item(unsigned int index) const { return impl_->item(index); }
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2010-12-09 12:35:54 +01:00
|
|
|
unsigned int getLength() const
|
|
|
|
{
|
|
|
|
if(impl_ == 0)
|
|
|
|
return 0;
|
|
|
|
return impl_->getLength();
|
|
|
|
} // getLength
|
2002-06-21 13:16:28 +02:00
|
|
|
|
|
|
|
private:
|
2007-09-08 00:03:27 +02:00
|
|
|
Proxy<NodeList_impl<stringT, string_adaptorT> > impl_;
|
2002-06-21 13:16:28 +02:00
|
|
|
}; // class NodeList
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////
|
2007-09-08 00:03:27 +02:00
|
|
|
template<class stringT, class string_adaptorT>
|
2002-06-21 13:16:28 +02:00
|
|
|
class NodeList_impl
|
|
|
|
{
|
|
|
|
public:
|
2005-08-07 22:16:02 +02:00
|
|
|
virtual ~NodeList_impl() { }
|
|
|
|
|
2002-06-21 13:16:28 +02:00
|
|
|
///////////////////////////////////////////////////////
|
|
|
|
// Ref counting
|
|
|
|
virtual void addRef() = 0;
|
|
|
|
virtual void releaseRef() = 0;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////
|
|
|
|
// NodeList methods
|
2007-09-08 00:03:27 +02:00
|
|
|
virtual Node_impl<stringT, string_adaptorT>* item(unsigned int index) const = 0;
|
2002-06-21 13:16:28 +02:00
|
|
|
|
|
|
|
virtual unsigned int getLength() const = 0;
|
|
|
|
}; // class NodeList_impl
|
|
|
|
|
|
|
|
} // namespace DOM
|
2007-09-05 13:47:13 +02:00
|
|
|
} // namespace Arabica
|
2002-06-21 13:16:28 +02:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|