QString: overload the += operator to handle QUtf8StringView

The += operator is already overloaded to handle QStringView and
QLatin1String - add the missing QUtf8StringView overload.

[ChangeLog][QtCore][QString] Added operator+=(QUtf8StringView)
overload.

Task-number: QTBUG-103302
Change-Id: Iec6940bad7866310c826a130b98accebc3c82aa8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
bb10
Mate Barany 2022-11-14 16:02:05 +01:00
parent d2e1d73bf1
commit 2ffdb3bcdd
3 changed files with 11 additions and 1 deletions

View File

@ -6195,7 +6195,14 @@ QString& QString::fill(QChar ch, qsizetype size)
\overload operator+=()
Appends the Latin-1 string \a str to this string.
Appends the Latin-1 string view \a str to this string.
*/
/*! \fn QString &QString::operator+=(QUtf8StringView str)
\since 6.5
\overload operator+=()
Appends the UTF-8 string view \a str to this string.
*/
/*! \fn QString &QString::operator+=(const QByteArray &ba)

View File

@ -706,6 +706,7 @@ public:
inline QString &operator+=(const QString &s) { return append(s); }
inline QString &operator+=(QStringView v) { return append(v); }
inline QString &operator+=(QLatin1StringView s) { return append(s); }
QString &operator+=(QUtf8StringView s) { return append(s); }
QString &remove(qsizetype i, qsizetype len);
QString &remove(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive);

View File

@ -440,6 +440,8 @@ private slots:
void operator_pluseq_qstringview_data() { operator_pluseq_data(EmptyIsNoop); }
void operator_pluseq_qlatin1string() { operator_pluseq_impl<QLatin1String, QString &(QString::*)(QLatin1String)>(); }
void operator_pluseq_qlatin1string_data() { operator_pluseq_data(Latin1Encoded); }
void operator_pluseq_qutf8stringview() { operator_pluseq_impl<QUtf8StringView, QString &(QString::*)(QUtf8StringView)>(); }
void operator_pluseq_qutf8stringview_data() { operator_pluseq_data(); }
void operator_pluseq_qchar() { operator_pluseq_impl<QChar, QString &(QString::*)(QChar)>(); }
void operator_pluseq_qchar_data() { operator_pluseq_data(EmptyIsNoop); }
void operator_pluseq_qbytearray() { operator_pluseq_impl<QByteArray>(); }