2002-06-21 13:16:28 +02:00
|
|
|
#ifndef JEZUK_DOM_NAMEDNODEMAP_H
|
|
|
|
#define JEZUK_DOM_NAMEDNODEMAP_H
|
|
|
|
|
|
|
|
////////////////////////////
|
|
|
|
// C++ DOM definition
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
////////////////////////////
|
|
|
|
|
2007-09-05 00:55:47 +02:00
|
|
|
#include <DOM/Proxy.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 NamedNodeMap_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 NamedNodeMap
|
|
|
|
{
|
|
|
|
public:
|
2007-09-08 00:03:27 +02:00
|
|
|
typedef Node<stringT, string_adaptorT> NodeT;
|
|
|
|
|
2002-06-21 13:16:28 +02:00
|
|
|
NamedNodeMap() : impl_(0) { }
|
2007-09-08 00:03:27 +02:00
|
|
|
explicit NamedNodeMap(NamedNodeMap_impl<stringT, string_adaptorT>* impl) : impl_(impl) { }
|
2002-06-21 13:16:28 +02:00
|
|
|
NamedNodeMap(const NamedNodeMap& rhs) : impl_(rhs.impl_) { }
|
|
|
|
virtual ~NamedNodeMap() { }
|
|
|
|
|
|
|
|
bool operator==(const NamedNodeMap& rhs) const { return impl_ == rhs.impl_; }
|
|
|
|
bool operator!=(const NamedNodeMap& rhs) const { return impl_ != rhs.impl_; }
|
|
|
|
bool operator==(int dummy) const { return impl_ == dummy; }
|
|
|
|
bool operator!=(int dummy) const { return impl_ != dummy; }
|
|
|
|
|
|
|
|
NamedNodeMap& operator=(const NamedNodeMap& rhs)
|
|
|
|
{
|
|
|
|
impl_ = rhs.impl_;
|
|
|
|
return *this;
|
|
|
|
} // operator=
|
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
NodeT getNamedItem(const stringT& name) const { return NodeT(impl_->getNamedItem(name)); }
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2009-11-25 11:23:27 +01:00
|
|
|
NodeT setNamedItem(const NodeT& arg) { return NodeT(impl_->setNamedItem(*arg.impl_)); }
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
NodeT removeNamedItem(const stringT& name) const { return NodeT(impl_->removeNamedItem(name)); }
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
NodeT item(unsigned int index) const { return NodeT(impl_->item(index)); }
|
2002-06-21 13:16:28 +02:00
|
|
|
|
|
|
|
unsigned int getLength() const { return impl_->getLength(); }
|
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
NodeT getNamedItemNS(const stringT& namespaceURI, const stringT& localName) const
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
2007-09-08 00:03:27 +02:00
|
|
|
return NodeT(impl_->getNamedItemNS(namespaceURI, localName));
|
2002-06-21 13:16:28 +02:00
|
|
|
} // getNamedItemNS
|
|
|
|
|
2009-11-25 11:23:27 +01:00
|
|
|
NodeT setNamedItemNS(const NodeT& arg) { return NodeT(impl_->setNamedItemNS(*arg.impl_)); }
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
NodeT removeNamedItemNS(const stringT& namespaceURI, const stringT& localName) const
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
2009-11-23 23:36:15 +01:00
|
|
|
return NodeT(impl_->removeNamedItemNS(namespaceURI, localName));
|
2002-06-21 13:16:28 +02:00
|
|
|
} // removeNamedItemNS
|
|
|
|
|
|
|
|
private:
|
2007-09-08 00:03:27 +02:00
|
|
|
Proxy<NamedNodeMap_impl<stringT, string_adaptorT> > impl_;
|
2002-06-21 13:16:28 +02:00
|
|
|
}; // class NamedNodeMap
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////
|
|
|
|
// NamedNodeMap_impl
|
2007-09-08 00:03:27 +02:00
|
|
|
template<class stringT, class string_adaptorT> class Node_impl;
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
template<class stringT, class string_adaptorT>
|
2002-06-21 13:16:28 +02:00
|
|
|
class NamedNodeMap_impl
|
|
|
|
{
|
|
|
|
public:
|
2007-09-08 00:03:27 +02:00
|
|
|
typedef Node_impl<stringT, string_adaptorT> Node_implT;
|
|
|
|
|
2005-08-07 22:16:02 +02:00
|
|
|
virtual ~NamedNodeMap_impl() { }
|
|
|
|
|
2002-06-21 13:16:28 +02:00
|
|
|
///////////////////////////////////////////////////////
|
|
|
|
// Ref counting
|
|
|
|
virtual void addRef() = 0;
|
|
|
|
virtual void releaseRef() = 0;
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////
|
|
|
|
// NamedNodeMap methods
|
2007-09-08 00:03:27 +02:00
|
|
|
virtual Node_implT* getNamedItem(const stringT& name) const = 0;
|
|
|
|
virtual Node_implT* setNamedItem(Node_implT* arg) = 0;
|
|
|
|
virtual Node_implT* removeNamedItem(const stringT& name) = 0;
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
virtual Node_implT* item(unsigned int index) const = 0;
|
2002-06-21 13:16:28 +02:00
|
|
|
|
|
|
|
virtual unsigned int getLength() const = 0;
|
|
|
|
|
2007-09-08 00:03:27 +02:00
|
|
|
virtual Node_implT* getNamedItemNS(const stringT& namespaceURI, const stringT& localName) const = 0;
|
|
|
|
virtual Node_implT* setNamedItemNS(Node_implT* arg) = 0;
|
|
|
|
virtual Node_implT* removeNamedItemNS(const stringT& namespaceURI, const stringT& localName) = 0;
|
2002-06-21 13:16:28 +02:00
|
|
|
}; // class NamedNodeMap_impl
|
|
|
|
|
|
|
|
} // namespace DOM
|
2007-09-05 13:47:13 +02:00
|
|
|
} // namespace Arabica
|
2002-06-21 13:16:28 +02:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|