ezEngine  Milestone 9
StaticRTTI.h File Reference
#include <Foundation/Basics.h>
#include <Foundation/Types/Bitflags.h>
#include <Foundation/Types/Variant.h>
#include <type_traits>

Go to the source code of this file.

Classes

struct  ezTypeFlags
 Flags that describe a reflected type. More...
 
struct  ezTypeFlags::Bits
 
struct  ezInternal::ezStaticRTTI< T >
 [internal] Helper struct for accessing static RTTI data. More...
 
struct  ezInternal::ezStaticRTTI< ezNoBase >
 
struct  ezInternal::ezStaticRTTI< void >
 

Macros

#define EZ_NO_LINKAGE
 
#define EZ_DECLARE_REFLECTABLE_TYPE(Linkage, TYPE)
 Declares a type to be statically reflectable. Insert this into the header of a type to enable reflection on it. This is not needed if the type is already dynamically reflectable. More...
 
#define EZ_ALLOW_PRIVATE_PROPERTIES(SELF)   friend struct ezRTTInfo_##SELF
 Insert this into a class/struct to enable properties that are private members. All types that have dynamic reflection (. More...
 
#define EZ_BEGIN_STATIC_REFLECTED_TYPE(Type, BaseType, Version, AllocatorType)
 Implements the necessary functionality for a type to be statically reflectable. More...
 
#define EZ_END_STATIC_REFLECTED_TYPE
 Ends the reflection code block that was opened with EZ_BEGIN_STATIC_REFLECTED_TYPE. More...
 
#define EZ_BEGIN_PROPERTIES   static ezAbstractProperty* PropertyList[] =
 Within a EZ_BEGIN_REFLECTED_TYPE / EZ_END_REFLECTED_TYPE block, use this to start the block that declares all the properties.
 
#define EZ_END_PROPERTIES
 Ends the block to declare properties that was started with EZ_BEGIN_PROPERTIES. More...
 
#define EZ_BEGIN_FUNCTIONS   static ezAbstractFunctionProperty* FunctionList[] =
 Within a EZ_BEGIN_REFLECTED_TYPE / EZ_END_REFLECTED_TYPE block, use this to start the block that declares all the functions.
 
#define EZ_END_FUNCTIONS
 Ends the block to declare functions that was started with EZ_BEGIN_FUNCTIONS. More...
 
#define EZ_BEGIN_ATTRIBUTES   static ezPropertyAttribute* AttributeList[] =
 Within a EZ_BEGIN_REFLECTED_TYPE / EZ_END_REFLECTED_TYPE block, use this to start the block that declares all the attributes.
 
#define EZ_END_ATTRIBUTES
 Ends the block to declare attributes that was started with EZ_BEGIN_ATTRIBUTES. More...
 
#define EZ_FUNCTION_PROPERTY(Function)   (new ezFunctionProperty<decltype(&OwnType::Function)>(EZ_STRINGIZE(Function), &OwnType::Function))
 Within a EZ_BEGIN_FUNCTIONS / EZ_END_FUNCTIONS; block, this adds a member or static function property stored inside the RTTI data. More...
 
#define EZ_FUNCTION_PROPERTY_EX(PropertyName, Function)   (new ezFunctionProperty<decltype(&Function)>(PropertyName, &Function))
 Within a EZ_BEGIN_FUNCTIONS / EZ_END_FUNCTIONS; block, this adds a member or static function property stored inside the RTTI data. Use this version if you need to change the name of the function or need to cast the function to one of its overload versions. More...
 
#define EZ_CONSTRUCTOR_PROPERTY(...)   (new ezConstructorFunctionProperty<OwnType, ##__VA_ARGS__>())
 Within a EZ_BEGIN_FUNCTIONS / EZ_END_FUNCTIONS; block, this adds a constructor function property stored inside the RTTI data. More...
 
#define EZ_GETTER_TYPE(Class, GetterFunc)   decltype(((Class*)nullptr)->GetterFunc())
 
#define EZ_ACCESSOR_PROPERTY(PropertyName, Getter, Setter)   (new ezAccessorProperty<OwnType, EZ_GETTER_TYPE(OwnType, OwnType::Getter)>(PropertyName, &OwnType::Getter, &OwnType::Setter))
 Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that uses custom getter / setter functions. More...
 
#define EZ_ACCESSOR_PROPERTY_READ_ONLY(PropertyName, Getter)   (new ezAccessorProperty<OwnType, EZ_GETTER_TYPE(OwnType, OwnType::Getter)>(PropertyName, &OwnType::Getter, nullptr))
 Same as EZ_ACCESSOR_PROPERTY, but no setter is provided, thus making the property read-only.
 
#define EZ_ARRAY_GETTER_TYPE(Class, GetterFunc)   decltype(((Class*)nullptr)->GetterFunc(0))
 
#define EZ_ARRAY_ACCESSOR_PROPERTY(PropertyName, GetCount, Getter, Setter, Insert, Remove)
 Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that uses custom functions to access an array. More...
 
#define EZ_ARRAY_ACCESSOR_PROPERTY_READ_ONLY(PropertyName, GetCount, Getter)
 Same as EZ_ARRAY_ACCESSOR_PROPERTY, but no setter is provided, thus making the property read-only. More...
 
#define EZ_SET_CONTAINER_TYPE(Class, GetterFunc)   decltype(((Class*)nullptr)->GetterFunc())
 
#define EZ_SET_CONTAINER_SUB_TYPE(Class, GetterFunc)   ezContainerSubTypeResolver<ezTypeTraits<decltype(((Class*)nullptr)->GetterFunc())>::NonConstReferenceType>::Type
 
#define EZ_SET_ACCESSOR_PROPERTY(PropertyName, GetValues, Insert, Remove)
 Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that uses custom functions to access a set. More...
 
#define EZ_SET_ACCESSOR_PROPERTY_READ_ONLY(PropertyName, GetValues)
 Same as EZ_SET_ACCESSOR_PROPERTY, but no setter is provided, thus making the property read-only. More...
 
#define EZ_MAP_WRITE_ACCESSOR_PROPERTY(PropertyName, GetContainer, Insert, Remove)
 Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that uses custom functions to for write access to a map. Use this if you have a ezHashTable or ezMap to expose directly and just want to be informed of write operations. More...
 
#define EZ_MAP_ACCESSOR_PROPERTY(PropertyName, GetKeyRange, GetValue, Insert, Remove)
 Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that uses custom functions to access a map. Use this if you you want to hide the implementation details of the map from the user. More...
 
#define EZ_MAP_ACCESSOR_PROPERTY_READ_ONLY(PropertyName, GetKeyRange, GetValue)
 Same as EZ_MAP_ACCESSOR_PROPERTY, but no setter is provided, thus making the property read-only. More...
 
#define EZ_ENUM_ACCESSOR_PROPERTY(PropertyName, EnumType, Getter, Setter)
 Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that uses custom getter / setter functions. More...
 
#define EZ_ENUM_ACCESSOR_PROPERTY_READ_ONLY(PropertyName, EnumType, Getter)   (new ezEnumAccessorProperty<OwnType, EnumType, EZ_GETTER_TYPE(OwnType, OwnType::Getter)>(PropertyName, &OwnType::Getter, nullptr))
 Same as EZ_ENUM_ACCESSOR_PROPERTY, but no setter is provided, thus making the property read-only.
 
#define EZ_BITFLAGS_ACCESSOR_PROPERTY(PropertyName, BitflagsType, Getter, Setter)
 Same as EZ_ENUM_ACCESSOR_PROPERTY, but for bitfields. More...
 
#define EZ_BITFLAGS_ACCESSOR_PROPERTY_READ_ONLY(PropertyName, BitflagsType, Getter)   (new ezBitflagsAccessorProperty<OwnType, BitflagsType, EZ_GETTER_TYPE(OwnType, OwnType::Getter)>(PropertyName, &OwnType::Getter, nullptr))
 Same as EZ_BITFLAGS_ACCESSOR_PROPERTY, but no setter is provided, thus making the property read-only.
 
#define EZ_MEMBER_TYPE(Class, Member)   decltype(((Class*)nullptr)->Member)
 
#define EZ_MEMBER_CONTAINER_SUB_TYPE(Class, Member)   ezContainerSubTypeResolver<ezTypeTraits<decltype(((Class*)nullptr)->Member)>::NonConstReferenceType>::Type
 
#define EZ_MEMBER_PROPERTY(PropertyName, MemberName)
 Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that actually exists as a member. More...
 
#define EZ_MEMBER_PROPERTY_READ_ONLY(PropertyName, MemberName)
 Same as EZ_MEMBER_PROPERTY, but the property is read-only. More...
 
#define EZ_ARRAY_MEMBER_PROPERTY(PropertyName, MemberName)
 Same as EZ_MEMBER_PROPERTY, but the property is an array (ezHybridArray, ezDynamicArray or ezDeque). More...
 
#define EZ_ARRAY_MEMBER_PROPERTY_READ_ONLY(PropertyName, MemberName)
 Same as EZ_MEMBER_PROPERTY, but the property is a read-only array (ezHybridArray, ezDynamicArray or ezDeque). More...
 
#define EZ_SET_MEMBER_PROPERTY(PropertyName, MemberName)
 Same as EZ_MEMBER_PROPERTY, but the property is a set (ezSet, ezHashSet). More...
 
#define EZ_SET_MEMBER_PROPERTY_READ_ONLY(PropertyName, MemberName)
 Same as EZ_MEMBER_PROPERTY, but the property is a read-only set (ezSet, ezHashSet). More...
 
#define EZ_MAP_MEMBER_PROPERTY(PropertyName, MemberName)
 Same as EZ_MEMBER_PROPERTY, but the property is a map (ezMap, ezHashTable). More...
 
#define EZ_MAP_MEMBER_PROPERTY_READ_ONLY(PropertyName, MemberName)
 Same as EZ_MEMBER_PROPERTY, but the property is a read-only map (ezMap, ezHashTable). More...
 
#define EZ_ENUM_MEMBER_PROPERTY(PropertyName, EnumType, MemberName)
 Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that actually exists as a member. More...
 
#define EZ_ENUM_MEMBER_PROPERTY_READ_ONLY(PropertyName, EnumType, MemberName)
 Same as EZ_ENUM_MEMBER_PROPERTY, but the property is read-only. More...
 
#define EZ_BITFLAGS_MEMBER_PROPERTY(PropertyName, BitflagsType, MemberName)
 Same as EZ_ENUM_MEMBER_PROPERTY, but for bitfields. More...
 
#define EZ_BITFLAGS_MEMBER_PROPERTY_READ_ONLY(PropertyName, BitflagsType, MemberName)
 Same as EZ_ENUM_MEMBER_PROPERTY_READ_ONLY, but for bitfields. More...
 
#define EZ_CONSTANT_PROPERTY(PropertyName, Value)   (new ezConstantProperty<decltype(Value)>(PropertyName, Value))
 Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a constant property stored inside the RTTI data. More...
 
#define EZ_ENUM_VALUE_TO_CONSTANT_PROPERTY(name)   EZ_CONSTANT_PROPERTY(EZ_STRINGIZE(name), (Storage)name),
 
#define EZ_ENUM_CONSTANTS(...)   EZ_EXPAND_ARGS(EZ_ENUM_VALUE_TO_CONSTANT_PROPERTY, ##__VA_ARGS__)
 Within a EZ_BEGIN_STATIC_REFLECTED_ENUM / EZ_END_STATIC_REFLECTED_ENUM block, this converts a list of enum values into constant RTTI properties.
 
#define EZ_ENUM_CONSTANT(Value)   EZ_CONSTANT_PROPERTY(EZ_STRINGIZE(Value), (Storage)Value)
 Within a EZ_BEGIN_STATIC_REFLECTED_ENUM / EZ_END_STATIC_REFLECTED_ENUM block, this converts a an enum value into a constant RTTI property.
 
#define EZ_BITFLAGS_CONSTANTS(...)   EZ_EXPAND_ARGS(EZ_ENUM_VALUE_TO_CONSTANT_PROPERTY, ##__VA_ARGS__)
 Within a EZ_BEGIN_STATIC_REFLECTED_BITFLAGS / EZ_END_STATIC_REFLECTED_BITFLAGS block, this converts a list of bitflags into constant RTTI properties.
 
#define EZ_BITFLAGS_CONSTANT(Value)   EZ_CONSTANT_PROPERTY(EZ_STRINGIZE(Value), (Storage)Value)
 Within a EZ_BEGIN_STATIC_REFLECTED_BITFLAGS / EZ_END_STATIC_REFLECTED_BITFLAGS block, this converts a an bitflags into a constant RTTI property.
 
#define EZ_BEGIN_STATIC_REFLECTED_ENUM(Type, Version)
 Implements the necessary functionality for an enum to be statically reflectable. More...
 
#define EZ_END_STATIC_REFLECTED_ENUM
 
#define EZ_BEGIN_STATIC_REFLECTED_BITFLAGS(Type, Version)
 Implements the necessary functionality for bitflags to be statically reflectable. More...
 
#define EZ_END_STATIC_REFLECTED_BITFLAGS
 
#define EZ_BEGIN_MESSAGEHANDLERS   static ezAbstractMessageHandler* HandlerList[] =
 Within an EZ_BEGIN_REFLECTED_TYPE / EZ_END_REFLECTED_TYPE block, use this to start the block that declares all the message handlers.
 
#define EZ_END_MESSAGEHANDLERS
 Ends the block to declare message handlers that was started with EZ_BEGIN_MESSAGEHANDLERS. More...
 
#define EZ_MESSAGE_HANDLER(MessageType, FunctionName)
 Within an EZ_BEGIN_MESSAGEHANDLERS / EZ_END_MESSAGEHANDLERS; block, this adds another message handler. More...
 
#define EZ_BEGIN_MESSAGESENDERS   static ezMessageSenderInfo SenderList[] =
 Within an EZ_BEGIN_REFLECTED_TYPE / EZ_END_REFLECTED_TYPE block, use this to start the block that declares all the message senders.
 
#define EZ_END_MESSAGESENDERS
 Ends the block to declare message senders that was started with EZ_BEGIN_MESSAGESENDERS. More...
 
#define EZ_MESSAGE_SENDER(MemberName)
 Within an EZ_BEGIN_MESSAGESENDERS / EZ_END_MESSAGESENDERS block, this adds another message sender. More...
 

Functions

template<typename T >
EZ_ALWAYS_INLINE const ezRTTIezInternal::GetStaticRTTI (ezTraitInt< 1 >)
 
template<typename T >
EZ_ALWAYS_INLINE const ezRTTIezInternal::GetStaticRTTI (ezTraitInt< 0 >)
 
template<typename Type >
ezBitflags< ezTypeFlagsezInternal::DetermineTypeFlags ()
 
template<>
EZ_ALWAYS_INLINE ezBitflags< ezTypeFlagsezInternal::DetermineTypeFlags< ezVariant > ()
 
template<typename T >
EZ_ALWAYS_INLINE const ezRTTIezGetStaticRTTI ()
 Use this function, specialized with the type that you are interested in, to get the static RTTI data for some type.
 

Macro Definition Documentation

◆ EZ_ACCESSOR_PROPERTY

#define EZ_ACCESSOR_PROPERTY (   PropertyName,
  Getter,
  Setter 
)    (new ezAccessorProperty<OwnType, EZ_GETTER_TYPE(OwnType, OwnType::Getter)>(PropertyName, &OwnType::Getter, &OwnType::Setter))

Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that uses custom getter / setter functions.

