Go to the documentation of this file.
19#define MYGUI_DECLARE_TYPE_NAME(Type, Override) \
21 static std::string_view getClassTypeName() \
26 virtual std::string_view getTypeName() const Override \
28 return getClassTypeName(); \
31#define MYGUI_RTTI_BASE(BaseType) \
33 typedef BaseType RTTIBase; \
34 MYGUI_DECLARE_TYPE_NAME(BaseType, ) \
36 virtual bool isType(const std::type_info& _type) const \
38 return typeid(BaseType) == _type; \
41 template<typename Type> \
44 return isType(typeid(Type)); \
49 template<typename Type> \
50 Type* castType(bool _throw = true) \
52 if (this->isType<Type>()) \
53 return static_cast<Type*>(this); \
56 "Error cast type '" << this->getTypeName() << "' to type '" << Type::getClassTypeName() << "' ."); \
62 template<typename Type> \
63 const Type* castType(bool _throw = true) const \
65 if (this->isType<Type>()) \
66 return static_cast<Type*>(this); \
69 "Error cast type '" << this->getTypeName() << "' to type '" << Type::getClassTypeName() << "' ."); \
73#define MYGUI_RTTI_DERIVED(DerivedType) \
75 MYGUI_DECLARE_TYPE_NAME(DerivedType, override) \
76 typedef RTTIBase Base; \
77 typedef DerivedType RTTIBase; \
79 virtual bool isType(const std::type_info& _type) const override \
81 return typeid(DerivedType) == _type || Base::isType(_type); \
84 template<typename Type> \
87 return isType(typeid(Type)); \