diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-06-02 11:59:46 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-06-02 11:59:46 (GMT) |
commit | 6d28410756ab29277807d2026b4cbd8e1c707714 (patch) | |
tree | d2b71a74758625d76fb93eb6bb949546d9cbebbc /src/declarative/qml/qmlprivate.h | |
parent | 7c963ed70317191bb9f6eec5e8cc79fc985bf00b (diff) | |
download | Qt-6d28410756ab29277807d2026b4cbd8e1c707714.zip Qt-6d28410756ab29277807d2026b4cbd8e1c707714.tar.gz Qt-6d28410756ab29277807d2026b4cbd8e1c707714.tar.bz2 |
Compilation fix on MSVC
Reviewed-by: alexis
Diffstat (limited to 'src/declarative/qml/qmlprivate.h')
-rw-r--r-- | src/declarative/qml/qmlprivate.h | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/src/declarative/qml/qmlprivate.h b/src/declarative/qml/qmlprivate.h index 62524aa..3f41fb7 100644 --- a/src/declarative/qml/qmlprivate.h +++ b/src/declarative/qml/qmlprivate.h @@ -123,43 +123,13 @@ namespace QmlPrivate } }; - template <typename T> - class has_attachedPropertiesMember - { - typedef int yes_type; - typedef char no_type; - template <int> - struct Selector {}; - - template <typename S> - static yes_type test(Selector<sizeof(&S::qmlAttachedProperties)>*); - - template <typename S> - static no_type test(...); - - public: - static bool const value = sizeof(test<T>(0)) == sizeof(yes_type); - }; - - template <typename T, bool hasMember> - class has_attachedPropertiesMethod + template<typename T, typename Sign = T *(*)(QObject *)> + struct has_qmlAttachedProperties { - typedef int yes_type; - typedef char no_type; - - template<typename ReturnType> - static yes_type check(ReturnType *(*)(QObject *)); - static no_type check(...); - - public: - static bool const value = sizeof(check(&T::qmlAttachedProperties)) == sizeof(yes_type); - }; - - template <typename T> - class has_attachedPropertiesMethod<T, false> - { - public: - static bool const value = false; + template <typename U, U> struct type_check; + template <typename _1> static char check(type_check<Sign, &_1::qmlAttachedProperties> *); + template <typename > static int check(...); + static bool const value = sizeof(check<T>(0)) == sizeof(char); }; template<typename T, int N> @@ -191,13 +161,13 @@ namespace QmlPrivate template<typename T> inline QmlAttachedPropertiesFunc attachedPropertiesFunc() { - return AttachedPropertySelector<T, has_attachedPropertiesMethod<T, has_attachedPropertiesMember<T>::value>::value>::func(); + return AttachedPropertySelector<T, has_qmlAttachedProperties<T>::value >::func(); } template<typename T> inline const QMetaObject *attachedPropertiesMetaObject() { - return AttachedPropertySelector<T, has_attachedPropertiesMethod<T, has_attachedPropertiesMember<T>::value>::value>::metaObject(); + return AttachedPropertySelector<T, has_qmlAttachedProperties<T>::value >::metaObject(); } struct MetaTypeIds { |