Parameters
PropertyNameThe unique (in this class) name under which the property should be registered.
GetterThe getter function for this property.
SetterThe setter function for this property.
Note
There does not actually need to be a variable for this type of properties, as all accesses go through functions. Thus you can for example expose a 'vector' property that is actually stored as a column of a matrix.

◆ EZ_ALLOW_PRIVATE_PROPERTIES

#define EZ_ALLOW_PRIVATE_PROPERTIES (   SELF)    friend struct ezRTTInfo_##SELF

Insert this into a class/struct to enable properties that are private members. All types that have dynamic reflection (.

See also
EZ_ADD_DYNAMIC_REFLECTION) already have this ability.

◆ EZ_ARRAY_ACCESSOR_PROPERTY

#define EZ_ARRAY_ACCESSOR_PROPERTY (   PropertyName,
  GetCount,
  Getter,
  Setter,
  Insert,
  Remove 
)
Value:
PropertyName, &OwnType::GetCount, &OwnType::Getter, &OwnType::Setter, &OwnType::Insert, &OwnType::Remove))
Definition: ArrayProperty.h:46

Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that uses custom functions to access an array.

Parameters
PropertyNameThe unique (in this class) name under which the property should be registered.
GetCountFunction signature: ezUInt32 GetCount() const;
GetterFunction signature: Type GetValue(ezUInt32 uiIndex) const;
SetterFunction signature: void SetValue(ezUInt32 uiIndex, Type value);
InsertFunction signature: void Insert(ezUInt32 uiIndex, Type value);
RemoveFunction signature: void Remove(ezUInt32 uiIndex);

