diff options
author | Alexander Tkachev | 2016-05-27 15:21:06 +0600 |
---|---|---|
committer | Alexander Tkachev | 2016-08-24 16:07:55 +0600 |
commit | 98150beb38f73b56c7bc76f95dcc1d72290e4ac7 (patch) | |
tree | c56f8d97d30fb15f41f07f402c80e83a13cc03fc /backends/networking/curl/curljsonrequest.h | |
parent | 83b349a033d71e92e292d1f1da0578d557ec6411 (diff) | |
download | scummvm-rg350-98150beb38f73b56c7bc76f95dcc1d72290e4ac7.tar.gz scummvm-rg350-98150beb38f73b56c7bc76f95dcc1d72290e4ac7.tar.bz2 scummvm-rg350-98150beb38f73b56c7bc76f95dcc1d72290e4ac7.zip |
CLOUD: Refactor ConnectionManager/Requests system
ConnectionManager now storages Request * (not generates ids for it),
Requests have control on their RequestState, RequestIdPair is now called
Response and storages Request * with some response together.
All related classes are changed to use it in more clean and
understandable way.
Request, RequestState and Response are carefully commented/documented.
Diffstat (limited to 'backends/networking/curl/curljsonrequest.h')
-rw-r--r-- | backends/networking/curl/curljsonrequest.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/backends/networking/curl/curljsonrequest.h b/backends/networking/curl/curljsonrequest.h index 5e78bd1965..0a560f93f4 100644 --- a/backends/networking/curl/curljsonrequest.h +++ b/backends/networking/curl/curljsonrequest.h @@ -29,10 +29,8 @@ namespace Networking { -class NetworkReadStream; - -typedef RequestIdPair<Common::JSONValue*> RequestJsonPair; -typedef Common::BaseCallback<RequestJsonPair> *JsonCallback; +typedef Response<Common::JSONValue *> JsonResponse; +typedef Common::BaseCallback<JsonResponse> *JsonCallback; class CurlJsonRequest: public CurlRequest { JsonCallback _jsonCallback; @@ -41,12 +39,17 @@ class CurlJsonRequest: public CurlRequest { /** Prepares raw bytes from _contentsStream to be parsed with Common::JSON::parse(). */ char *getPreparedContents(); +protected: + /** Sets FINISHED state and passes the JSONValue * into user's callback in JsonResponse. */ + virtual void finishJson(Common::JSONValue *json); + public: CurlJsonRequest(JsonCallback cb, Common::String url); virtual ~CurlJsonRequest(); virtual void handle(); virtual void restart(); + virtual void finish(); }; } //end of namespace Networking |