arabica/DOM/CDATASection.h
craigp98072 3f48a78dba various fixes to placate gcc 4.0.2 compiler
(mostly adding typenames and templates, changing std::bad_cast to std::runtime_error)
2005-10-22 03:17:39 +00:00

48 lines
1.3 KiB
C++

#ifndef JEZUK_DOM_CDATASECTION_H
#define JEZUK_DOM_CDATASECTION_H
////////////////////////////
// C++ DOM definition
//
// $Id$
////////////////////////////
#include <DOM/Text.h>
namespace DOM
{
template<class stringT> class CDATASection_impl;
template<class stringT>
class CDATASection : public Text<stringT>
{
typedef Text<stringT> TextT;
public:
CDATASection() : Text<stringT>() { }
explicit CDATASection(CDATASection_impl<stringT>* impl) : Text<stringT>(impl) { }
CDATASection(const CDATASection& rhs) : Text<stringT>(rhs) { }
explicit CDATASection(const Node<stringT>& rhs) : Text<stringT>(rhs, 0)
{
if(rhs.getNodeType() != Node_base::CDATA_SECTION_NODE)
throw std::runtime_error("bad_cast: Cannot convert Node to CDATA section");
} // CDATASection
CDATASection<stringT> splitText(int offset)
{
TextT::tImpl()->throwIfReadOnly();
return static_cast<CDATASection<stringT> >(TextT::tImpl()->splitText(offset));
} // splitText
}; // class CDATASection
////////////////////////////////////////////////////////////////////
template<class stringT>
class CDATASection_impl : public virtual Text_impl<stringT>
{
public:
virtual ~CDATASection_impl() { }
}; // CDATASection_impl
} // namespace DOM
#endif