◆ EZ_ARRAY_ACCESSOR_PROPERTY_READ_ONLY

#define EZ_ARRAY_ACCESSOR_PROPERTY_READ_ONLY (   PropertyName,
  GetCount,
  Getter 
)
Value:
&OwnType::Getter, nullptr, nullptr, nullptr))
Definition: ArrayProperty.h:46

Same as EZ_ARRAY_ACCESSOR_PROPERTY, but no setter is provided, thus making the property read-only.

◆ EZ_ARRAY_MEMBER_PROPERTY

◆ EZ_ARRAY_MEMBER_PROPERTY_READ_ONLY

#define EZ_ARRAY_MEMBER_PROPERTY_READ_ONLY (   PropertyName,
  MemberName 
)

◆ EZ_BEGIN_STATIC_REFLECTED_BITFLAGS

#define EZ_BEGIN_STATIC_REFLECTED_BITFLAGS (   Type,
  Version 
)
Value:
typedef Type::StorageType Storage; \
EZ_BEGIN_PROPERTIES \
{ \
EZ_CONSTANT_PROPERTY(EZ_STRINGIZE(Type::Default), (Storage)Type::Default),
#define EZ_STRINGIZE(str)
Turns some piece of code (usually some identifier name) into a string. Even works on macros...
Definition: PreprocessorUtils.h:12
#define EZ_BEGIN_STATIC_REFLECTED_TYPE(Type, BaseType, Version, AllocatorType)
Implements the necessary functionality for a type to be statically reflectable.
Definition: StaticRTTI.h:186
Dummy type to pass to templates and macros that expect a base type for an bitflags class...
Definition: Types.h:119
Dummy Allocator for types that should not be allocatable through the reflection system.
Definition: RTTI.h:226

Implements the necessary functionality for bitflags to be statically reflectable.

Parameters
TypeThe bitflags struct used by ezBitflags for which reflection should be defined.
VersionThe version of Type. Must be increased when the class changes.

◆ EZ_BEGIN_STATIC_REFLECTED_ENUM

#define EZ_BEGIN_STATIC_REFLECTED_ENUM (   Type,
  Version 
)
Value:
typedef Type::StorageType Storage; \
EZ_BEGIN_PROPERTIES \
{ \
EZ_CONSTANT_PROPERTY(EZ_STRINGIZE(Type::Default), (Storage)Type::Default),
#define EZ_STRINGIZE(str)
Turns some piece of code (usually some identifier name) into a string. Even works on macros...
Definition: PreprocessorUtils.h:12
#define EZ_BEGIN_STATIC_REFLECTED_TYPE(Type, BaseType, Version, AllocatorType)
Implements the necessary functionality for a type to be statically reflectable.
Definition: StaticRTTI.h:186
Dummy Allocator for types that should not be allocatable through the reflection system.
Definition: RTTI.h:226
Dummy type to pass to templates and macros that expect a base type for an enum class.
Definition: Types.h:114

Implements the necessary functionality for an enum to be statically reflectable.

Parameters
TypeThe enum struct used by ezEnum for which reflection should be defined.
VersionThe version of Type. Must be increased when the class changes.

◆ EZ_BEGIN_STATIC_REFLECTED_TYPE

#define EZ_BEGIN_STATIC_REFLECTED_TYPE (   Type,
  BaseType,
  Version,
  AllocatorType 
)
Value:
EZ_RTTIINFO_DECL(Type, BaseType, Version) \
ezRTTI ezInternal::ezStaticRTTIWrapper_##Type::s_RTTI = ezRTTInfo_##Type::GetRTTI(); \
EZ_RTTIINFO_GETRTTI_IMPL_BEGIN(Type, AllocatorType)

