#ifndef JEZUK_DOM_EVENTS_DOCUMENEVENTS_H #define JEZUK_DOM_EVENTS_DOCUMENEVENTS_H ///////////////////////////////////////// // C++ DOM Events Implementation // // $Id$ ///////////////////////////////////////// #include namespace Arabica { namespace DOM { namespace Events { template class Event; template class DocumentEvent_impl; template class DocumentEvent : protected Arabica::DOM::Proxy > { public: typedef DocumentEvent_impl DocumentEvent_implT; typedef DOM::Proxy proxy_t; DocumentEvent() : proxy_t(0) { } explicit DocumentEvent(DocumentEvent_implT* const impl) : proxy_t(impl) { } DocumentEvent(const DocumentEvent& rhs) : proxy_t(rhs) { } explicit DocumentEvent(const DOM::Document& rhs) : proxy_t(rhs.dImpl()) { if(dynamic_cast(rhs.dImpl()) == 0) throw DOM::DOMException(DOM::DOMException::NOT_SUPPORTED_ERR); } // DocumentEvent virtual ~DocumentEvent() { } bool operator==(const DocumentEvent& rhs) const { return proxy_t::operator==(rhs); } bool operator!=(const DocumentEvent& rhs) const { return proxy_t::operator!=(rhs); } bool operator==(int dummy) const { return proxy_t::operator==(dummy); } bool operator!=(int dummy) const { return proxy_t::operator!=(dummy); } DocumentEvent& operator=(const DocumentEvent& rhs) { proxy_t::operator=(rhs); return *this; } // operator= /////////////////////////////////////////////////// // DocumentEvent methods Event createEvent(const char* eventType) { return Event(Impl()->createEvent(eventType)); } // createEvent private: DocumentEvent_implT* Impl() const { return dynamic_cast(Impl()); } }; // class DocumentEvent ////////////////////////////////////////////////////////////// // implementation class template class Event_impl; template class DocumentEvent_impl { public: virtual Event_impl* createEvent(const char* eventType) = 0; }; // class DocumentEvent_impl } // namespace Events } // namespace DOM } // namespace Arabica #endif // end of file