summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorHarald Fernengel <harald.fernengel@nokia.com>2009-07-03 07:41:00 (GMT)
committerHarald Fernengel <harald.fernengel@nokia.com>2009-07-03 07:41:00 (GMT)
commit17f814ce07a4d82563012a15a46dfe6acb2edcc5 (patch)
treea2e95dab0da65331d82caa5729f836a6df7c790d /src/corelib
parent5c11a5a38bcc68c17da8fe59e8db03d43ea55ac1 (diff)
downloadQt-17f814ce07a4d82563012a15a46dfe6acb2edcc5.zip
Qt-17f814ce07a4d82563012a15a46dfe6acb2edcc5.tar.gz
Qt-17f814ce07a4d82563012a15a46dfe6acb2edcc5.tar.bz2
Add a specialization for QByteArray
It tries to keep the semantics of QString::append(QByteArray) as much as possible.
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/tools/qstringbuilder.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index 4d6b64b..127c183 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -202,6 +202,18 @@ template <> struct QConcatenable<const char *>
*out++ = QLatin1Char(*a++);
}
};
+
+template <> struct QConcatenable<QByteArray>
+{
+ typedef QByteArray type;
+ static int size(const QByteArray &ba) { qstrnlen(ba.constData(), ba.size()); }
+ static inline void appendTo(const QByteArray &ba, QChar *&out)
+ {
+ const char *data = ba.constData();
+ while (*data)
+ *out++ = *data++;
+ }
+};
#endif
template <typename A, typename B>