ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

#include <request.h>

Inheritance diagram for Networking::Request:
Collaboration diagram for Networking::Request:

List of all members.

Public Member Functions

 Request (DataCallback cb, ErrorCallback ecb)
virtual ~Request ()
virtual void handle ()=0
 Method, which does actual work.
virtual void handleRetry ()
 Method, which is called by ConnectionManager when Request's state is RETRY.
virtual void restart ()=0
 Method, which is used to restart the Request.
virtual void pause ()
 Method, which is called to pause the Request.
virtual void finish ()
 Method, which is called to *interrupt* the Request.
virtual void retry (uint32 seconds)
 Method, which is called to retry the Request.
RequestState state () const
 Returns Request's current state.
virtual Common::String date () const
 Return date this Request received from server.

Protected Member Functions

virtual void finishError (ErrorResponse error)
 Sets FINISHED state and calls the _errorCallback with given error.
virtual void finishSuccess ()
 Sets FINISHED state.

Protected Attributes

DataCallback _callback
 Callback, which should be called when Request is finished.
ErrorCallback _errorCallback
 Callback, which should be called when Request is failed/interrupted.
RequestState _state
 Request state, which is used by ConnectionManager to determine whether request might be deleted or it's still working.
uint32 _retryInSeconds
 In RETRY state this indicates whether it's time to call restart().

Detailed Description

Definition at line 120 of file request.h.


Constructor & Destructor Documentation

Networking::Request::Request ( DataCallback  cb,
ErrorCallback  ecb 
)

Definition at line 33 of file request.cpp.

Networking::Request::~Request (  )  [virtual]

Definition at line 36 of file request.cpp.


Member Function Documentation

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 Cloud::Box::BoxListDirectoryByIdRequest, Cloud::Dropbox::DropboxCreateDirectoryRequest, Cloud::Dropbox::DropboxListDirectoryRequest, Cloud::GoogleDrive::GoogleDriveListDirectoryByIdRequest, Cloud::Id::IdCreateDirectoryRequest, Cloud::Id::IdListDirectoryRequest, Cloud::OneDrive::OneDriveCreateDirectoryRequest, Cloud::OneDrive::OneDriveListDirectoryRequest, and Networking::CurlRequest.

Definition at line 64 of file request.cpp.

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.

Definition at line 52 of file request.cpp.

void Networking::Request::finishError ( ErrorResponse  error  )  [protected, virtual]

Sets FINISHED state and calls the _errorCallback with given error.

Reimplemented in Cloud::Box::BoxTokenRefresher, and Cloud::DownloadRequest.

Definition at line 66 of file request.cpp.

void Networking::Request::finishSuccess (  )  [protected, virtual]

Sets FINISHED state.

Implementations might extend it if needed.

Definition at line 72 of file request.cpp.

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

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

Definition at line 41 of file request.cpp.

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

Method, which is called to pause the Request.

Definition at line 50 of file request.cpp.

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

Method, which is called to retry the Request.

Definition at line 57 of file request.cpp.

RequestState Networking::Request::state (  )  const

Returns Request's current state.

Definition at line 62 of file request.cpp.


Member Data Documentation

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.

Definition at line 129 of file request.h.

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.

Definition at line 136 of file request.h.

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

Definition at line 149 of file request.h.

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.

Definition at line 146 of file request.h.


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


Generated on Sat Jul 13 2019 05:04:41 for ResidualVM by doxygen 1.7.1
curved edge   curved edge