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); \
55 MyGUI::detail::throwBadCast(this->getTypeName(), Type::getClassTypeName(), __FILE__, __LINE__); \
61 template<typename Type> \
62 const Type* castType(bool _throw = true) const \
64 if (this->isType<Type>()) \
65 return static_cast<const Type*>(this); \
67 MyGUI::detail::throwBadCast(this->getTypeName(), Type::getClassTypeName(), __FILE__, __LINE__); \
71#define MYGUI_RTTI_DERIVED(DerivedType) \
73 MYGUI_DECLARE_TYPE_NAME(DerivedType, override) \
74 typedef RTTIBase Base; \
75 typedef DerivedType RTTIBase; \
77 bool isType(const std::type_info& _type) const override \
79 return typeid(DerivedType) == _type || Base::isType(_type); \
82 template<typename Type> \
85 return isType(typeid(Type)); \