summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qstringbuilder.cpp2
-rw-r--r--src/corelib/tools/qstringbuilder.h14
2 files changed, 15 insertions, 1 deletions
diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp
index 37b0e08caf2..73748e55a3b 100644
--- a/src/corelib/tools/qstringbuilder.cpp
+++ b/src/corelib/tools/qstringbuilder.cpp
@@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
For building QStrings:
\list
- \li QString, QStringRef,
+ \li QString, QStringRef, (since 5.10:) QStringView
\li QChar, QCharRef, QLatin1Char, (since 5.10:) \c char16_t,
\li QLatin1String,
\li (since 5.10:) \c{const char16_t[]} (\c{u"foo"}),
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index e9ca2245ba2..1d96d706379 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -289,6 +289,20 @@ template <> struct QConcatenable<QStringRef> : private QAbstractConcatenable
}
};
+template <> struct QConcatenable<QStringView> : private QAbstractConcatenable
+{
+ typedef QStringView type;
+ typedef QString ConvertTo;
+ enum { ExactSize = true };
+ static int size(QStringView a) { return a.length(); }
+ static inline void appendTo(QStringView a, QChar *&out)
+ {
+ const auto n = a.size();
+ memcpy(out, a.data(), sizeof(QChar) * n);
+ out += n;
+ }
+};
+
template <int N> struct QConcatenable<const char[N]> : private QAbstractConcatenable
{
typedef const char type[N];