qt5base-lts/tests/auto/corelib/text
Marc Mutz 2c9529e158 Long live Q{Any,Utf8}StringView!
We need to add these two classes at the same time, because
QAnyStringView makes all QUtf8StringView relational operators moot. We
might want to add some later, esp. for UTF-8/UTf-8 comparisons, to
avoid the pessimization that we can't early-out on size() mismatch in
QAnyStringView equality operators, but that's an optimization, not a
correctness issue, and can be fixed in a source-compatible way even
after Qt 6 is released.

To deal with the char8_t problem in C++20, make QUtf8StringView a
class template out of which two UTF-8 views can be instantiated: the
Qt 7 version, which depends on C++20 char8_t as value_type, and the Qt
6 version where value_type is a char. Use inline namespaces to map the
QUtf8StringView identifier to one or the other, depending on the C++
version used to compile the user code. The inline namespace names must
needs be a bit ugly, as their inline'ness depends on __cpp_char8_t. If
we simply used q_v1/q_v2 we'd be blocking these names for Qt inline
namespaces forever, because it's likely that inline'ness of other
users of inline namespaces in Qt depends on things other than
__cpp_char8_t. While inline'ness of namespaces is, theoretically
speaking, a compile-time-only property, at least Clang warns about
mixed use of inline on a given namespace, so we need to bite the
bullet here. This is also the reason for the QT_BEGIN_..._NAMESPACE
macros: GCC is ok with the first declaration making a namespace
inline, while Clang warns upon re-opening an inline namespace as a
non-inline one.

[ChangeLog][QtCore][QUtf8StringView] New class.

[ChangeLog][QtCore][QAnyStringView] New class.

Change-Id: Ia7179760fca0e0b67d52f5accb0a62e389b17913
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-08-31 22:57:49 +02:00
..
qbytearray Change QByteArray to handle large arrays 2020-08-27 18:58:20 +02:00
qbytearrayapisymmetry Fix QByteArray::count implementation for longer data 2020-07-09 18:38:33 +02:00
qbytearraylist CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qbytearraymatcher Replace Qt CONSTEXPR defines with constexpr 2020-08-14 15:52:58 +02:00
qbytearrayview Introduce QByteArrayView 2020-07-08 08:45:49 +02:00
qbytedatabuffer QByteDataBuffer: add readPointer functionality using QByteArrayView 2020-08-24 17:44:08 +02:00
qchar QChar: purge deprecated API 2020-07-20 16:06:28 +02:00
qcollator tst_QCollator: avoid an unused variable warning 2020-07-13 12:03:21 +02:00
qlatin1string Port QLatin1String to qsizetype and add narrow-contract substring functions 2020-08-23 10:38:01 +02:00
qlocale Move QStringRef and remains to Qt5Compat 2020-08-20 00:58:13 +02:00
qregularexpression Use qsizetype in QRegularExpression 2020-08-28 02:22:10 +02:00
qstring Use checked string iteration in case conversions 2020-08-29 18:15:27 +02:00
qstring_no_cast_from_bytearray CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qstringapisymmetry Long live Q{Any,Utf8}StringView! 2020-08-31 22:57:49 +02:00
qstringbuilder Move QStringRef and remains to Qt5Compat 2020-08-20 00:58:13 +02:00
qstringconverter tst_QStringConverter: fix some deprecation warnings 2020-08-07 17:44:01 +02:00
qstringiterator CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qstringlist CMake: Regenerate tests with new qt_ prefixed APIs 2020-07-09 09:38:35 +02:00
qstringmatcher Move QStringRef and remains to Qt5Compat 2020-08-20 00:58:13 +02:00
qstringtokenizer Use QList instead of QVector in corelib tests 2020-07-07 11:48:45 +02:00
qstringview Move QStringRef and remains to Qt5Compat 2020-08-20 00:58:13 +02:00
qtextboundaryfinder Remove QTextCodec dependency from test 2020-05-14 07:50:49 +02:00
.prev_CMakeLists.txt Move QStringRef and remains to Qt5Compat 2020-08-20 00:58:13 +02:00
CMakeLists.txt Move QStringRef and remains to Qt5Compat 2020-08-20 00:58:13 +02:00
text.pro Move QStringRef and remains to Qt5Compat 2020-08-20 00:58:13 +02:00