2016-05-13 17:23:28 +06:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* 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 2
|
|
|
|
* 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-05-17 01:19:49 +06:00
|
|
|
#ifndef BACKENDS_NETWORKING_CURL_CURLJSONREQUEST_H
|
|
|
|
#define BACKENDS_NETWORKING_CURL_CURLJSONREQUEST_H
|
2016-05-13 17:23:28 +06:00
|
|
|
|
|
|
|
#include "backends/cloud/request.h"
|
2016-05-17 20:17:41 +06:00
|
|
|
#include "common/memstream.h"
|
2016-05-13 17:23:28 +06:00
|
|
|
|
2016-05-16 01:05:40 +06:00
|
|
|
namespace Networking {
|
2016-05-15 11:22:35 +06:00
|
|
|
|
2016-05-17 01:19:49 +06:00
|
|
|
class NetworkReadStream;
|
2016-05-13 17:23:28 +06:00
|
|
|
|
2016-05-17 01:19:49 +06:00
|
|
|
class CurlJsonRequest : public Cloud::Request {
|
2016-05-15 11:22:35 +06:00
|
|
|
const char *_url;
|
2016-05-17 01:19:49 +06:00
|
|
|
NetworkReadStream *_stream;
|
2016-05-17 20:17:41 +06:00
|
|
|
Common::MemoryWriteStreamDynamic _contentsStream;
|
|
|
|
|
|
|
|
/** Prepares raw bytes from _contentsStream to be parsed with Common::JSON::parse(). */
|
|
|
|
char *getPreparedContents();
|
2016-05-13 17:23:28 +06:00
|
|
|
|
|
|
|
public:
|
2016-05-17 01:19:49 +06:00
|
|
|
CurlJsonRequest(Callback cb, const char *url);
|
|
|
|
virtual ~CurlJsonRequest();
|
2016-05-15 00:31:02 +06:00
|
|
|
|
2016-05-17 01:19:49 +06:00
|
|
|
virtual bool handle(ConnectionManager &manager);
|
2016-05-13 17:23:28 +06:00
|
|
|
};
|
|
|
|
|
2016-05-17 01:19:49 +06:00
|
|
|
} //end of namespace Networking
|
2016-05-13 17:23:28 +06:00
|
|
|
|
|
|
|
#endif
|