Implements the necessary functionality for a type to be statically reflectable.

Parameters
TypeThe type for which the reflection functionality should be implemented.
BaseTypeThe base class type of Type. If it has no base class, pass ezNoBase
VersionThe version of Type. Must be increased when the class serialization changes.
AllocatorTypeThe type of an ezRTTIAllocator that can be used to create and destroy instances of Type. Pass ezRTTINoAllocator for types that should not be created dynamically. Pass ezRTTIDefaultAllocator<Type> for types that should be created on the default heap. Pass a custom ezRTTIAllocator type to handle allocation differently.

◆ EZ_BITFLAGS_ACCESSOR_PROPERTY

#define EZ_BITFLAGS_ACCESSOR_PROPERTY (   PropertyName,
  BitflagsType,
  Getter,
  Setter 
)
Value:
&OwnType::Setter))
[internal] An implementation of ezTypedEnumProperty that uses custom getter / setter functions to acc...
Definition: BitflagsProperty.h:10

Same as EZ_ENUM_ACCESSOR_PROPERTY, but for bitfields.

◆ EZ_BITFLAGS_MEMBER_PROPERTY

#define EZ_BITFLAGS_MEMBER_PROPERTY (   PropertyName,
  BitflagsType,
  MemberName 
)
Value:
[internal] An implementation of ezTypedEnumProperty that accesses the bitflags property data directly...
Definition: BitflagsProperty.h:59
[internal] Helper class to generate accessor functions for (private) members of another class ...
Definition: MemberProperty.h:144

Same as EZ_ENUM_MEMBER_PROPERTY, but for bitfields.

◆ EZ_BITFLAGS_MEMBER_PROPERTY_READ_ONLY

#define EZ_BITFLAGS_MEMBER_PROPERTY_READ_ONLY (   PropertyName,
  BitflagsType,
  MemberName 
)
Value:
[internal] An implementation of ezTypedEnumProperty that accesses the bitflags property data directly...
Definition: BitflagsProperty.h:59
[internal] Helper class to generate accessor functions for (private) members of another class ...
Definition: MemberProperty.h:144

Same as EZ_ENUM_MEMBER_PROPERTY_READ_ONLY, but for bitfields.

◆ EZ_CONSTANT_PROPERTY

#define EZ_CONSTANT_PROPERTY (   PropertyName,
  Value 
)    (new ezConstantProperty<decltype(Value)>(PropertyName, Value))

Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a constant property stored inside the RTTI data.

Parameters
PropertyNameThe unique (in this class) name under which the property should be registered.
ValueThe constant value to be stored.

◆ EZ_CONSTRUCTOR_PROPERTY

#define EZ_CONSTRUCTOR_PROPERTY (   ...)    (new ezConstructorFunctionProperty<OwnType, ##__VA_ARGS__>())

Within a EZ_BEGIN_FUNCTIONS / EZ_END_FUNCTIONS; block, this adds a constructor function property stored inside the RTTI data.

Parameters
FunctionThe function to be executed in the form of CLASS::FUNCTION_NAME.

◆ EZ_DECLARE_REFLECTABLE_TYPE

#define EZ_DECLARE_REFLECTABLE_TYPE (   Linkage,
  TYPE 
)
Value:
namespace ezInternal \
{ \
struct Linkage ezStaticRTTIWrapper_##TYPE \
{ \
static ezRTTI s_RTTI; \
}; \
\
/* This specialization calls the function to get the RTTI data */ \
/* This code might get duplicated in different DLLs, but all */ \
/* will call the same function, so the RTTI object is unique */ \
template <> \
struct ezStaticRTTI<TYPE> \
{ \
EZ_ALWAYS_INLINE static const ezRTTI* GetRTTI() { return &ezStaticRTTIWrapper_##TYPE::s_RTTI; } \
}; \
}
This enumerable class holds information about reflected types. Each instance represents one type that...
Definition: RTTI.h:30
Definition: EventMessage.h:27

Declares a type to be statically reflectable. Insert this into the header of a type to enable reflection on it. This is not needed if the type is already dynamically reflectable.

◆ EZ_END_ATTRIBUTES

#define EZ_END_ATTRIBUTES
Value:
; \
Attributes = AttributeList

Ends the block to declare attributes that was started with EZ_BEGIN_ATTRIBUTES.

◆ EZ_END_FUNCTIONS

#define EZ_END_FUNCTIONS
Value:
; \
Functions = FunctionList

Ends the block to declare functions that was started with EZ_BEGIN_FUNCTIONS.

◆ EZ_END_MESSAGEHANDLERS

#define EZ_END_MESSAGEHANDLERS
Value:
; \
MessageHandlers = HandlerList

Ends the block to declare message handlers that was started with EZ_BEGIN_MESSAGEHANDLERS.

◆ EZ_END_MESSAGESENDERS

#define EZ_END_MESSAGESENDERS
Value:
; \
MessageSenders = SenderList;

Ends the block to declare message senders that was started with EZ_BEGIN_MESSAGESENDERS.

◆ EZ_END_PROPERTIES

#define EZ_END_PROPERTIES
Value:
; \
Properties = PropertyList

Ends the block to declare properties that was started with EZ_BEGIN_PROPERTIES.

◆ EZ_END_STATIC_REFLECTED_BITFLAGS

#define EZ_END_STATIC_REFLECTED_BITFLAGS
Value:
} \
EZ_END_PROPERTIES; \
flags.Remove(ezTypeFlags::Class); \
EZ_END_STATIC_REFLECTED_TYPE
A class or struct. The above flags are mutually exclusive.
Definition: StaticRTTI.h:23
bitflags struct used for ezBitflags.
Definition: StaticRTTI.h:22

◆ EZ_END_STATIC_REFLECTED_ENUM

#define EZ_END_STATIC_REFLECTED_ENUM
Value:
} \
EZ_END_PROPERTIES; \
flags |= ezTypeFlags::IsEnum; \
flags.Remove(ezTypeFlags::Class); \
EZ_END_STATIC_REFLECTED_TYPE
A class or struct. The above flags are mutually exclusive.
Definition: StaticRTTI.h:23
enum struct used for ezEnum.
Definition: StaticRTTI.h:21

◆ EZ_END_STATIC_REFLECTED_TYPE

#define EZ_END_STATIC_REFLECTED_TYPE
Value:
; \
return ezRTTI(GetTypeName(), ezGetStaticRTTI<OwnBaseType>(), sizeof(OwnType), GetTypeVersion(), \
ezVariant::TypeDeduction<OwnType>::value, flags, &Allocator, Properties, Functions, Attributes, MessageHandlers, \
MessageSenders, nullptr); \
}
This enumerable class holds information about reflected types. Each instance represents one type that...
Definition: RTTI.h:30
A helper struct to convert the C++ type, which is passed as the template argument, into one of the ezVariant::Type enum values.
Definition: Variant.h:95

Ends the reflection code block that was opened with EZ_BEGIN_STATIC_REFLECTED_TYPE.

◆ EZ_ENUM_ACCESSOR_PROPERTY

#define EZ_ENUM_ACCESSOR_PROPERTY (   PropertyName,
  EnumType,
  Getter,
  Setter 
)
Value:
&OwnType::Setter))
[internal] An implementation of ezTypedEnumProperty that uses custom getter / setter functions to acc...
Definition: EnumProperty.h:56

Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that uses custom getter / setter functions.

Parameters
PropertyNameThe unique (in this class) name under which the property should be registered.
EnumTypeThe name of the enum struct used by ezEnum.
GetterThe getter function for this property.
SetterThe setter function for this property.

