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>
This commit is contained in:
Thiago Macieira 2011-07-07 19:53:35 +02:00 committed by Qt by Nokia
parent 571785b31d
commit a21f992925

View File

@ -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;