struct RTTIDataBlockField

template<class InterfaceType, class DataType, class ObjectType>

Class containing a data block field containing a specific type.

Public

Methods

InitSingle

void InitSingle(String name, u16 uniqueId, GetterType getter, SetterType setter, const RTTIFieldInfo &info)

Initializes a field that returns a block of bytes.

Can be used for serializing pretty much anything.

name
Name of the field.
uniqueId
Unique identifier for this field. Although name is also a unique identifier we want a small data type that can be used for efficiently serializing data to disk and similar. It is primarily used for compatibility between different versions of serialized data.
getter
The getter method for the field.
setter
The setter method for the field.
info
Various optional information about the field.

InitSchema

void InitSchema() override

Initializes the field's RTTI schema.

Should be called once after construction.

GetValue

SPtr<DataStream> GetValue(RTTIType *rtti, void *object, u32 &size) override

Retrieves a data block from the specified instance.

SetValue

void SetValue(RTTIType *rtti, void *object, const SPtr<DataStream> &value, u32 size) override

Sets a data block on the specified instance.

~RTTIField

virtual ~RTTIField() noexcept = default

CheckIsArray

void CheckIsArray(bool array) const

Throws an exception depending if the field is or isn't an array.

array
If true, then exception will be thrown if field is not an array. If false, then it will be thrown if field is an array.

Fields

Name

String Name

Schema

Protected

Methods

Init

void Init(String name, const RTTIFieldSchema &schema)

Private

Fields

getter

GetterType getter

setter

SetterType setter