ScummVM API documentation
Networking::Request Class Referenceabstract
Inheritance diagram for Networking::Request:
Cloud::Box::BoxListDirectoryByIdRequest Cloud::Box::BoxUploadRequest Cloud::DownloadRequest Cloud::Dropbox::DropboxCreateDirectoryRequest Cloud::Dropbox::DropboxInfoRequest Cloud::Dropbox::DropboxListDirectoryRequest Cloud::Dropbox::DropboxUploadRequest Cloud::FolderDownloadRequest Cloud::GoogleDrive::GoogleDriveListDirectoryByIdRequest Cloud::GoogleDrive::GoogleDriveUploadRequest Cloud::Id::IdCreateDirectoryRequest Cloud::Id::IdDownloadRequest Cloud::Id::IdListDirectoryRequest Cloud::Id::IdResolveIdRequest Cloud::Id::IdStreamFileRequest Cloud::OneDrive::OneDriveCreateDirectoryRequest Cloud::OneDrive::OneDriveListDirectoryRequest Cloud::OneDrive::OneDriveUploadRequest Cloud::SavesSyncRequest Networking::CurlRequest Networking::PostRequest

Public Member Functions

 Request (DataCallback cb, ErrorCallback ecb)
 
virtual void handle ()=0
 
virtual void handleRetry ()
 
virtual void restart ()=0
 
virtual void pause ()
 
virtual void finish ()
 
virtual void retry (uint32 seconds)
 
RequestState state () const
 
virtual Common::String date () const
 

Protected Member Functions

virtual void finishError (const ErrorResponse &error, RequestState state=FINISHED)
 
virtual void finishSuccess ()
 

Protected Attributes

DataCallback _callback
 
ErrorCallback _errorCallback
 
RequestState _state
 
uint32 _retryInSeconds
 

Member Function Documentation

◆ finishError()

virtual void Networking::Request::finishError ( const ErrorResponse error,
RequestState  state = FINISHED 
)
protectedvirtual

Sets FINISHED state and calls the _errorCallback with given error.

Reimplemented in Networking::SessionRequest.

◆ finishSuccess()

virtual void Networking::Request::finishSuccess ( )
protectedvirtual

Sets FINISHED state. Implementations might extend it if needed.

Reimplemented in Networking::SessionRequest.

◆ handle()

◆ handleRetry()

virtual void Networking::Request::handleRetry ( )
virtual

Method, which is called by ConnectionManager when Request's state is RETRY.

◆ restart()

◆ pause()

virtual void Networking::Request::pause ( )
virtual

Method, which is called to pause the Request.

◆ finish()

virtual void Networking::Request::finish ( )
virtual

Method, which is called to interrupt the Request. When it's called, Request must stop its work and call the failure callback to notify user.

◆ retry()

virtual void Networking::Request::retry ( uint32  seconds)
virtual

Method, which is called to retry the Request.

◆ state()

RequestState Networking::Request::state ( ) const

Returns Request's current state.

◆ date()

virtual Common::String Networking::Request::date ( ) const
virtual

Return date this Request received from server. It could be extracted from "Date" header, which is kept in NetworkReadStream.

Note
not all Requests do that, so "" is returned to indicate the date is unknown. That's also true if no server response available or no "Date" header was passed.
Returns
date from "Date" response header.

Reimplemented in Networking::CurlRequest, Cloud::Id::IdListDirectoryRequest, Cloud::OneDrive::OneDriveListDirectoryRequest, Cloud::Id::IdCreateDirectoryRequest, Networking::PostRequest, Cloud::Box::BoxListDirectoryByIdRequest, Cloud::Dropbox::DropboxListDirectoryRequest, Cloud::GoogleDrive::GoogleDriveListDirectoryByIdRequest, Cloud::Dropbox::DropboxCreateDirectoryRequest, and Cloud::OneDrive::OneDriveCreateDirectoryRequest.

Member Data Documentation

◆ _callback

DataCallback Networking::Request::_callback
protected

Callback, which should be called when Request is finished. That's the way Requests pass the result to the code which asked to create this request.

Note
some Requests use their own callbacks to return something but void *.
callback must be called in finish() or similar method.

◆ _errorCallback

ErrorCallback Networking::Request::_errorCallback
protected

Callback, which should be called when Request is failed/interrupted. That's the way Requests pass error information to the code which asked to create this request.

Note
callback must be called in finish() or similar method.

◆ _state

RequestState Networking::Request::_state
protected

Request state, which is used by ConnectionManager to determine whether request might be deleted or it's still working.

State might be changed from outside with finish(), pause() or retry() methods. Override these if you want to react to these changes correctly.

◆ _retryInSeconds

uint32 Networking::Request::_retryInSeconds
protected

In RETRY state this indicates whether it's time to call restart().


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