diff options
author | Jędrzej Nowacki <jedrzej.nowacki@nokia.com> | 2012-01-24 15:42:01 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-29 15:21:16 +0100 |
commit | d874c059d36fe125c577dde9e980407fbd43beac (patch) | |
tree | 7fb31ae961414459ccb3a7364a9234ad8d45c7d5 /src/corelib/global | |
parent | b08b254a798d2f4935ec770662c84d86bdfea97c (diff) |
Introduce QTypeInfo::sizeOf.
In QMetaType "void" is a regular type, lack of c++ sizeof operator
force us to write a template specialization for the type.
Change-Id: I9a56e135223b416b8031836d29ef33ef3fb750e4
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qglobal.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 43632cb41c..b38583c771 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2020,7 +2020,8 @@ public: isComplex = true, isStatic = true, isLarge = (sizeof(T)>sizeof(void*)), - isDummy = false + isDummy = false, + sizeOf = sizeof(T) }; }; @@ -2033,7 +2034,8 @@ public: isComplex = false, isStatic = false, isLarge = false, - isDummy = false + isDummy = false, + sizeOf = 0 }; }; @@ -2046,7 +2048,8 @@ public: isComplex = false, isStatic = false, isLarge = false, - isDummy = false + isDummy = false, + sizeOf = sizeof(T*) }; }; @@ -2062,7 +2065,8 @@ public: \ isComplex = true, \ isStatic = false, \ isLarge = (sizeof(CONTAINER<T>) > sizeof(void*)), \ - isDummy = false \ + isDummy = false, \ + sizeOf = sizeof(CONTAINER<T>) \ }; \ }; @@ -2100,7 +2104,8 @@ public: \ isStatic = (((FLAGS) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), \ isLarge = (sizeof(TYPE)>sizeof(void*)), \ isPointer = false, \ - isDummy = (((FLAGS) & Q_DUMMY_TYPE) != 0) \ + isDummy = (((FLAGS) & Q_DUMMY_TYPE) != 0), \ + sizeOf = sizeof(TYPE) \ }; \ static inline const char *name() { return #TYPE; } \ } |