class ScriptArray

Helper class for creating and parsing managed arrays.

Public

Constructors

ScriptArray

ScriptArray(MonoArray *existingArray)

Wraps an existing array and allows you to get/set its values.

ScriptArray

ScriptArray(MonoClass &klass, u32 size)

Creates a new array of specified size with elements of the specified type.

ScriptArray

ScriptArray(::MonoClass *klass, u32 size)

Creates a new array of specified size with elements of the specified type.

Methods

SetRaw

void SetRaw(u32 idx, const u8 *value, u32 size, u32 count = 1)

Assigns some data represented as raw memory to the array at the specified index.

User must provide the size of the data, and it must match the element size expected by the array. Multiple array elements can be provided sequentially by setting the parameter.

GetRaw

u8 *GetRaw(u32 idx, u32 size)

Returns the raw memory of the data at the specified array index.

Returned value should not be used for writing to the array and set() or setRaw() methods should be used instead.

Size

u32 Size() const

Returns number of elements in the array.

ElementSize

u32 ElementSize() const

Returns the size of an individual element in the array, in bytes.

GetInternal

MonoArray *GetInternal() const

Returns the managed object representing this array.

staticGetElementClass

static ::MonoClass *GetElementClass(::MonoClass *arrayClass)

Returns the class of the elements within an array class.

staticGetRank

static u32 GetRank(::MonoClass *arrayClass)

Returns the rank of the provided array class.

staticBuildArrayClass

static ::MonoClass *BuildArrayClass(::MonoClass *elementClass, u32 rank)

Builds an array class from the provided element class and a rank.

Internal

Methods

staticGetArrayAddrInternal

static u8 *GetArrayAddrInternal(MonoArray *array, u32 size, u32 idx)

Returns the address of an array item at the specified index.

array
Array from which to retrieve the item.
size
Size of a single item in the array.
idx
Index of the item to retrieve.

Returns: Address of the array item at the requested index.

staticSetArrayValInternal

static void SetArrayValInternal(MonoArray *array, u32 idx, const u8 *value, u32 size, u32 count = 1)

Sets one or multiple entries from the array at the specified index, from raw memory.

User must provide the size of the element, and it must match the element size expected by the array.

Private

Fields

mInternal

MonoArray * mInternal