From 4bd81e0b822648c4663eeb58d0d08cb99bb80246 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 13 Aug 2014 21:23:11 +0200 Subject: Add missing QString::prepend(QStringRef)/(const QChar*,int) overloads MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jędrzej Nowacki --- src/corelib/tools/qstring.cpp | 16 ++++++++++++++++ src/corelib/tools/qstring.h | 2 ++ 2 files changed, 18 insertions(+) (limited to 'src') diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index d25b8e2082..14ed315710 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -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() diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 06eb902161..532b294c28 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -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) { -- cgit v1.2.3