ezEngine  Milestone 7
ezRTTI Class Reference

This enumerable class holds information about reflected types. Each instance represents one type that is known to the reflection system. More...

#include <RTTI.h>

Inheritance diagram for ezRTTI:

Public Member Functions

 ezRTTI (const char *szName, const ezRTTI *pParentType, ezUInt32 uiTypeSize, ezUInt32 uiTypeVersion, ezUInt32 uiVariantType, ezBitflags< ezTypeFlags > flags, ezRTTIAllocator *pAllocator, ezArrayPtr< ezAbstractProperty * > properties, ezArrayPtr< ezAbstractMessageHandler * > messageHandlers, const ezRTTI *(*fnVerifyParent)())
 The constructor requires all the information about the type that this object represents.
 
EZ_FORCE_INLINE const char * GetTypeName () const
 Returns the name of this type.
 
EZ_FORCE_INLINE const ezRTTIGetParentType () const
 Returns the type that is the base class of this type. May be nullptr if this type has no base class.
 
EZ_FORCE_INLINE
ezVariant::Type::Enum 
GetVariantType () const
 Returns the corresponding variant type for this type or Invalid if there is none.
 
bool IsDerivedFrom (const ezRTTI *pBaseType) const
 Returns true if this type is derived from the given type.
 
template<typename BASE >
EZ_FORCE_INLINE bool IsDerivedFrom () const
 Returns true if this type is derived from the given type.
 
EZ_FORCE_INLINE ezRTTIAllocatorGetAllocator () const
 Returns the object through which instances of this type can be allocated.
 
EZ_FORCE_INLINE const
ezArrayPtr< ezAbstractProperty * > & 
GetProperties () const
 Returns the array of properties that this type has. Does NOT include properties from base classes.
 
void GetAllProperties (ezHybridArray< ezAbstractProperty *, 32 > &out_Properties) const
 Returns the list of properties that this type has, including derived properties from all base classes.
 
EZ_FORCE_INLINE ezUInt32 GetTypeSize () const
 Returns the size (in bytes) of an instance of this type.
 
EZ_FORCE_INLINE ezUInt32 GetTypeVersion () const
 Returns the version number of this type.
 
EZ_FORCE_INLINE const
ezBitflags< ezTypeFlags > & 
GetTypeFlags () const
 Returns the type flags.
 
ezAbstractPropertyFindPropertyByName (const char *szName, 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.
 
EZ_FORCE_INLINE const char * GetPluginName () const
 Returns the name of the plugin which this type is declared in.
 
EZ_FORCE_INLINE const
ezArrayPtr
< ezAbstractMessageHandler * > & 
GetMessageHandlers () const
 Returns the array of message handlers that this type has.
 
bool DispatchMessage (void *pInstance, ezMessage &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, ezMessage &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 >
EZ_FORCE_INLINE bool CanHandleMessage () const
 Returns whether this type can handle the given message type.
 
EZ_FORCE_INLINE bool CanHandleMessage (ezMessageId id) const
 Returns whether this type can handle the message type with the given id.
 

Static Public Member Functions

static ezRTTIFindTypeByName (const char *szName)
 Iterates over all ezRTTI instances and returns the one with the given name, or nullptr if no such type exists.
 

Protected Member Functions

void UpdateType (const ezRTTI *pParentType, ezUInt32 uiTypeSize, ezUInt32 uiTypeVersion, ezUInt32 uiVariantType, ezBitflags< ezTypeFlags > flags)
 

Protected Attributes

const char * m_szPluginName
 
const char * m_szTypeName
 
ezArrayPtr< ezAbstractProperty * > m_Properties
 
- Protected Attributes inherited from ezEnumerable< ezRTTI >
ezEnumerablem_pNextInstance
 

Private Member Functions

 EZ_DECLARE_ENUMERABLE_CLASS (ezRTTI)
 
 EZ_MAKE_SUBSYSTEM_STARTUP_FRIEND (Foundation, Reflection)
 

Static Private Member Functions

static void AssignPlugin (const char *szPluginName)
 Assigns the given plugin name to every ezRTTI instance that has no plugin assigned yet.
 
static void SanityCheckType (ezRTTI *pType)
 
static void PluginEventHandler (const ezPlugin::PluginEvent &EventData)
 Handles events by ezPlugin, to figure out which types were provided by which plugin.
 

Private Attributes

const ezRTTIm_pParentType
 
ezUInt32 m_uiVariantType
 
ezUInt32 m_uiTypeSize
 
ezUInt32 m_uiMsgIdOffset
 
ezUInt32 m_uiTypeVersion
 
ezBitflags< ezTypeFlagsm_TypeFlags
 
ezRTTIAllocatorm_pAllocator
 
ezArrayPtr
< ezAbstractMessageHandler * > 
m_MessageHandlers
 
ezDynamicArray
< ezAbstractMessageHandler * > 
m_DynamicMessageHandlers
 

Detailed Description

This enumerable class holds information about reflected types. Each instance represents one type that is known to the reflection system.

Instances of this class are typically created through the macros from the StaticRTTI.h header. Each instance represents one type. This class holds information about derivation hierarchies and exposed properties. You can thus find out whether a type is derived from some base class and what properties of which types are available. Properties can then be read and modified on instances of this type.


The documentation for this class was generated from the following files: