summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-08-13 21:23:11 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-04-02 19:30:05 +0000
commit4bd81e0b822648c4663eeb58d0d08cb99bb80246 (patch)
tree3a7741fd1b0e9d9aea3dbead08ef981b18dc0b6d /src
parent2a15c83c90f85971b98af14c6d36e5982a56152b (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qstring.cpp16
-rw-r--r--src/corelib/tools/qstring.h2
2 files changed, 18 insertions, 0 deletions
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) {