ScummVM API documentation
Networking::SessionRequest Class Reference

Class for reading file and storing locally. More...

#include <sessionrequest.h>

Inheritance diagram for Networking::SessionRequest:
Networking::CurlRequest Networking::Request

Public Member Functions

 SessionRequest (const Common::String &url, const Common::Path &localFile, DataCallback cb=nullptr, ErrorCallback ecb=nullptr, bool binary=false)
 
void start ()
 
void startAndWait ()
 
void reuse (const Common::String &url, const Common::Path &localFile, DataCallback cb=nullptr, ErrorCallback ecb=nullptr, bool binary=false)
 
void handle () override
 
void restart () override
 
void close ()
 
void abortRequest ()
 Closes the current request and removes any unfinished files.
 
bool complete ()
 
bool success ()
 
char * text ()
 
Common::JSONValuejson ()
 
byte * getData ()
 
uint32 getSize ()
 
- Public Member Functions inherited from Networking::CurlRequest
 CurlRequest (DataCallback cb, ErrorCallback ecb, const Common::String &url)
 
Common::String date () const override
 
virtual void setHeaders (const Common::Array< Common::String > &headers)
 
virtual void addHeader (const Common::String &header)
 
virtual void addPostField (const Common::String &field)
 
virtual void addFormField (const Common::String &name, const Common::String &value)
 
virtual void addFormFile (const Common::String &name, const Common::Path &filename)
 
virtual void setBuffer (byte *buffer, uint32 size)
 
virtual void usePut ()
 
virtual void usePatch ()
 
virtual void connectionKeepAlive (long idle=120, long interval=60)
 
virtual void connectionClose ()
 
virtual NetworkReadStreamResponse execute ()
 
const NetworkReadStreamgetNetworkReadStream () const
 
void wait (int spinlockDelay=5)
 
- Public Member Functions inherited from Networking::Request
 Request (DataCallback cb, ErrorCallback ecb)
 
virtual void handleRetry ()
 
virtual void pause ()
 
virtual void finish ()
 
virtual void retry (uint32 seconds)
 
RequestState state () const
 

Protected Member Functions

bool reuseStream ()
 
char * getPreparedContents ()
 
void finishError (const ErrorResponse &error, RequestState state=PAUSED) override
 
void finishSuccess () override
 
void openLocalFile (const Common::Path &localFile)
 
- Protected Member Functions inherited from Networking::CurlRequest
NetworkReadStreammakeStream ()
 

Protected Attributes

Common::MemoryWriteStreamDynamic _contentsStream
 
byte * _buffer
 
char * _text
 
bool _started
 
bool _complete
 
bool _success
 
bool _binary
 
Common::DumpFile_localFile
 
SessionFileResponse _response
 
- Protected Attributes inherited from Networking::CurlRequest
Common::String _url
 
NetworkReadStream_stream
 
curl_slist * _headersList
 
Common::String _postFields
 
Common::HashMap< Common::String, Common::String_formFields
 
Common::HashMap< Common::String, Common::Path_formFiles
 
byte * _bytesBuffer
 
uint32 _bytesBufferSize
 
bool _uploading
 
bool _usingPatch
 
bool _keepAlive
 
long _keepAliveIdle
 
long _keepAliveInterval
 
- Protected Attributes inherited from Networking::Request
DataCallback _callback
 
ErrorCallback _errorCallback
 
RequestState _state
 
uint32 _retryInSeconds
 

Detailed Description

Class for reading file and storing locally.

Returns
Returns SessionFileResponse in the callback

Member Function Documentation

◆ getPreparedContents()

char* Networking::SessionRequest::getPreparedContents ( )
protected

Prepares raw bytes from _contentsStream.

◆ finishError()

void Networking::SessionRequest::finishError ( const ErrorResponse error,
RequestState  state = PAUSED 
)
overrideprotectedvirtual

Sets FINISHED state and calls the _errorCallback with given error.

Reimplemented from Networking::Request.

◆ finishSuccess()

void Networking::SessionRequest::finishSuccess ( )
overrideprotectedvirtual

Sets FINISHED state. Implementations might extend it if needed.

Reimplemented from Networking::Request.

◆ handle()

void Networking::SessionRequest::handle ( )
overridevirtual

Method, which does actual work. Depends on what this Request is doing.

Reimplemented from Networking::CurlRequest.

◆ restart()

void Networking::SessionRequest::restart ( )
overridevirtual

Method, which is used to restart the Request.

Reimplemented from Networking::CurlRequest.

◆ close()

void Networking::SessionRequest::close ( )

This request DOES NOT delete automatically after calling callbacks. It gets PAUSED, and in order to make it FINISHED (i.e. delete), this method MUST be called.


The documentation for this class was generated from the following file: