QString: overload prepend with QUtf8StringView

Add the missing overload.

[ChangeLog][QtCore][QString] Added prepend(QUtf8StringView)
overload.

Task-number: QTBUG-103302
Change-Id: I3f74e884e514ebc0b15a13b074584d8272a02f41
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Mate Barany 2022-11-17 13:51:33 +01:00
parent f046589e14
commit f192ddad8b
3 changed files with 11 additions and 1 deletions

View File

@ -3254,7 +3254,14 @@ QString &QString::append(QChar ch)
\overload prepend()
Prepends the Latin-1 string \a str to this string.
Prepends the Latin-1 string view \a str to this string.
*/
/*! \fn QString &QString::prepend(QUtf8StringView str)
\since 6.5
\overload prepend()
Prepends the UTF-8 string view \a str to this string.
*/
/*! \fn QString &QString::prepend(const QChar *str, qsizetype len)

View File

@ -701,6 +701,7 @@ public:
inline QString &prepend(const QString &s) { return insert(0, s); }
inline QString &prepend(QStringView v) { return prepend(v.data(), v.size()); }
inline QString &prepend(QLatin1StringView s) { return insert(0, s); }
QString &prepend(QUtf8StringView s) { return insert(0, s); }
inline QString &operator+=(QChar c) { return append(c); }

View File

@ -399,6 +399,8 @@ private slots:
void prepend_qstringview_data() { prepend_data(EmptyIsNoop); }
void prepend_qlatin1string() { prepend_impl<QLatin1String, QString &(QString::*)(QLatin1String)>(); }
void prepend_qlatin1string_data() { prepend_data({EmptyIsNoop, Latin1Encoded}); }
void prepend_qutf8stringview() { prepend_impl<QUtf8StringView, QString &(QString::*)(QUtf8StringView)>(); }
void prepend_qutf8stringview_data() { prepend_data(EmptyIsNoop); }
void prepend_qcharstar_int() { prepend_impl<QPair<const QChar *, int>, QString &(QString::*)(const QChar *, qsizetype)>(); }
void prepend_qcharstar_int_data() { prepend_data(EmptyIsNoop); }
void prepend_qchar() { prepend_impl<Reversed<QChar>, QString &(QString::*)(QChar)>(); }