diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-02-11 15:00:36 -0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-12 20:12:17 +0100 |
commit | 0b700fb6f92662adaf632c6e83c12a3751c3174b (patch) | |
tree | 83342dd59cf9741a03a505f7df0eee0ccb2ddec0 /src/corelib/global/qtypeinfo.h | |
parent | 2e965ca8b766389e93540eb95aa5dd9d258cae11 (diff) |
Use QtPrivate::is_integral instead of listing each integer type
This changes the code added by 0e4d94edd0caac9d2378a00a0aa961a0be3ad796
by removing the Q_INTEGRAL_TYPE enum value and instead relying on our
private copy of typetraits.
Change-Id: Icb6c814a36125de0d712421b97e11e8abc0f7416
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'src/corelib/global/qtypeinfo.h')
-rw-r--r-- | src/corelib/global/qtypeinfo.h | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index 114e11345a..8478e08416 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include <QtCore/qglobal.h> +#include <QtCore/qtypetraits.h> #ifndef QTYPEINFO_H #define QTYPEINFO_H @@ -60,7 +60,7 @@ class QTypeInfo public: enum { isPointer = false, - isIntegral = false, + isIntegral = QtPrivate::is_integral<T>::value, isComplex = true, isStatic = true, isLarge = (sizeof(T)>sizeof(void*)), @@ -173,8 +173,7 @@ enum { /* TYPEINFO flags */ Q_PRIMITIVE_TYPE = 0x1, Q_STATIC_TYPE = 0, Q_MOVABLE_TYPE = 0x2, - Q_DUMMY_TYPE = 0x4, - Q_INTEGRAL_TYPE = 0x8 + Q_DUMMY_TYPE = 0x4 }; #define Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS) \ @@ -186,7 +185,7 @@ public: \ isStatic = (((FLAGS) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), \ isLarge = (sizeof(TYPE)>sizeof(void*)), \ isPointer = false, \ - isIntegral = ((FLAGS) & Q_INTEGRAL_TYPE) != 0, \ + isIntegral = QtPrivate::is_integral< TYPE >::value, \ isDummy = (((FLAGS) & Q_DUMMY_TYPE) != 0), \ sizeOf = sizeof(TYPE) \ }; \ @@ -228,33 +227,32 @@ Q_DECLARE_SHARED_STL(TYPE) /* QTypeInfo primitive specializations */ -Q_DECLARE_TYPEINFO(bool, Q_PRIMITIVE_TYPE | Q_INTEGRAL_TYPE); -Q_DECLARE_TYPEINFO(char, Q_PRIMITIVE_TYPE | Q_INTEGRAL_TYPE); -Q_DECLARE_TYPEINFO(signed char, Q_PRIMITIVE_TYPE | Q_INTEGRAL_TYPE); -Q_DECLARE_TYPEINFO(uchar, Q_PRIMITIVE_TYPE | Q_INTEGRAL_TYPE); -Q_DECLARE_TYPEINFO(short, Q_PRIMITIVE_TYPE | Q_INTEGRAL_TYPE); -Q_DECLARE_TYPEINFO(ushort, Q_PRIMITIVE_TYPE | Q_INTEGRAL_TYPE); -Q_DECLARE_TYPEINFO(int, Q_PRIMITIVE_TYPE | Q_INTEGRAL_TYPE); -Q_DECLARE_TYPEINFO(uint, Q_PRIMITIVE_TYPE | Q_INTEGRAL_TYPE); -Q_DECLARE_TYPEINFO(long, Q_PRIMITIVE_TYPE | Q_INTEGRAL_TYPE); -Q_DECLARE_TYPEINFO(ulong, Q_PRIMITIVE_TYPE | Q_INTEGRAL_TYPE); -Q_DECLARE_TYPEINFO(qint64, Q_PRIMITIVE_TYPE | Q_INTEGRAL_TYPE); -Q_DECLARE_TYPEINFO(quint64, Q_PRIMITIVE_TYPE | Q_INTEGRAL_TYPE); +Q_DECLARE_TYPEINFO(bool, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(char, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(signed char, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(uchar, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(short, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(ushort, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(int, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(uint, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(long, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(ulong, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(qint64, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(quint64, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(float, Q_PRIMITIVE_TYPE); Q_DECLARE_TYPEINFO(double, Q_PRIMITIVE_TYPE); #ifndef Q_OS_DARWIN Q_DECLARE_TYPEINFO(long double, Q_PRIMITIVE_TYPE); #endif -#ifdef Q_COMPILER_UNICODE_STRINGS -// ### Qt6: define as Q_PRIMITIVE_TYPE + +#if QT_VERSION >= QT_VERSION_CHECK(6,0,0) // We can't do it now because it would break BC on QList<char32_t> -Q_DECLARE_TYPEINFO(char16_t, Q_INTEGRAL_TYPE); -Q_DECLARE_TYPEINFO(char32_t, Q_INTEGRAL_TYPE); -#endif -#if !defined(Q_CC_MSVC) || defined(_NATIVE_WCHAR_T_DEFINED) -// ### Qt6: same as above -Q_DECLARE_TYPEINFO(wchar_t, Q_INTEGRAL_TYPE); -#endif +Q_DECLARE_TYPEINFO(char16_t, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(char32_t, Q_PRIMITIVE_TYPE); +# if !defined(Q_CC_MSVC) || defined(_NATIVE_WCHAR_T_DEFINED) +Q_DECLARE_TYPEINFO(wchar_t, Q_PRIMITIVE_TYPE); +# endif +#endif // Qt 6 QT_END_NAMESPACE #endif // QTYPEINFO_H |