cohtml.Net.ResourceResponse

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.

Inherits from SystemIDisposable

Public Classes

Name
classUserImageData
Description of the properties of the user provided image.

Public Types

Name
enum classStatus { Success, Failure}

Public Functions

Name
virtual voidDispose()
virtual global.System.IntPtrGetSpace(ulong size)
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”. 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.
virtual voidReceiveOptimizedData(DataBuffer optimizedData)
Passes optimized data that speeds up the resource processing. Currently, this can speed up the JavaScript compilation and run times, the optimizedData can be obtained using the cohtml.ScriptCompiler.Compile.
virtual voidSignalProgress()
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.
virtual voidSetStatus(ushort status)
Additional API used for complex responses like HTTP. Setting these fields is not required for local “coui” loads.
virtual voidSetResponseURL(string responseURL)
The URL of the response (can change from the request due to redirects)
virtual voidSetHeader(string name, string value)
Set a response header.
virtual voidFinish(ResourceResponse.Status status)
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.
voidReceiveUserImage(ResourceResponse.UserImageData preloadedImage)
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.
delegate global.System.IntPtrSwigDelegateResourceResponse_0(ulong size, global.System.IntPtr swigId)
delegate voidSwigDelegateResourceResponse_1(global.System.IntPtr optimizedData, global.System.IntPtr swigId)
delegate voidSwigDelegateResourceResponse_2(global.System.IntPtr swigId)
delegate voidSwigDelegateResourceResponse_3(ushort status, global.System.IntPtr swigId)
delegate voidSwigDelegateResourceResponse_4(string responseURL, global.System.IntPtr swigId)
delegate voidSwigDelegateResourceResponse_5(string name, string value, global.System.IntPtr swigId)
delegate voidSwigDelegateResourceResponse_6(int status, global.System.IntPtr swigId)

Protected Functions

Name
ResourceResponse()

Protected Attributes

Name
boolswigCMemOwn

Public Types Documentation

enum Status

EnumeratorValueDescription
Success
Failure

Public Functions Documentation

function Dispose

virtual void Dispose()

function GetSpace

virtual global.System.IntPtr GetSpace(
    ulong size
)

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”. 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.

function ReceiveOptimizedData

virtual void ReceiveOptimizedData(
    DataBuffer optimizedData
)

Passes optimized data that speeds up the resource processing. Currently, this can speed up the JavaScript compilation and run times, the optimizedData can be obtained using the cohtml.ScriptCompiler.Compile.

Parameters:

  • optimizedData is a data, produced by doing resource processing ahead of time and can be easily cached, serialized and deserialized.

function SignalProgress

virtual void SignalProgress()

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.

function SetStatus

virtual void SetStatus(
    ushort status
)

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

function SetResponseURL

virtual void SetResponseURL(
    string responseURL
)

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

function SetHeader

virtual void SetHeader(
    string name,
    string value
)

Set a response header.

function Finish

virtual void Finish(
    ResourceResponse.Status status
)

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.

function ReceiveUserImage

void ReceiveUserImage(
    ResourceResponse.UserImageData preloadedImage
)

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:

  • preloadedImage The provided preloaded image.

function SwigDelegateResourceResponse_0

delegate global.System.IntPtr SwigDelegateResourceResponse_0(
    ulong size,
    global.System.IntPtr swigId
)

function SwigDelegateResourceResponse_1

delegate void SwigDelegateResourceResponse_1(
    global.System.IntPtr optimizedData,
    global.System.IntPtr swigId
)

function SwigDelegateResourceResponse_2

delegate void SwigDelegateResourceResponse_2(
    global.System.IntPtr swigId
)

function SwigDelegateResourceResponse_3

delegate void SwigDelegateResourceResponse_3(
    ushort status,
    global.System.IntPtr swigId
)

function SwigDelegateResourceResponse_4

delegate void SwigDelegateResourceResponse_4(
    string responseURL,
    global.System.IntPtr swigId
)

function SwigDelegateResourceResponse_5

delegate void SwigDelegateResourceResponse_5(
    string name,
    string value,
    global.System.IntPtr swigId
)

function SwigDelegateResourceResponse_6

delegate void SwigDelegateResourceResponse_6(
    int status,
    global.System.IntPtr swigId
)

Protected Functions Documentation

function ResourceResponse

ResourceResponse()

Protected Attributes Documentation

variable swigCMemOwn

bool swigCMemOwn;