Skip to content
SiteEmail

cohtml::ArrayInfo

Represents an array of a type exposed to the scripting.

#include <Property.h>

Name
ElementTypeType
Type of the elements in the array.
LengthGetterGetLength
Callback that returns the number of elements in the array.
ElementGetterGetElement
Callback that returns the element at the specified index.
ArrayElementBinderBindElement
Callback that binds the element at the specified index. It’s the same bind callback passed to TryBindArrayByRef. Used in the data binding for resolving arrays of complex types, such as arrays of strings, polymorphic arrays, nested arrays and arrays of other containers.
TypeInfo *ArrayTypeInfo
Type information for elements when Type is ET_UserType; null otherwise.
void *UserData
Pointer to the underlying array or container. May represent the actual container or an abstraction defined by the property implementation.
ElementType Type;

Type of the elements in the array.

LengthGetter GetLength;

Callback that returns the number of elements in the array.

ElementGetter GetElement;

Callback that returns the element at the specified index.

Warning: When ElementType is a primitive type, except ET_String, GetElement must return a pointer to an actual value of that type. The SDK may cast it directly to that type when used; for example for ET_Boolean: (bool*)arrayInfo.GetElement(arrayInfo.UserData, index). The pointer returned by GetElement is not cached by the SDK and should remain valid only for the duration of the call, unless Safe data binding is disabled.

ArrayElementBinder BindElement;

Callback that binds the element at the specified index. It’s the same bind callback passed to TryBindArrayByRef. Used in the data binding for resolving arrays of complex types, such as arrays of strings, polymorphic arrays, nested arrays and arrays of other containers.

Warning: Arrays that rely on BindElement may incur additional overhead due to JavaScript-side binding. If this is a concern, wrap the nested type in a class/struct instead of using it directly (e.g. use vector<Wrapper> where Wrapper contains the std::variant).

TypeInfo * ArrayTypeInfo;

Type information for elements when Type is ET_UserType; null otherwise.

void * UserData;

Pointer to the underlying array or container. May represent the actual container or an abstraction defined by the property implementation.