qt6-bb10/tests/auto/corelib/text/qstring
Ivan Solovev e2e21bcb2d QString: use comparison helper macros - missing string views [3/3]
The comparison with QStringView works as is, there is no need to add
explicit operators.
Add the missing relational operators with QUtf8StringView. Once it
is added, comparison of QString with u8"string literal" becomes
ambiguous, so explicitly add operators for `const char8_t*` as well.
This also makes the comparison with u8 string literals faster,
because it now uses a view instead of constructing a QString.

Adding QUtf8StringView overloads also makes comparison with
`const char *` ambiguous if QT_RESTRICTED_CAST_FROM_ASCII is defined.
To fix that, mark the overload as Q_WEAK_OVERLOAD. Luckily, we can
just use the third Attributes parameter of the macro for that.

Provide more unit-tests to cover the new relational operators.

Task-number: QTBUG-117661
Change-Id: I60d1f4ad7ea607472deeb5c250e62f2bb7019268
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-03-02 00:12:53 +01:00
..
.gitignore Move text-related code out of corelib/tools/ to corelib/text/ 2019-07-10 17:05:30 +02:00
CMakeLists.txt QString: use comparison helper macros - trivial changes [1/3] 2024-03-02 00:12:53 +01:00
double_data.h Change license for tests files 2024-02-04 09:56:42 +01:00
tst_qstring.cpp QString: use comparison helper macros - missing string views [3/3] 2024-03-02 00:12:53 +01:00
tst_qstring_mac.mm Change license for tests files 2024-02-04 09:56:42 +01:00
tst_qstring_wasm.cpp Change license for tests files 2024-02-04 09:56:42 +01:00