diff --git a/src/corelib/kernel/qmetatypeswitcher_p.h b/src/corelib/kernel/qmetatypeswitcher_p.h index 05db2cb4c7..e9c15ea214 100644 --- a/src/corelib/kernel/qmetatypeswitcher_p.h +++ b/src/corelib/kernel/qmetatypeswitcher_p.h @@ -59,46 +59,27 @@ QT_BEGIN_NAMESPACE class QMetaTypeSwitcher { public: - - typedef void *NotBuiltinType; + class NotBuiltinType; template static ReturnType switcher(DelegateObject &logic, int type, const void *data); }; -#define QT_METATYPE_SWICHER_CASE_PRIMITIVE(TypeName, TypeId, Name)\ - case QMetaType::TypeName: return logic.delegate(static_cast(data)); - -#define QT_METATYPE_SWICHER_CASE_PRIMITIVE_POINTER(TypeName, TypeId, Name)\ - case QMetaType::TypeName: return logic.delegate(static_cast< Name * const *>(data)); - -#define QT_METATYPE_SWICHER_CASE_POINTER(TypeName, TypeId, Name)\ - case QMetaType::TypeName: return logic.delegate(static_cast< QT_PREPEND_NAMESPACE(Name) * const *>(data)); - -#define QT_METATYPE_SWICHER_CASE_QCLASS(TypeName, TypeId, Name)\ - case QMetaType::TypeName: return logic.delegate(static_cast(data)); +#define QT_METATYPE_SWICHER_CASE(TypeName, TypeId, Name)\ + case QMetaType::TypeName: return logic.delegate(static_cast(data)); template ReturnType QMetaTypeSwitcher::switcher(DelegateObject &logic, int type, const void *data) { switch (QMetaType::Type(type)) { - QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(QT_METATYPE_SWICHER_CASE_PRIMITIVE) - QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(QT_METATYPE_SWICHER_CASE_PRIMITIVE_POINTER) - QT_FOR_EACH_STATIC_CORE_POINTER(QT_METATYPE_SWICHER_CASE_POINTER) - QT_FOR_EACH_STATIC_CORE_CLASS(QT_METATYPE_SWICHER_CASE_QCLASS) - QT_FOR_EACH_STATIC_CORE_TEMPLATE(QT_METATYPE_SWICHER_CASE_QCLASS) - QT_FOR_EACH_STATIC_GUI_CLASS(QT_METATYPE_SWICHER_CASE_QCLASS) - QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_METATYPE_SWICHER_CASE_QCLASS) + QT_FOR_EACH_STATIC_TYPE(QT_METATYPE_SWICHER_CASE) default: - return logic.delegate(static_cast(data)); + return logic.delegate(static_cast(data)); } } -#undef QT_METATYPE_SWICHER_CASE_PRIMITIVE -#undef QT_METATYPE_SWICHER_CASE_PRIMITIVE_POINTER -#undef QT_METATYPE_SWICHER_CASE_QCLASS -#undef QT_METATYPE_SWICHER_CASE_POINTER +#undef QT_METATYPE_SWICHER_CASE QT_END_NAMESPACE diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h index 708a427860..a754bc4363 100644 --- a/src/corelib/kernel/qvariant_p.h +++ b/src/corelib/kernel/qvariant_p.h @@ -188,7 +188,7 @@ public: } bool delegate(const void*) { return true; } - + bool delegate(const QMetaTypeSwitcher::NotBuiltinType*) { return false; } protected: const QVariant::Private *m_a; const QVariant::Private *m_b; @@ -282,6 +282,7 @@ public: } // we need that as sizof(void) is undefined and it is needed in HasIsNullMethod bool delegate(const void *) { return m_d->is_null; } + bool delegate(const QMetaTypeSwitcher::NotBuiltinType *) { return m_d->is_null; } protected: const QVariant::Private *m_d; };