From f85b6d5ab264910f272e69ce5997cebec54886ce Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 24 Feb 2009 22:03:34 +0100 Subject: Requests Status, DaemonStatus und UserList in XmlRequests umgewandelt --- src/Common/XmlRequest.h | 43 ++++++++----------------------------------- 1 file changed, 8 insertions(+), 35 deletions(-) (limited to 'src/Common/XmlRequest.h') diff --git a/src/Common/XmlRequest.h b/src/Common/XmlRequest.h index 0de0291..667b9a7 100644 --- a/src/Common/XmlRequest.h +++ b/src/Common/XmlRequest.h @@ -20,6 +20,7 @@ #ifndef MAD_COMMON_XMLREQUEST_H_ #define MAD_COMMON_XMLREQUEST_H_ +#include "XmlPacket.h" #include "XmlRequestBase.h" #include "Exception.h" @@ -29,15 +30,15 @@ namespace Mad { namespace Common { -template class XmlRequest : public XmlRequestBase { +class XmlRequest : public XmlRequestBase { private: - sigc::signal&> finished; + sigc::signal finished; - std::auto_ptr res; + std::auto_ptr res; Exception exp; public: - typedef sigc::slot&> slot_type; + typedef sigc::slot slot_type; protected: XmlRequest(slot_type slot) : exp(Exception::NOT_FINISHED) { @@ -45,12 +46,12 @@ template class XmlRequest : public XmlRequestBase { finished.connect(sigc::hide(signalFinished().make_slot())); } - void finish(std::auto_ptr result) {res = result; finished(*this);} - void finish(const T& result) {res.reset(new T(result)); finished(*this);} + void finish(std::auto_ptr result) {res = result; finished(*this);} + void finish(const XmlPacket& result) {res.reset(new XmlPacket(result)); finished(*this);} void finishWithError(const Exception &e) {exp = e; finished(*this);} public: - const T& getResult() const throw(Exception) { + const XmlPacket& getResult() const throw(Exception) { if(res.get()) return *res; @@ -58,34 +59,6 @@ template class XmlRequest : public XmlRequestBase { } }; -template<> class XmlRequest : public XmlRequestBase { - private: - sigc::signal&> finished; - - bool isFinished; - Exception exp; - - public: - typedef sigc::slot&> slot_type; - - protected: - XmlRequest(slot_type slot) : isFinished(false), exp(Exception::NOT_FINISHED) { - finished.connect(slot); - finished.connect(sigc::hide(signalFinished().make_slot())); - } - - void finish() {isFinished = true; finished(*this);} - void finishWithError(const Exception &e) {exp = e; finished(*this);} - - public: - void getResult() const throw(Exception) { - if(isFinished) - return; - - throw exp; - } -}; - } } -- cgit v1.2.3