#include "MyGUI_Prerequest.h"
#include "MyGUI_Diagnostic.h"
#include <typeinfo>
#include <string>
Go to the source code of this file.
Namespaces |
namespace | MyGUI |
Detailed Description
- Author
- Alexander Buryak - Rageous
-
Albert Semenov
- Date
- 09/2008
Definition in file MyGUI_RTTI.h.
Macro Definition Documentation
#define MYGUI_DECLARE_TYPE_NAME |
( |
|
Type | ) |
|
Value:public: \
static const std::string& getClassTypeName() { static std::string type = #Type; return type; } \ \
virtual const std::string& getTypeName() const { return Type::getClassTypeName(); }
Definition at line 45 of file MyGUI_RTTI.h.
#define MYGUI_RTTI_BASE |
( |
|
BaseType | ) |
|
Value:public: \
typedef BaseType RTTIBase; \
MYGUI_DECLARE_TYPE_NAME( BaseType ) \ \
virtual bool isType( const std::type_info& _type) const { return typeid( BaseType ) == _type; } \ \
template<typename Type> bool isType() const { return isType( typeid( Type )); } \ \
template<typename Type> Type* castType(bool _throw = true) \
{ \
if (this->isType<Type>()) return static_cast<Type*>( this ); \
MYGUI_ASSERT(!_throw, "Error cast type '" << this->getTypeName() << "' to type '" << Type::getClassTypeName() << "' .") \
} \ \
template<typename Type> const Type* castType(bool _throw = true) const \
{ \
if (this->isType<Type>()) return static_cast<Type*>( this ); \
MYGUI_ASSERT(!_throw, "Error cast type '" << this->getTypeName() << "' to type '" << Type::getClassTypeName() << "' .") \
return nullptr; \
}
Definition at line 52 of file MyGUI_RTTI.h.
#define MYGUI_RTTI_CHILD_HEADER |
( |
|
DerivedType, |
|
|
|
BaseType |
|
) |
| |
Value:public: \
MYGUI_DECLARE_TYPE_NAME( DerivedType ) \
typedef BaseType Base; \
typedef DerivedType RTTIBase; \ \
virtual bool isType( const std::type_info& _type ) const { return typeid( DerivedType ) == _type || BaseType::isType( _type ); }
Definition at line 86 of file MyGUI_RTTI.h.
#define MYGUI_RTTI_DERIVED |
( |
|
DerivedType | ) |
|
Value:public: \
MYGUI_DECLARE_TYPE_NAME( DerivedType ) \
typedef RTTIBase Base; \
typedef DerivedType RTTIBase; \ \
virtual bool isType( const std::type_info& _type ) const { return typeid( DerivedType ) == _type || Base::isType( _type ); } \ \
template<typename Type> bool isType() const { return isType( typeid( DerivedType )); }
Definition at line 75 of file MyGUI_RTTI.h.