summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-10-15 14:47:18 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-10-16 12:17:36 +0000
commitdde8d5e3a006c87b7a3f18733ba255d6354fcd37 (patch)
tree3e4d84c4f8664e98ab244a975f1bd1321dfd10d8 /src
parente9835a3812f91fc4a948a606fd751382d4ecf248 (diff)
QTextStream: add missing op<<(QStringRef)
It simply is missing. We could wait for QStringView to come around, but I need this function in uic _now_, so let's add it. [ChangeLog][QtCore][QTextStream] Can now stream QStringRef without converting to a QString first. Change-Id: Idd178e0ba8a89c025f4533d46de912cbdb3883d5 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qtextstream.cpp15
-rw-r--r--src/corelib/io/qtextstream.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 5d82453270..64222c2212 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -2520,6 +2520,21 @@ QTextStream &QTextStream::operator<<(QLatin1String string)
}
/*!
+ \since 5.6
+ \overload
+
+ Writes \a string to the stream, and returns a reference to the
+ QTextStream.
+*/
+QTextStream &QTextStream::operator<<(const QStringRef &string)
+{
+ Q_D(QTextStream);
+ CHECK_VALID_STREAM(*this);
+ d->putString(string.data(), string.size());
+ return *this;
+}
+
+/*!
\overload
Writes \a array to the stream. The contents of \a array are
diff --git a/src/corelib/io/qtextstream.h b/src/corelib/io/qtextstream.h
index eb33db63d7..d7566e6f7b 100644
--- a/src/corelib/io/qtextstream.h
+++ b/src/corelib/io/qtextstream.h
@@ -179,6 +179,7 @@ public:
QTextStream &operator<<(double f);
QTextStream &operator<<(const QString &s);
QTextStream &operator<<(QLatin1String s);
+ QTextStream &operator<<(const QStringRef &s);
QTextStream &operator<<(const QByteArray &array);
QTextStream &operator<<(const char *c);
QTextStream &operator<<(const void *ptr);