CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::URLProtocol::Task Class Referencefinal

An object that manages the task for a URL request. More...

#include <CeresEngine/Foundation/IO/URLSession.hpp>

Public Types

using URLGetter = StringView(URL::*)() const
 

Public Member Functions

 Task (URLSession &session, URLProtocol &protocol, URLRequest &&request)
 Creates a new connection.
 
 ~Task () noexcept=default
 Destroys the URLProtocol Connection.
 
URL parseURL (const StringView url) const noexcept
 Parses a URL and automatically detects if the element uses nested URLs.
 
URL parseURL (const URLGetter &getter) const noexcept
 
Async< URLResponsesubRequest (URLRequest baseRequest)
 Executes a sub-request.
 
Async< URLResponsesubRequest (URL url)
 Executes a sub-request.
 
Async< URLResponsesubRequest (const URLGetter &getter)
 Executes a sub-request.
 
template<typename T >
const Tas () const
 Gets the request as a concrete type.
 

Public Attributes

URLSessionsession
 A reference to the URLSession that is executing the task.
 
URLProtocolprotocol
 A reference to the URLProtocol that is executing the request.
 
const URLRequest request
 A copy of the request object, already transformed by the executing protocol.
 

Detailed Description

An object that manages the task for a URL request.

Member Typedef Documentation

◆ URLGetter

Constructor & Destructor Documentation

◆ Task()

CeresEngine::URLProtocol::Task::Task ( URLSession session,
URLProtocol protocol,
URLRequest &&  request 
)
inlineexplicit

Creates a new connection.

Parameters
sessionA reference to the URLSession that opened the connection.
protocolA reference to the URLProtocol that is executing the request.
requestThe request object.

◆ ~Task()

CeresEngine::URLProtocol::Task::~Task ( )
defaultnoexcept

Destroys the URLProtocol Connection.

Member Function Documentation

◆ as()

template<typename T >
const T & CeresEngine::URLProtocol::Task::as ( ) const
inline

Gets the request as a concrete type.

Template Parameters
TThe request type.
Returns
The request, casted to to type T.

◆ parseURL() [1/2]

URL CeresEngine::URLProtocol::Task::parseURL ( const StringView  url) const
noexcept

Parses a URL and automatically detects if the element uses nested URLs.

Parameters
urlThe string to be parsed as a URL.
Returns
The string parsed as a URL.

◆ parseURL() [2/2]

URL CeresEngine::URLProtocol::Task::parseURL ( const URLGetter getter) const
inlinenoexcept

◆ subRequest() [1/3]

Async< URLResponse > CeresEngine::URLProtocol::Task::subRequest ( const URLGetter getter)
inline

Executes a sub-request.

Parameters
baseRequestThe sub-request to be executed.
Returns
A continuable object that contains the sub-request response.

◆ subRequest() [2/3]

Async< URLResponse > CeresEngine::URLProtocol::Task::subRequest ( URL  url)
inline

Executes a sub-request.

Parameters
baseRequestThe sub-request to be executed.
Returns
A continuable object that contains the sub-request response.

◆ subRequest() [3/3]

Async< URLResponse > CeresEngine::URLProtocol::Task::subRequest ( URLRequest  baseRequest)

Executes a sub-request.

Parameters
baseRequestThe sub-request to be executed.
Returns
A continuable object that contains the sub-request response.

Member Data Documentation

◆ protocol

URLProtocol& CeresEngine::URLProtocol::Task::protocol

A reference to the URLProtocol that is executing the request.

◆ request

const URLRequest CeresEngine::URLProtocol::Task::request

A copy of the request object, already transformed by the executing protocol.

◆ session

URLSession& CeresEngine::URLProtocol::Task::session

A reference to the URLSession that is executing the task.


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