diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2020-06-25 14:28:57 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2020-08-23 10:38:01 +0200 |
commit | 60dd5451a243253d9f810f9d3cddca4a152f82a7 (patch) | |
tree | 007a33cfaf43f73b378913a7f017fdaa6982f875 /tests/auto/corelib/text/qstringapisymmetry | |
parent | ba2b644213eabb1cdf3b0ca4df3c0d83c66287dd (diff) |
Port QLatin1String to qsizetype and add narrow-contract substring functions
QLatin1String::mid() etc were changed from narrow to wide contract,
but the narrow-contract replacements weren't added. This blocks using
the narrow-contract functions in QStringTokenizer.
As a drive-by, Q_REQUIRED_RESULT -> [[nodiscard]] and Q_DECL_CONSTEXPR
-> constexpr. Also centralize most Q_ASSERT()s in a single function,
verify(), in an attempt to reduce the amount of string data generated
from the asserts in assertive builds.
[ChangeLog][QtCore][QLatin1String] Added from(), sliced(), first(n),
last(n) functions.
[ChangeLog][QtCore][QLatin1String] size_type/size() is now qsizetype
(was: int). This makes QLatin1String(ptr, 0) ambiguous now between the
(ptr, ptr) and (ptr, qsizetype) constructors.
Change-Id: Ie195f66ae1974eb0752c058aa9f3b0853ed92477
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/text/qstringapisymmetry')
-rw-r--r-- | tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp index 9e1c9012ad..17d209ce69 100644 --- a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp +++ b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -536,6 +536,8 @@ private Q_SLOTS: void sliced_QString() { sliced_impl<QString>(); } void sliced_QStringView_data() { sliced_data(); } void sliced_QStringView() { sliced_impl<QStringView>(); } + void sliced_QLatin1String_data() { sliced_data(); } + void sliced_QLatin1String() { sliced_impl<QLatin1String>(); } void sliced_QByteArray_data() { sliced_data(); } void sliced_QByteArray() { sliced_impl<QByteArray>(); } @@ -543,6 +545,8 @@ private Q_SLOTS: void first_truncate_QString() { first_impl<QString>(); } void first_truncate_QStringView_data() { first_data(); } void first_truncate_QStringView() { first_impl<QStringView>(); } + void first_truncate_QLatin1String_data() { first_data(); } + void first_truncate_QLatin1String() { first_impl<QLatin1String>(); } void first_truncate_QByteArray_data() { first_data(); } void first_truncate_QByteArray() { first_impl<QByteArray>(); } @@ -550,6 +554,8 @@ private Q_SLOTS: void last_QString() { last_impl<QString>(); } void last_QStringView_data() { last_data(); } void last_QStringView() { last_impl<QStringView>(); } + void last_QLatin1String_data() { last_data(); } + void last_QLatin1String() { last_impl<QLatin1String>(); } void last_QByteArray_data() { last_data(); } void last_QByteArray() { last_impl<QByteArray>(); } |