Add missing QString::prepend(QStringRef)/(const QChar*,int) overloads

QString::append(QStringRef) exists, and so should prepend().
QString::append(const QChar *,int) exists, and so should prepend().

[ChangeLog][QtCore][QString] Added prepend(QStringRef) and prepent(const QChar *, int) overloads.

Change-Id: I3eca41045f7c481be473507e23e92690f3ed7ba3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
This commit is contained in:
Marc Mutz 2014-08-13 21:23:11 +02:00
parent 2a15c83c90
commit 4bd81e0b82
3 changed files with 22 additions and 0 deletions

View File

@ -2072,6 +2072,22 @@ QString &QString::append(QChar ch)
Prepends the Latin-1 string \a str to this string.
*/
/*! \fn QString &QString::prepend(const QChar *str, int len)
\since 5.5
\overload prepend()
Prepends \a len characters from the QChar array \a str to this string and
returns a reference to this string.
*/
/*! \fn QString &QString::prepend(const QStringRef &str)
\since 5.5
\overload prepend()
Prepends the string reference \a str to the beginning of this string and
returns a reference to this string.
*/
/*! \fn QString &QString::prepend(const QByteArray &ba)
\overload prepend()

View File

@ -428,7 +428,9 @@ public:
QString &append(const QStringRef &s);
QString &append(QLatin1String s);
inline QString &prepend(QChar c) { return insert(0, c); }
inline QString &prepend(const QChar *uc, int len) { return insert(0, uc, len); }
inline QString &prepend(const QString &s) { return insert(0, s); }
inline QString &prepend(const QStringRef &s) { return insert(0, s); }
inline QString &prepend(QLatin1String s) { return insert(0, s); }
inline QString &operator+=(QChar c) {

View File

@ -375,8 +375,12 @@ private slots:
void prepend_qstring() { prepend_impl<QString>(); }
void prepend_qstring_data() { prepend_data(true); }
void prepend_qstringref() { prepend_impl<QStringRef>(); }
void prepend_qstringref_data() { prepend_data(true); }
void prepend_qlatin1string() { prepend_impl<QLatin1String, QString &(QString::*)(QLatin1String)>(); }
void prepend_qlatin1string_data() { prepend_data(true); }
void prepend_qcharstar_int() { prepend_impl<QPair<const QChar *, int>, QString &(QString::*)(const QChar *, int)>(); }
void prepend_qcharstar_int_data() { prepend_data(true); }
void prepend_qchar() { prepend_impl<Reversed<QChar>, QString &(QString::*)(QChar)>(); }
void prepend_qchar_data() { prepend_data(true); }
void prepend_qbytearray() { prepend_impl<QByteArray>(); }