◆ EZ_ENUM_MEMBER_PROPERTY

#define EZ_ENUM_MEMBER_PROPERTY (   PropertyName,
  EnumType,
  MemberName 
)
Value:
[internal] An implementation of ezTypedEnumProperty that accesses the enum property data directly...
Definition: EnumProperty.h:105
[internal] Helper class to generate accessor functions for (private) members of another class ...
Definition: MemberProperty.h:144

Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that actually exists as a member.

Parameters
PropertyNameThe unique (in this class) name under which the property should be registered.
EnumTypeName of the struct used by ezEnum.
MemberNameThe name of the member variable that should get exposed as a property.
Note
Since the member is exposed directly, there is no way to know when the variable was modified. That also means no custom limits to the values can be applied. If that becomes necessary, just add getter / setter functions and expose the property as a EZ_ACCESSOR_PROPERTY instead.

◆ EZ_ENUM_MEMBER_PROPERTY_READ_ONLY

#define EZ_ENUM_MEMBER_PROPERTY_READ_ONLY (   PropertyName,
  EnumType,
  MemberName 
)
Value:
[internal] An implementation of ezTypedEnumProperty that accesses the enum property data directly...
Definition: EnumProperty.h:105
[internal] Helper class to generate accessor functions for (private) members of another class ...
Definition: MemberProperty.h:144

Same as EZ_ENUM_MEMBER_PROPERTY, but the property is read-only.

◆ EZ_FUNCTION_PROPERTY

#define EZ_FUNCTION_PROPERTY (   Function)    (new ezFunctionProperty<decltype(&OwnType::Function)>(EZ_STRINGIZE(Function), &OwnType::Function))

Within a EZ_BEGIN_FUNCTIONS / EZ_END_FUNCTIONS; block, this adds a member or static function property stored inside the RTTI data.

Parameters
FunctionThe function to be executed, must match the C++ function name.

◆ EZ_FUNCTION_PROPERTY_EX

#define EZ_FUNCTION_PROPERTY_EX (   PropertyName,
  Function 
)    (new ezFunctionProperty<decltype(&Function)>(PropertyName, &Function))

Within a EZ_BEGIN_FUNCTIONS / EZ_END_FUNCTIONS; block, this adds a member or static function property stored inside the RTTI data. Use this version if you need to change the name of the function or need to cast the function to one of its overload versions.

Parameters
PropertyNameThe name under which the property should be registered.
FunctionThe function to be executed, must match the C++ function name including the class name e.g. 'CLASS::NAME'.

◆ EZ_MAP_ACCESSOR_PROPERTY

#define EZ_MAP_ACCESSOR_PROPERTY (   PropertyName,
  GetKeyRange,
  GetValue,
  Insert,
  Remove 
)
Value:
EZ_SET_CONTAINER_TYPE(OwnType, GetKeyRange)>(PropertyName, &OwnType::GetKeyRange, &OwnType::GetValue, \
&OwnType::Insert, &OwnType::Remove))
Definition: MapProperty.h:31

Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that uses custom functions to access a map. Use this if you you want to hide the implementation details of the map from the user.

Parameters
PropertyNameThe unique (in this class) name under which the property should be registered.
GetKeyRangeFunction signature: const Range GetValues() const; Range has to be an object that a ranged based for-loop can iterate over containing the keys implicitly convertible to Type / ezString.
GetValueFunction signature: bool GetValue(const char* szKey, Type& value); Returns whether the the key existed. value must be a non const ref as it is written to.
InsertFunction signature: void Insert(const char* szKey, Type value); value can also be const and/or a reference.
RemoveFunction signature: void Remove(const char* szKey);
Note
Container can be ezMap or ezHashTable

◆ EZ_MAP_ACCESSOR_PROPERTY_READ_ONLY

#define EZ_MAP_ACCESSOR_PROPERTY_READ_ONLY (   PropertyName,
  GetKeyRange,
  GetValue 
)
Value:
EZ_SET_CONTAINER_TYPE(OwnType, GetKeyRange)>(PropertyName, &OwnType::GetKeyRange, &OwnType::GetValue, nullptr, nullptr))
Definition: MapProperty.h:31
Definition: TypeTraits.h:184

Same as EZ_MAP_ACCESSOR_PROPERTY, but no setter is provided, thus making the property read-only.

◆ EZ_MAP_MEMBER_PROPERTY

◆ EZ_MAP_MEMBER_PROPERTY_READ_ONLY

#define EZ_MAP_MEMBER_PROPERTY_READ_ONLY (   PropertyName,
  MemberName 
)

◆ EZ_MAP_WRITE_ACCESSOR_PROPERTY

