arabica/include/DOM/DOMImplementation.hpp

102 lines
3.6 KiB
C++
Raw Permalink Normal View History

2002-06-21 13:16:28 +02:00
#ifndef JEZUK_DOM_DOMIMPLEMENTATION_H
#define JEZUK_DOM_DOMIMPLEMENTATION_H
////////////////////////////
// C++ DOM definition
//
// $Id$
////////////////////////////
2007-09-05 00:55:47 +02:00
#include <DOM/Proxy.hpp>
#include <Arabica/StringAdaptor.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 Document;
template<class stringT, class string_adaptorT> class DocumentType;
template<class stringT, class string_adaptorT> class DOMImplementation_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 DOMImplementation
{
public:
DOMImplementation() : impl_(0) { }
DOMImplementation(DOMImplementation_impl<stringT, string_adaptorT>* impl) : impl_(impl) { }
2002-06-21 13:16:28 +02:00
DOMImplementation(const DOMImplementation& rhs) : impl_(rhs.impl_) { }
2007-01-02 12:32:48 +01:00
operator bool() const { return impl_; }
2002-06-21 13:16:28 +02:00
bool operator==(const DOMImplementation& rhs) const { return impl_ == rhs.impl_; }
bool operator!=(const DOMImplementation& rhs) const { return impl_ != rhs.impl_; }
bool operator==(int dummy) const { return impl_ == dummy; }
bool operator!=(int dummy) const { return impl_ != dummy; }
DOMImplementation& operator=(const DOMImplementation& rhs)
{
impl_ = rhs.impl_;
return *this;
} // operator=
bool hasFeature(const stringT& feature, const stringT& version) const
{
return impl_->hasFeature(feature, version);
} // hasFeature
DocumentType<stringT, string_adaptorT> createDocumentType(const stringT& qualifiedName,
2002-06-21 13:16:28 +02:00
const stringT& publicId,
const stringT& systemId) const
2002-06-21 13:16:28 +02:00
{
return impl_->createDocumentType(qualifiedName, publicId, systemId);
} // createDocumentType
Document<stringT, string_adaptorT> createDocument(const stringT& namespaceURI,
2002-06-21 13:16:28 +02:00
const stringT& qualifiedName,
DocumentType<stringT, string_adaptorT> docType) const
2002-06-21 13:16:28 +02:00
{
return impl_->createDocument(namespaceURI, qualifiedName, docType.dtImpl());
} // createDocument
private:
Proxy<DOMImplementation_impl<stringT, string_adaptorT> > impl_;
2002-06-21 13:16:28 +02:00
}; // class DOMImplementation
/////////////////////////////////////////////////
template<class stringT, class string_adaptorT> class Document_impl;
template<class stringT, class string_adaptorT> class DocumentType_impl;
2002-06-21 13:16:28 +02:00
// derive from this class to implement your own
// DOM provider
template<class stringT, class string_adaptorT>
2002-06-21 13:16:28 +02:00
class DOMImplementation_impl
{
public:
///////////////////////////////////////////////////////
// Ref counting
virtual void addRef() = 0;
virtual void releaseRef() = 0;
///////////////////////////////////////////////////////
// DOM implementation methods
virtual bool hasFeature(const stringT& feature, const stringT& version) const = 0;
virtual DocumentType_impl<stringT, string_adaptorT>* createDocumentType(const stringT& qualifiedName,
2002-06-21 13:16:28 +02:00
const stringT& publicId,
const stringT& systemId) = 0;
virtual Document_impl<stringT, string_adaptorT>* createDocument(const stringT& namespaceURI,
2002-06-21 13:16:28 +02:00
const stringT& qualifiedName,
DocumentType_impl<stringT, string_adaptorT>* docType) = 0;
2002-06-21 13:16:28 +02:00
protected:
DOMImplementation_impl() { }
virtual ~DOMImplementation_impl() { }
}; // class DOMImplementation_impl
} // namespace DOM
2007-09-05 13:47:13 +02:00
} // namespace Arabica
2002-06-21 13:16:28 +02:00
#endif // JEZUK_DOM_NODE_H
// end of file