diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-02-20 09:36:34 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-02-23 05:44:47 +0000 |
commit | 3ac8b8c6961bb5b2ae82bbaee154282c54bd0b90 (patch) | |
tree | 3026ebc0e9d6292bd94e137a24ddf6f390cc6394 /src/corelib | |
parent | 9fbe3a926223813094003fcb99abf5f2bc0da727 (diff) |
QTypeInfo: record whether it was specialized
This is one of the pillars of my static container checking toolbox,
one of the main checks being that every type put into a Qt container
has been marked up with Q_DECLARE_TYPEINFO.
Obviously, we cannot upstream such a checker and inflict it upon the
world, but we can put some foundations in. This is the most central
one.
Change-Id: I9185facb2f37ba9fcc12c9aae5675eed454d755c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qtypeinfo.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index cbba253a75..7031021e16 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -58,6 +58,7 @@ class QTypeInfo { public: enum { + isSpecialized = std::is_enum<T>::value, // don't require every enum to be marked manually isPointer = false, isIntegral = std::is_integral<T>::value, isComplex = !isIntegral && !std::is_enum<T>::value, @@ -74,6 +75,7 @@ class QTypeInfo<void> { public: enum { + isSpecialized = true, isPointer = false, isIntegral = false, isComplex = false, @@ -90,6 +92,7 @@ class QTypeInfo<T*> { public: enum { + isSpecialized = true, isPointer = true, isIntegral = false, isComplex = false, @@ -152,6 +155,7 @@ class QTypeInfoMerger { public: enum { + isSpecialized = true, isComplex = QTypeInfoQuery<T1>::isComplex || QTypeInfoQuery<T2>::isComplex || QTypeInfoQuery<T3>::isComplex || QTypeInfoQuery<T4>::isComplex, isStatic = QTypeInfoQuery<T1>::isStatic || QTypeInfoQuery<T2>::isStatic @@ -173,6 +177,7 @@ class QTypeInfo< CONTAINER<T> > \ { \ public: \ enum { \ + isSpecialized = true, \ isPointer = false, \ isIntegral = false, \ isComplex = true, \ @@ -201,6 +206,7 @@ class QTypeInfo< CONTAINER<K, V> > \ { \ public: \ enum { \ + isSpecialized = true, \ isPointer = false, \ isIntegral = false, \ isComplex = true, \ @@ -241,6 +247,7 @@ class QTypeInfo<TYPE > \ { \ public: \ enum { \ + isSpecialized = true, \ isComplex = (((FLAGS) & Q_PRIMITIVE_TYPE) == 0), \ isStatic = (((FLAGS) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), \ isRelocatable = !isStatic || ((FLAGS) & Q_RELOCATABLE_TYPE), \ |