![]() |
XII Release 0.1.0
|
Runtime type information for script classes, extending xiiRTTI with script-specific functionality. More...
#include <ScriptRTTI.h>
Public Types | |
| enum | { NumInplaceFunctions = 7 } |
| using | FunctionList = xiiSmallArray<xiiUniquePtr<xiiAbstractFunctionProperty>, NumInplaceFunctions> |
| using | MessageHandlerList = xiiSmallArray<xiiUniquePtr<xiiAbstractMessageHandler>, NumInplaceFunctions> |
Public Types inherited from xiiRTTI | |
| using | PredicateFunc = xiiDelegate<bool(const xiiRTTI*), 48> |
| using | VisitorFunc = xiiDelegate<void(const xiiRTTI*), 48> |
Public Member Functions | |
| xiiScriptRTTI (xiiStringView sName, const xiiRTTI *pParentType, FunctionList &&functions, MessageHandlerList &&messageHandlers) | |
| const xiiAbstractFunctionProperty * | GetFunctionByIndex (xiiUInt32 uiIndex) const |
Public Member Functions inherited from xiiRTTI | |
| xiiRTTI (xiiStringView sName, const xiiRTTI *pParentType, xiiUInt32 uiTypeSize, xiiUInt32 uiTypeVersion, xiiUInt8 uiVariantType, xiiBitflags< xiiTypeFlags > flags, xiiRTTIAllocator *pAllocator, xiiArrayPtr< const xiiAbstractProperty * > properties, xiiArrayPtr< const xiiAbstractFunctionProperty * > functions, xiiArrayPtr< const xiiPropertyAttribute * > attributes, xiiArrayPtr< xiiAbstractMessageHandler * > messageHandlers, xiiArrayPtr< xiiMessageSenderInfo > messageSenders, const xiiRTTI *(*fnVerifyParent)()) | |
| The constructor requires all the information about the type that this object represents. | |
| void | VerifyCorrectness () const |
| Can be called in debug builds to check that all reflected objects are correctly set up. | |
| XII_ALWAYS_INLINE xiiStringView | GetTypeName () const |
| Returns the name of this type. | |
| XII_ALWAYS_INLINE xiiUInt64 | GetTypeNameHash () const |
| Returns the hash of the name of this type. | |
| XII_ALWAYS_INLINE const xiiRTTI * | GetParentType () const |
| Returns the type that is the base class of this type. May be nullptr if this type has no base class. | |
| XII_ALWAYS_INLINE xiiVariantType::Enum | GetVariantType () const |
| Returns the corresponding variant type for this type or Invalid if there is none. | |
| XII_ALWAYS_INLINE bool | IsDerivedFrom (const xiiRTTI *pBaseType) const |
| Returns true if this type is derived from the given type (or of the same type). | |
| template<typename BASE> | |
| XII_ALWAYS_INLINE bool | IsDerivedFrom () const |
| Returns true if this type is derived from or identical to the given type. | |
| XII_ALWAYS_INLINE xiiRTTIAllocator * | GetAllocator () const |
| Returns the object through which instances of this type can be allocated. | |
| XII_ALWAYS_INLINE xiiArrayPtr< const xiiAbstractProperty *const > | GetProperties () const |
| Returns the array of properties that this type has. Does NOT include properties from base classes. | |
| XII_ALWAYS_INLINE xiiArrayPtr< const xiiAbstractFunctionProperty *const > | GetFunctions () const |
| XII_ALWAYS_INLINE xiiArrayPtr< const xiiPropertyAttribute *const > | GetAttributes () const |
| template<typename Type> | |
| const Type * | GetAttributeByType () const |
| Returns the first attribute that derives from the given type, or nullptr if nothing is found. | |
| void | GetAllProperties (xiiDynamicArray< const xiiAbstractProperty * > &out_properties) const |
| Returns the list of properties that this type has, including derived properties from all base classes. | |
| XII_ALWAYS_INLINE xiiUInt32 | GetTypeSize () const |
| Returns the size (in bytes) of an instance of this type. | |
| XII_ALWAYS_INLINE xiiUInt32 | GetTypeVersion () const |
| Returns the version number of this type. | |
| XII_ALWAYS_INLINE const xiiBitflags< xiiTypeFlags > & | GetTypeFlags () const |
| Returns the type flags. | |
| const xiiAbstractProperty * | FindPropertyByName (xiiStringView sName, bool bSearchBaseTypes=true) const |
| Will iterate over all properties of this type and (optionally) the base types to search for a property with the given name. | |
| XII_ALWAYS_INLINE xiiStringView | GetPluginName () const |
| Returns the name of the plugin which this type is declared in. | |
| XII_ALWAYS_INLINE const xiiArrayPtr< xiiAbstractMessageHandler * > & | GetMessageHandlers () const |
| Returns the array of message handlers that this type has. | |
| bool | DispatchMessage (void *pInstance, xiiMessage &ref_msg) const |
| Dispatches the given message to the proper message handler, if there is one available. Returns true if so, false if no message handler for this type exists. | |
| bool | DispatchMessage (const void *pInstance, xiiMessage &ref_msg) const |
| Dispatches the given message to the proper message handler, if there is one available. Returns true if so, false if no message handler for this type exists. | |
| template<typename MessageType> | |
| XII_ALWAYS_INLINE bool | CanHandleMessage () const |
| Returns whether this type can handle the given message type. | |
| bool | CanHandleMessage (xiiMessageId id) const |
| Returns whether this type can handle the message type with the given id. | |
| XII_ALWAYS_INLINE const xiiArrayPtr< xiiMessageSenderInfo > & | GetMessageSender () const |
Public Member Functions inherited from xiiRefCountingImpl | |
| xiiRefCountingImpl ()=default | |
| Constructor. | |
| xiiRefCountingImpl (const xiiRefCountingImpl &rhs) | |
| void | operator= (const xiiRefCountingImpl &rhs) |
| xiiUInt32 | AddRef () const |
| Increments the reference counter. Returns the new reference count. | |
| xiiUInt32 | ReleaseRef () const |
| Decrements the reference counter. Returns the new reference count. | |
| bool | IsReferenced () const |
| Returns true if the reference count is greater than 0, false otherwise. | |
| xiiUInt32 | GetRefCount () const |
| Returns the current reference count. | |
Additional Inherited Members | |
Static Public Member Functions inherited from xiiRTTI | |
| static void | VerifyCorrectnessForAllTypes () |
| Calls VerifyCorrectness() on all xiiRTTI objects. | |
| static const xiiRTTI * | FindTypeByName (xiiStringView sName) |
| Searches all xiiRTTI instances for the one with the given name, or nullptr if no such type exists. | |
| static const xiiRTTI * | FindTypeByNameHash (xiiUInt64 uiNameHash) |
| Searches all xiiRTTI instances for the one with the given hashed name, or nullptr if no such type exists. | |
| static const xiiRTTI * | FindTypeByNameHash32 (xiiUInt32 uiNameHash) |
| static const xiiRTTI * | FindTypeIf (PredicateFunc func) |
| Searches all xiiRTTI instances for one where the given predicate function returns true. | |
| static void | ForEachType (VisitorFunc func, xiiBitflags< ForEachOptions > options=ForEachOptions::Default) |
| static void | ForEachDerivedType (const xiiRTTI *pBaseType, VisitorFunc func, xiiBitflags< ForEachOptions > options=ForEachOptions::Default) |
| template<typename T> | |
| static XII_ALWAYS_INLINE void | ForEachDerivedType (VisitorFunc func, xiiBitflags< ForEachOptions > options=ForEachOptions::Default) |
Protected Member Functions inherited from xiiRTTI | |
| void | UpdateType (const xiiRTTI *pParentType, xiiUInt32 uiTypeSize, xiiUInt32 uiTypeVersion, xiiUInt8 uiVariantType, xiiBitflags< xiiTypeFlags > flags) |
| void | RegisterType () |
| void | UnregisterType () |
| void | GatherDynamicMessageHandlers () |
| void | SetupParentHierarchy () |
Protected Attributes inherited from xiiRTTI | |
| xiiStringView | m_sPluginName |
| xiiStringView | m_sTypeName |
| xiiArrayPtr< const xiiAbstractProperty *const > | m_Properties |
| xiiArrayPtr< const xiiAbstractFunctionProperty *const > | m_Functions |
| xiiArrayPtr< const xiiPropertyAttribute *const > | m_Attributes |
| const xiiRTTI * | m_pParentType = nullptr |
| xiiRTTIAllocator * | m_pAllocator = nullptr |
| xiiUInt32 | m_uiTypeSize = 0 |
| xiiUInt32 | m_uiTypeVersion = 0 |
| xiiUInt64 | m_uiTypeNameHash = 0 |
| xiiUInt32 | m_uiTypeIndex = 0 |
| xiiBitflags< xiiTypeFlags > | m_TypeFlags |
| xiiUInt8 | m_uiVariantType = 0 |
| xiiUInt16 | m_uiMsgIdOffset = xiiSmallInvalidIndex |
| const xiiRTTI *(* | m_VerifyParent )() |
| xiiArrayPtr< xiiAbstractMessageHandler * > | m_MessageHandlers |
| xiiSmallArray< xiiAbstractMessageHandler *, 1, xiiStaticAllocatorWrapper > | m_DynamicMessageHandlers |
| xiiArrayPtr< xiiMessageSenderInfo > | m_MessageSenders |
| xiiSmallArray< const xiiRTTI *, 7, xiiStaticAllocatorWrapper > | m_ParentHierarchy |
Runtime type information for script classes, extending xiiRTTI with script-specific functionality.
Manages type metadata for script classes including function properties and message handlers. Supports reference counting and provides efficient storage for small numbers of functions and message handlers through inplace storage optimization.