summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago@kde.org>2011-07-07 19:53:35 +0200
committerQt by Nokia <qt-info@nokia.com>2011-07-08 11:22:30 +0200
commita21f99292567418c620ccf2ffbb13946cac03b8d (patch)
tree284cd5299ecfc98ae6c9e47179485dff961faabc
parent571785b31d21715857228b00f96cd24601b28c8c (diff)
Add support for QStringLiterals in QStringBuilder
Otherwise we get errors for failing to have operator+ properly when writing: QStringLiteral("foo") + s Change-Id: I03844c95e9fdfa886eadfa2b5fe104ff048fd618 Reviewed-on: http://codereview.qt.nokia.com/1351 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
-rw-r--r--src/corelib/tools/qstringbuilder.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index c86a51f8e3..6d998b62aa 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -249,6 +249,23 @@ template <> struct QConcatenable<QString> : private QAbstractConcatenable
#endif
};
+template <int N> struct QConcatenable<QConstStringDataPtr<N> > : private QAbstractConcatenable
+{
+ typedef QConstStringDataPtr<N> type;
+ typedef QString ConvertTo;
+ enum { ExactSize = true };
+ static int size(const type &) { return N; }
+ static inline void appendTo(const type &a, QChar *&out)
+ {
+ memcpy(out, reinterpret_cast<const char*>(a.ptr->data), sizeof(QChar) * N);
+ out += N;
+ }
+#ifndef QT_NO_CAST_TO_ASCII
+ static inline QT_ASCII_CAST_WARN void appendTo(const type &a, char *&out)
+ { convertToAscii(a.ptr->data, N, out); }
+#endif
+};
+
template <> struct QConcatenable<QStringRef> : private QAbstractConcatenable
{
typedef QStringRef type;