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() << "' ."); \
return nullptr; \
} \ \
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; \
}
#define MYGUI_ASSERT(exp, dest)