#define EZ_MAP_WRITE_ACCESSOR_PROPERTY (   PropertyName,
  GetContainer,
  Insert,
  Remove 
)
Value:
EZ_SET_CONTAINER_TYPE(OwnType, GetContainer)>(PropertyName, &OwnType::GetContainer, &OwnType::Insert, \
&OwnType::Remove))
Definition: MapProperty.h:120

Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that uses custom functions to for write access to a map. Use this if you have a ezHashTable or ezMap to expose directly and just want to be informed of write operations.

Parameters
PropertyNameThe unique (in this class) name under which the property should be registered.
GetContainerFunction signature: const Container<Key, Type>& GetValues() const;
InsertFunction signature: void Insert(const char* szKey, Type value);
RemoveFunction signature: void Remove(const char* szKey);
Note
Container can be ezMap or ezHashTable

◆ EZ_MEMBER_PROPERTY

#define EZ_MEMBER_PROPERTY (   PropertyName,
  MemberName 
)
Value:
[internal] An implementation of ezTypedMemberProperty that accesses the property data directly...
Definition: MemberProperty.h:156
[internal] Helper class to generate accessor functions for (private) members of another class ...
Definition: MemberProperty.h:144

Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that actually exists as a member.

Parameters
PropertyNameThe unique (in this class) name under which the property should be registered.
MemberNameThe name of the member variable that should get exposed as a property.
Note
Since the member is exposed directly, there is no way to know when the variable was modified. That also means no custom limits to the values can be applied. If that becomes necessary, just add getter / setter functions and expose the property as a EZ_ENUM_ACCESSOR_PROPERTY instead.

◆ EZ_MEMBER_PROPERTY_READ_ONLY

#define EZ_MEMBER_PROPERTY_READ_ONLY (   PropertyName,
  MemberName 
)
Value:
[internal] An implementation of ezTypedMemberProperty that accesses the property data directly...
Definition: MemberProperty.h:156
[internal] Helper class to generate accessor functions for (private) members of another class ...
Definition: MemberProperty.h:144

Same as EZ_MEMBER_PROPERTY, but the property is read-only.

◆ EZ_MESSAGE_HANDLER

#define EZ_MESSAGE_HANDLER (   MessageType,
  FunctionName 
)
Value:
new ezInternal::MessageHandler<EZ_IS_CONST_MESSAGE_HANDLER( \
OwnType, MessageType, &OwnType::FunctionName)>::Impl<OwnType, MessageType, &OwnType::FunctionName>()
Definition: MessageHandler.h:54

Within an EZ_BEGIN_MESSAGEHANDLERS / EZ_END_MESSAGEHANDLERS; block, this adds another message handler.

Parameters
MessageTypeThe type of message that this handler function accepts. You may add 'const' in front of it.
FunctionNameThe actual C++ name of the message handler function.
Note
A message handler is a function that takes one parameter of type ezMessage (or a derived type) and returns void.

◆ EZ_MESSAGE_SENDER

#define EZ_MESSAGE_SENDER (   MemberName)
Value:
{ \
#MemberName, ezGetStaticRTTI < EZ_MEMBER_TYPE(OwnType, MemberName)::MessageType > () \
}

Within an EZ_BEGIN_MESSAGESENDERS / EZ_END_MESSAGESENDERS block, this adds another message sender.

Parameters
MemberNameThe name of the member variable that should get exposed as a message sender.
Note
A message sender must be derived from ezMessageSenderBase.

◆ EZ_SET_ACCESSOR_PROPERTY

#define EZ_SET_ACCESSOR_PROPERTY (   PropertyName,
  GetValues,
  Insert,
  Remove 
)
Value:
EZ_SET_CONTAINER_TYPE(OwnType, GetValues)>(PropertyName, &OwnType::GetValues, &OwnType::Insert, \
&OwnType::Remove))
Definition: SetProperty.h:40

Within a EZ_BEGIN_PROPERTIES / EZ_END_PROPERTIES; block, this adds a property that uses custom functions to access a set.

Parameters
PropertyNameThe unique (in this class) name under which the property should be registered.
GetValuesFunction signature: Container<Type> GetValues() const;
InsertFunction signature: void Insert(Type value);
RemoveFunction signature: void Remove(Type value);
Note
Container<Type> can be any container that can be iterated via range based for loops.

◆ EZ_SET_ACCESSOR_PROPERTY_READ_ONLY

#define EZ_SET_ACCESSOR_PROPERTY_READ_ONLY (   PropertyName,
  GetValues 
)
Value:

Same as EZ_SET_ACCESSOR_PROPERTY, but no setter is provided, thus making the property read-only.

◆ EZ_SET_MEMBER_PROPERTY

◆ EZ_SET_MEMBER_PROPERTY_READ_ONLY

#define EZ_SET_MEMBER_PROPERTY_READ_ONLY (   PropertyName,
  MemberName 
)