arabica/include/DOM/NamedNodeMap.hpp

105 lines
3.3 KiB
C++
Raw Normal View History

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
{
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
template<class stringT, class string_adaptorT = Arabica::default_string_adaptor<stringT> >
2002-06-21 13:16:28 +02:00
class NamedNodeMap
{
public:
typedef Node<stringT, string_adaptorT> NodeT;
2002-06-21 13:16:28 +02:00
NamedNodeMap() : impl_(0) { }
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=
NodeT getNamedItem(const stringT& name) const { return NodeT(impl_->getNamedItem(name)); }
2002-06-21 13:16:28 +02:00
NodeT setNamedItem(const NodeT& arg) { return NodeT(impl_->setNamedItem(*arg.impl_)); }
2002-06-21 13:16:28 +02:00
NodeT removeNamedItem(const stringT& name) const { return NodeT(impl_->removeNamedItem(name)); }
2002-06-21 13:16:28 +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(); }
NodeT getNamedItemNS(const stringT& namespaceURI, const stringT& localName) const
2002-06-21 13:16:28 +02:00
{
return NodeT(impl_->getNamedItemNS(namespaceURI, localName));
2002-06-21 13:16:28 +02:00
} // getNamedItemNS
NodeT setNamedItemNS(const NodeT& arg) { return NodeT(impl_->setNamedItemNS(*arg.impl_)); }
2002-06-21 13:16:28 +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:
Proxy<NamedNodeMap_impl<stringT, string_adaptorT> > impl_;
2002-06-21 13:16:28 +02:00
}; // class NamedNodeMap
////////////////////////////////////////////////////
// NamedNodeMap_impl
template<class stringT, class string_adaptorT> class Node_impl;
2002-06-21 13:16:28 +02:00
template<class stringT, class string_adaptorT>
2002-06-21 13:16:28 +02:00
class NamedNodeMap_impl
{
public:
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
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
virtual Node_implT* item(unsigned int index) const = 0;
2002-06-21 13:16:28 +02:00
virtual unsigned int getLength() const = 0;
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