1.26.2.1
Gameface
cohtml::IAsyncResourceResponse Class Referenceabstract

Response that the application should use when the resource has been loaded You can keep a reference to this object as long as needed and call Finish afterwards. More...

Classes

struct  UserImageData
 Description of the properties of the user provided image. More...
 

Public Types

enum  Status { Success, Failure }
 

Public Member Functions

virtual ~IAsyncResourceResponse ()
 
virtual void * GetSpace (unsigned long long size)=0
 Allocates more space where to put the data read. NB: You can call the function multiple times and it'll allocate more space if needed. The space requested MUST be the SUM of all space required. Already copied data will be still available in the buffer - it works the same way as "realloc". More...
 
virtual void ReceiveUserImage (const UserImageData &userImageData)=0
 Passes data about a user image that is ready to be used by the UI system. This lets Cohtml use textures that are already on the GPU and the void* is interpreted by the backend. More...
 
virtual void SignalProgress ()=0
 Can be called when part of the response is ready and can be used by the backend. Calling this is optional. Note that the pointer returned by GetSpace will not be valid anymore. The user will have to request some more memory for the fresh data after this call. More...
 
virtual void SetStatus (unsigned short status)=0
 Additional API used for complex responses like HTTP. Setting these fields is not required for local "coui" loads. More...
 
virtual void SetResponseURL (const char *responseURL)=0
 The URL of the response (can change from the request due to redirects) More...
 
virtual void SetHeader (const char *name, const char *value)=0
 Set a response header. More...
 
virtual void Finish (Status status)=0
 Call when the resource has been loaded or the load failed. After this call the object is invalidated. NB: It's not safe to call any methods on this interface after Finish. More...
 

Protected Member Functions

 IAsyncResourceResponse ()
 

Detailed Description

Response that the application should use when the resource has been loaded You can keep a reference to this object as long as needed and call Finish afterwards.

Member Enumeration Documentation

◆ Status

Enumerator
Success 
Failure 

Constructor & Destructor Documentation

◆ IAsyncResourceResponse()

cohtml::IAsyncResourceResponse::IAsyncResourceResponse ( )
protected

◆ ~IAsyncResourceResponse()

virtual cohtml::IAsyncResourceResponse::~IAsyncResourceResponse ( )
virtual

Member Function Documentation

◆ Finish()

virtual void cohtml::IAsyncResourceResponse::Finish ( Status  status)
pure virtual

Call when the resource has been loaded or the load failed. After this call the object is invalidated. NB: It's not safe to call any methods on this interface after Finish.

◆ GetSpace()

virtual void* cohtml::IAsyncResourceResponse::GetSpace ( unsigned long long  size)
pure virtual

Allocates more space where to put the data read. NB: You can call the function multiple times and it'll allocate more space if needed. The space requested MUST be the SUM of all space required. Already copied data will be still available in the buffer - it works the same way as "realloc".

Note
The pointer returned will always point to the beginning of the data array. Users have to keep an offset counter themselves if they plan to call GetSpace() multiple times.

◆ ReceiveUserImage()

virtual void cohtml::IAsyncResourceResponse::ReceiveUserImage ( const UserImageData userImageData)
pure virtual

Passes data about a user image that is ready to be used by the UI system. This lets Cohtml use textures that are already on the GPU and the void* is interpreted by the backend.

Parameters
userImageDatainformation about the user image

◆ SetHeader()

virtual void cohtml::IAsyncResourceResponse::SetHeader ( const char *  name,
const char *  value 
)
pure virtual

Set a response header.

◆ SetResponseURL()

virtual void cohtml::IAsyncResourceResponse::SetResponseURL ( const char *  responseURL)
pure virtual

The URL of the response (can change from the request due to redirects)

◆ SetStatus()

virtual void cohtml::IAsyncResourceResponse::SetStatus ( unsigned short  status)
pure virtual

Additional API used for complex responses like HTTP. Setting these fields is not required for local "coui" loads.

◆ SignalProgress()

virtual void cohtml::IAsyncResourceResponse::SignalProgress ( )
pure virtual

Can be called when part of the response is ready and can be used by the backend. Calling this is optional. Note that the pointer returned by GetSpace will not be valid anymore. The user will have to request some more memory for the fresh data after this call.