Define QTypeInfo for char16_t, char32_t and wchar_t in Qt 5

Commits 0b700fb6f9 and
0e4d94edd0 defined QTypeInfo for those
three only for Qt 6 (and forced C++11 support). Define them in Qt 5,
keeping compatibility with QList storage. That is, these types are
defined to be primitive and static at the same time, for the benefit of
QList.

Change-Id: I9cac3a70af156971022c1e6084cb5538c050f826
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
bb10
Thiago Macieira 2014-11-17 21:01:53 -08:00
parent 45fe3f1cde
commit 746fbbe039
1 changed files with 13 additions and 1 deletions

View File

@ -276,13 +276,25 @@ Q_DECLARE_TYPEINFO(double, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(long double, Q_PRIMITIVE_TYPE);
#endif
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
// We can't do it now because it would break BC on QList<char32_t>
// ### Qt 6: remove the other branch
// This was required so that QList<T> for these types allocates out of the array storage
# ifdef Q_COMPILER_UNICODE_STRINGS
Q_DECLARE_TYPEINFO(char16_t, Q_PRIMITIVE_TYPE);
Q_DECLARE_TYPEINFO(char32_t, Q_PRIMITIVE_TYPE);
# endif
# if !defined(Q_CC_MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
Q_DECLARE_TYPEINFO(wchar_t, Q_PRIMITIVE_TYPE);
# endif
#else
# ifdef Q_COMPILER_UNICODE_STRINGS
Q_DECLARE_TYPEINFO(char16_t, Q_RELOCATABLE_TYPE);
Q_DECLARE_TYPEINFO(char32_t, Q_RELOCATABLE_TYPE);
# endif
# if !defined(Q_CC_MSVC) || defined(_NATIVE_WCHAR_T_DEFINED)
Q_DECLARE_TYPEINFO(wchar_t, Q_RELOCATABLE_TYPE);
# endif
#endif // Qt 6
QT_END_NAMESPACE