diff options
author | Alexander Tkachev | 2016-05-21 23:21:42 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | 9e531e3ce7f5b3a1cc87b43beb6f72911cb41bdd (patch) | |
tree | aabc1995e2208f8c7c51bc208716a8948dbb5a92 /backends/networking/curl | |
parent | e1109c0c328aaf671e2b03b3b4e6de1ae9061754 (diff) | |
download | scummvm-rg350-9e531e3ce7f5b3a1cc87b43beb6f72911cb41bdd.tar.gz scummvm-rg350-9e531e3ce7f5b3a1cc87b43beb6f72911cb41bdd.tar.bz2 scummvm-rg350-9e531e3ce7f5b3a1cc87b43beb6f72911cb41bdd.zip |
CLOUD: Polish Callbacks
Cleaned up all example code and old callbacks.
New Callback classes are introduced in "common/callback.h" and
documented.
Diffstat (limited to 'backends/networking/curl')
-rw-r--r-- | backends/networking/curl/curljsonrequest.cpp | 2 | ||||
-rw-r--r-- | backends/networking/curl/curljsonrequest.h | 7 | ||||
-rw-r--r-- | backends/networking/curl/request.h | 19 |
3 files changed, 7 insertions, 21 deletions
diff --git a/backends/networking/curl/curljsonrequest.cpp b/backends/networking/curl/curljsonrequest.cpp index c3064681ef..702de22f46 100644 --- a/backends/networking/curl/curljsonrequest.cpp +++ b/backends/networking/curl/curljsonrequest.cpp @@ -31,7 +31,7 @@ namespace Networking { -CurlJsonRequest::CurlJsonRequest(Common::BaseCallback* cb, const char *url) : Request(cb), _stream(0), _headersList(0), _contentsStream(DisposeAfterUse::YES) { +CurlJsonRequest::CurlJsonRequest(Common::BaseCallback<> *cb, const char *url): Request(cb), _stream(0), _headersList(0), _contentsStream(DisposeAfterUse::YES) { _url = url; } diff --git a/backends/networking/curl/curljsonrequest.h b/backends/networking/curl/curljsonrequest.h index 1098638609..50fa8183dd 100644 --- a/backends/networking/curl/curljsonrequest.h +++ b/backends/networking/curl/curljsonrequest.h @@ -25,10 +25,7 @@ #include "backends/networking/curl/request.h" #include "common/memstream.h" - -namespace Common { -class BaseCallback; -} +#include "common/json.h" struct curl_slist; @@ -47,7 +44,7 @@ class CurlJsonRequest : public Request { char *getPreparedContents(); public: - CurlJsonRequest(Common::BaseCallback *cb, const char *url); + CurlJsonRequest(Common::BaseCallback<> *cb, const char *url); virtual ~CurlJsonRequest(); virtual bool handle(); diff --git a/backends/networking/curl/request.h b/backends/networking/curl/request.h index 860784f2a7..d3efd588dc 100644 --- a/backends/networking/curl/request.h +++ b/backends/networking/curl/request.h @@ -22,30 +22,22 @@ #ifndef BACKENDS_NETWORKING_CURL_REQUEST_H #define BACKENDS_NETWORKING_CURL_REQUEST_H -#include <common/callback.h> + +#include "common/callback.h" namespace Networking { class Request { protected: - typedef void(*SimpleCallback)(Request* request, void *result); - /** * Callback, which should be called before Request returns true in handle(). * That's the way Requests pass the result to the code which asked to create this request. */ - Common::BaseCallback* _callback; - - /** - * Pointer, which could be set by Request creating code. It might be accessed - * from this Request when callback is called, for example. - */ - - void *_pointer; + Common::BaseCallback<> *_callback; public: - Request(Common::BaseCallback* cb): _callback(cb) {}; + Request(Common::BaseCallback<> *cb): _callback(cb) {}; virtual ~Request() {}; /** @@ -55,9 +47,6 @@ public: */ virtual bool handle() = 0; - - void setPointer(void *ptr) { _pointer = ptr; } - void *pointer() const { return _pointer; } }; } //end of namespace Cloud |