diff options
Diffstat (limited to 'src/Common/XmlRequest.h')
-rw-r--r-- | src/Common/XmlRequest.h | 43 |
1 files changed, 8 insertions, 35 deletions
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<typename T = void> class XmlRequest : public XmlRequestBase { +class XmlRequest : public XmlRequestBase { private: - sigc::signal<void,const XmlRequest<T>&> finished; + sigc::signal<void,const XmlRequest&> finished; - std::auto_ptr<T> res; + std::auto_ptr<XmlPacket> res; Exception exp; public: - typedef sigc::slot<void,const XmlRequest<T>&> slot_type; + typedef sigc::slot<void,const XmlRequest&> slot_type; protected: XmlRequest(slot_type slot) : exp(Exception::NOT_FINISHED) { @@ -45,12 +46,12 @@ template<typename T = void> class XmlRequest : public XmlRequestBase { finished.connect(sigc::hide(signalFinished().make_slot())); } - void finish(std::auto_ptr<T> result) {res = result; finished(*this);} - void finish(const T& result) {res.reset(new T(result)); finished(*this);} + void finish(std::auto_ptr<XmlPacket> 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<typename T = void> class XmlRequest : public XmlRequestBase { } }; -template<> class XmlRequest<void> : public XmlRequestBase { - private: - sigc::signal<void,const XmlRequest<void>&> finished; - - bool isFinished; - Exception exp; - - public: - typedef sigc::slot<void,const XmlRequest<void>&> 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; - } -}; - } } |