150 get()->mode = request->mode;
151 get()->cachePolicy = request->cachePolicy;
384 if(request.is<
typename T::Request>()) {
385 return std::move(request);
387 return typename T::Request(*request);
426 return static_cast<T&
>(protocol);
#define CE_FLAGS_OPERATORS(Enum)
Defines global operators for a Flags<Enum, Storage> implementation.
Definition Flags.hpp:216
#define CE_EXCEPTION_DECL2(Name, Parent)
Definition Exception.hpp:100
#define CE_EXPLICIT(EXPR)
Definition Macros.hpp:413
#define CE_STRUCT_ENUM_DECL(T)
Definition StructEnum.hpp:49
General purpose class used for encapsulating the reading and writing of data from and to various sour...
Definition Stream.hpp:460
A context for function object execution.
Definition ExecutionContext.hpp:90
Definition Exception.hpp:110
A URL load request that is independent of protocol or URL scheme.
Definition URLSession.hpp:85
IURLRequest(const IURLRequest &request, const URL &url)
Creates a new IURLRequest object by copying from another but with a rewritten URL.
Definition URLSession.hpp:124
IURLRequest(const URL &url, const CachePolicy cachePolicy=CachePolicy::Default)
Creates a new URLRequest instance.
Definition URLSession.hpp:121
virtual ~IURLRequest() noexcept=default
Destroys the URLRequest.
URLRequestMode Mode
Determines the mode the request should be performed.
Definition URLSession.hpp:102
const URL url
The URL of the request.
Definition URLSession.hpp:106
The metadata associated with the response to a URL load request, independent of protocol and URL sche...
Definition URLSession.hpp:161
String mimeType
The MIME type of the response.
Definition URLSession.hpp:200
virtual URLDataStream openDataStream()
Opens a new stream that can read and write the data from the response.
Definition URLSession.hpp:238
const URLRequest request
The request that triggered the response.
Definition URLSession.hpp:164
UUID contentID
A ID that uniquely represents a content.
Definition URLSession.hpp:217
IURLResponse(URLRequest request)
Creates a new URLResponse from a request.
Definition URLSession.hpp:222
virtual ~IURLResponse() noexcept=default
Destroys the URLResponse.
UInt64 expectedContentLength
The expected length of the response's content.
Definition URLSession.hpp:174
virtual URLOutputStream openOutputStream()
Opens a new stream that can write the data from the response.
Definition URLSession.hpp:234
String textEncodingName
The name of the text encoding provided by the response's originating source.
Definition URLSession.hpp:207
JSON asJSON()
Opens the stream and reads it as a JSON file.
String suggestedFileName
A suggested filename for the response data.
Definition URLSession.hpp:189
virtual URLInputStream openInputStream()=0
Opens a new stream that can receive the data from the response.
A helper class that wraps and protects a value from non-synchronized access.
Definition Threading.hpp:516
A stream that provides write-only stream functionality.
Definition Stream.hpp:307
A pointer type that has value semantics.
Definition Poly.hpp:57
TT & as() &
Casts the hold type to TT.
Definition Poly.hpp:421
friend class Poly
Definition Poly.hpp:58
Definition StructEnum.hpp:18
UInt32 UnderlyingType
Definition StructEnum.hpp:20
Creates a new URLProtocol instance.
Definition URLSession.hpp:377
URLRequest prepareRequest(URLRequest &&request) override
If the request is supported by the protocol, this method is called to perform and transformation that...
Definition URLSession.hpp:383
StringView getName() const noexcept final
Returns a string that identifies the protocol by a name.
Definition URLSession.hpp:391
A Uniform Resource Identifier (URI) is a unique sequence of characters that identifies a logical or p...
Definition URI.hpp:54
An object that maps URL requests to cached response objects.
Definition URLSession.hpp:446
Definition URLSession.hpp:30
Definition URLSession.hpp:33
Definition URLSession.hpp:32
Definition URLSession.hpp:31
An object that manages the task for a URL request.
Definition URLSession.hpp:263
const T & as() const
Gets the request as a concrete type.
Definition URLSession.hpp:324
URLSession & session
A reference to the URLSession that is executing the task.
Definition URLSession.hpp:266
Task(URLSession &session, URLProtocol &protocol, URLRequest &&request)
Creates a new connection.
Definition URLSession.hpp:284
StringView(URL::*)() const URLGetter
Definition URLSession.hpp:291
~Task() noexcept=default
Destroys the URLProtocol Connection.
Async< URLResponse > subRequest(const URLGetter &getter)
Executes a sub-request.
Definition URLSession.hpp:312
URLProtocol & protocol
A reference to the URLProtocol that is executing the request.
Definition URLSession.hpp:269
Async< URLResponse > subRequest(URLRequest baseRequest)
Executes a sub-request.
Async< URLResponse > subRequest(URL url)
Executes a sub-request.
Definition URLSession.hpp:309
URL parseURL(const URLGetter &getter) const noexcept
Definition URLSession.hpp:300
const URLRequest request
A copy of the request object, already transformed by the executing protocol.
Definition URLSession.hpp:273
URL parseURL(const StringView url) const noexcept
Parses a URL and automatically detects if the element uses nested URLs.
The implementation of a URL requester.
Definition URLSession.hpp:254
virtual StringView getName() const noexcept=0
Returns a string that identifies the protocol by a name.
virtual Async< URLResponse > execute(Task &connection)=0
Executes a request.
URLProtocol(URLSession &session) noexcept
Creates a new URLProtocol instance.
Definition URLSession.hpp:329
virtual bool isRequestSupported(const URLRequest &request)=0
Checks if the given request is supported by the protocol.
virtual URLRequest prepareRequest(URLRequest &&request)
If the request is supported by the protocol, this method is called to perform and transformation that...
Definition URLSession.hpp:357
URLSession & mSession
The session that owns this protocol instance.
Definition URLSession.hpp:257
virtual ~URLProtocol() noexcept=default
Destroys the URLProtocol instance.
A URL load request that is independent of protocol or URL scheme.
Definition URLSession.hpp:131
URLRequest(const URLRequest &request, const URL &url)
Creates a new URLRequest instance that is triggered from another.
Definition URLSession.hpp:149
The metadata associated with the response to a URL load request, independent of protocol and URL sche...
Definition URLSession.hpp:245
friend std::ostream & operator<<(std::ostream &stream, const URLResponse &response)
An object that coordinates a group of related, network data transfer tasks.
Definition URLSession.hpp:399
void registerProtocol(URLProtocolPtr &&protocol)
~URLSession() noexcept
Destroys an existing URLSession.
ExecutionContext & mExecutionContext
The execution context to which URL session callbacks will be called from.
Definition URLSession.hpp:403
LockedObject< Vector< URLProtocolPtr > > mProtocols
A vector that contains all registered protocols.
Definition URLSession.hpp:406
ExecutionContext & getExecutionContext()
The execution context to which URL session callbacks will be called from.
Definition URLSession.hpp:433
LockedObject< List< UPtr< URLProtocol::Task > > > mConnections
A list that contains a reference to all active connections.
Definition URLSession.hpp:409
void unregisterProtocol()
Definition URLSession.hpp:429
URLSession(ExecutionContext &executionContext)
Creates a new URLSession instance.
Definition Application.hpp:19
std::unique_ptr< T, Deleter > UPtr
UPtr is a smart pointer that owns and manages another object through a pointer and disposes of that o...
Definition SmartPtr.hpp:28
std::uint64_t UInt64
Definition DataTypes.hpp:26
BasicJSON<> JSON
Definition JSONForward.hpp:40
UPtr< URLProtocol > URLProtocolPtr
A pointer to a URLProtocol.
Definition URLSession.hpp:395
decltype(auto) get(BezierPath::Element &element) noexcept
Decomposes a bezier path element.
Definition BezierPath.hpp:723
cti::continuable< Args... > Async
Defines a non-copyable continuation type which uses the function2 backend for type erasure.
Definition Async.hpp:22
auto move(Vector3 position)
Moves a entity to the given position.
Definition Helpers.hpp:22
URLRequestMode
Determines the mode the request should be performed.
Definition URLSession.hpp:52
@ Write
Requests writing support from the protocool.
@ Create
Creates the file if it doesn't exist.
@ ReadWrite
Requests read and write support from the protocol.
@ Read
Requests reading support from the protocol.
@ Truncate
Truncate the file if it exists.
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
An enumeration that describes how the URLProtocol implementation should handle caching of this reques...
Definition URLSession.hpp:89
Definition String.hpp:314
Represents a universally unique identifier (UUID).
Definition UUID.hpp:27