class
RTTIType
Provides an interface for accessing fields of a certain class.
Data can be easily accessed by getter and setter methods.
Supported data types:
- Plain types - All types defined in B3DRTTIField.h, mostly native types and POD (plain old data) structs. Data is parsed byte by byte. No pointers to plain types are supported. Data is passed around by value.
- Reflectable types - Any class deriving from IReflectable. Data is parsed based on fields in its RTTI class. Can be pointer or value type.
- Arrays of both plain and reflectable types are supported
- Data blocks - A managed or unmanaged block of data. See ManagedDataBlock.
Public
Constructors
RTTIType
Methods
~RTTIType
GetDerivedClasses
Returns RTTI type information for all classes that derive from the class that owns this RTTI type.
GetBaseClass
Returns RTTI type information for the class that owns this RTTI type.
If the class has not base type, null is returned instead.
IsDerivedFrom
Returns true if current RTTI class is derived from . (Or if it is the same type as base)
NewRttiObject
Creates a new instance of the class owning this RTTI type.
GetRttiName
Returns the name of the class owning this RTTI type.
GetRttiId
Returns an RTTI id that uniquely represents each class in the RTTI system.
GetDefaultObject
Returns the default constructed object of this type.
Will return null if the class is abstract.
NotifyOperationStarted
Called before any operation that is iterating over the type's fields starts.
NotifyOperationEnded
Called after any operation that is iterating over the type's fields ends.
GetDeltaHandler
Returns a handler that determines how are deltas generated and applied when it comes to objects of this RTTI type.
A delta is a list of differences between two objects that may be saved, viewed or applied to another object.
GetFieldCount
Returns the total number of fields in this RTTI type.
GetField
Returns a field based on the field index.
Use getNumFields() to get total number of fields available.
FindField
Tries to find a field with the specified name.
Throws an exception if it can't.
- name
- The name of the field.
FindField
Tries to find a field with the specified unique ID.
Doesn't throw an exception if it can't find the field (Unlike findField(const String
&
)).
- uniqueFieldId
- Unique identifier for the field.
Returns: nullptr if it can't find the field.
GetSchema
Returns a set of serializable meta-data describing the RTTI type.
Internal
Methods
RegisterDerivedClassInternal
Called by the RTTI system when a class is first found in order to form child/parent class hierarchy.
CloneInternal
Constucts a cloned version of the underlying class.
The cloned version will not have any field information and should instead be used for passing to various RTTIField methods during serialization/deserialization. This allows each object instance to have a unique places to store temporary instance-specific data.
InitializeDefaultObject
Constructs the default object for the type, if it's possible to construct one.
InitSchemaInternal
Initializes the type schema.
Should be called once after construction.
Protected
Methods
AddNewField
Tries to add a new field to the fields array, and throws an exception if a field with the same name or id already exists.
- field
- Field, must be non-null.