diff options
Diffstat (limited to 'src/Common')
-rw-r--r-- | src/Common/Makefile.am | 2 | ||||
-rw-r--r-- | src/Common/Makefile.in | 2 | ||||
-rw-r--r-- | src/Common/RequestManager.cpp | 2 | ||||
-rw-r--r-- | src/Common/RequestManager.h | 4 | ||||
-rw-r--r-- | src/Common/XmlRequest.h | 8 | ||||
-rw-r--r-- | src/Common/XmlRequestBase.h | 39 |
6 files changed, 11 insertions, 46 deletions
diff --git a/src/Common/Makefile.am b/src/Common/Makefile.am index 2fd4edb..79948dd 100644 --- a/src/Common/Makefile.am +++ b/src/Common/Makefile.am @@ -9,4 +9,4 @@ libcommon_la_LIBADD = Requests/librequests.la RequestHandlers/librequesthandler noinst_HEADERS = ActionManager.h ConfigEntry.h ConfigManager.h Configurable.h Exception.h HostInfo.h \ Initializable.h Logger.h LoggerBase.h LogManager.h ModuleManager.h \ RemoteLogger.h Request.h RequestBase.h RequestHandler.h RequestManager.h \ - SystemBackend.h Tokenizer.h UserInfo.h XmlPacket.h XmlRequestHandler.h + SystemBackend.h Tokenizer.h UserInfo.h XmlPacket.h XmlRequest.h XmlRequestHandler.h diff --git a/src/Common/Makefile.in b/src/Common/Makefile.in index 3638371..c7401d1 100644 --- a/src/Common/Makefile.in +++ b/src/Common/Makefile.in @@ -239,7 +239,7 @@ libcommon_la_LIBADD = Requests/librequests.la RequestHandlers/librequesthandlers noinst_HEADERS = ActionManager.h ConfigEntry.h ConfigManager.h Configurable.h Exception.h HostInfo.h \ Initializable.h Logger.h LoggerBase.h LogManager.h ModuleManager.h \ RemoteLogger.h Request.h RequestBase.h RequestHandler.h RequestManager.h \ - SystemBackend.h Tokenizer.h UserInfo.h XmlPacket.h XmlRequestHandler.h + SystemBackend.h Tokenizer.h UserInfo.h XmlPacket.h XmlRequest.h XmlRequestHandler.h all: all-recursive diff --git a/src/Common/RequestManager.cpp b/src/Common/RequestManager.cpp index 03a2603..6b1bf8f 100644 --- a/src/Common/RequestManager.cpp +++ b/src/Common/RequestManager.cpp @@ -188,7 +188,7 @@ bool RequestManager::sendRequest(Net::Connection *connection, std::auto_ptr<Requ return true; } -bool RequestManager::sendRequest(Net::Connection *connection, std::auto_ptr<XmlRequestBase> request) { +bool RequestManager::sendRequest(Net::Connection *connection, std::auto_ptr<XmlRequest> request) { std::map<Net::Connection*,XmlRequestMap*>::iterator it = xmlRequestMaps.find(connection); if(it == xmlRequestMaps.end()) { diff --git a/src/Common/RequestManager.h b/src/Common/RequestManager.h index 00d940d..f4ad208 100644 --- a/src/Common/RequestManager.h +++ b/src/Common/RequestManager.h @@ -30,7 +30,7 @@ namespace Common { class RequestBase; class RequestHandler; -class XmlRequestBase; +class XmlRequest; class XmlRequestHandler; class RequestManager { @@ -150,7 +150,7 @@ class RequestManager { void unregisterPacketType(const std::string &type); bool sendRequest(Net::Connection *connection, std::auto_ptr<RequestBase> request); - bool sendRequest(Net::Connection *connection, std::auto_ptr<XmlRequestBase> request); + bool sendRequest(Net::Connection *connection, std::auto_ptr<XmlRequest> request); virtual ~RequestManager(); }; diff --git a/src/Common/XmlRequest.h b/src/Common/XmlRequest.h index 667b9a7..66635c2 100644 --- a/src/Common/XmlRequest.h +++ b/src/Common/XmlRequest.h @@ -21,7 +21,7 @@ #define MAD_COMMON_XMLREQUEST_H_ #include "XmlPacket.h" -#include "XmlRequestBase.h" +#include "XmlRequestHandler.h" #include "Exception.h" #include <memory> @@ -30,8 +30,10 @@ namespace Mad { namespace Common { -class XmlRequest : public XmlRequestBase { +class XmlRequest : public XmlRequestHandler { private: + friend class RequestManager; + sigc::signal<void,const XmlRequest&> finished; std::auto_ptr<XmlPacket> res; @@ -50,6 +52,8 @@ class XmlRequest : public XmlRequestBase { void finish(const XmlPacket& result) {res.reset(new XmlPacket(result)); finished(*this);} void finishWithError(const Exception &e) {exp = e; finished(*this);} + virtual void sendRequest(Net::Connection *connection, uint16_t requestId) = 0; + public: const XmlPacket& getResult() const throw(Exception) { if(res.get()) diff --git a/src/Common/XmlRequestBase.h b/src/Common/XmlRequestBase.h deleted file mode 100644 index fbecc71..0000000 --- a/src/Common/XmlRequestBase.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * RequestBase.h - * - * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de> - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef MAD_COMMON_XMLREQUESTBASE_H_ -#define MAD_COMMON_XMLREQUESTBASE_H_ - -#include "XmlRequestHandler.h" -#include <stdint.h> - -namespace Mad { -namespace Common { - -class XmlRequestBase : public XmlRequestHandler { - protected: - virtual void sendRequest(Net::Connection *connection, uint16_t requestId) = 0; - - friend class RequestManager; -}; - -} -} - -#endif /* MAD_COMMON_XMLREQUESTBASE_H_ */ |