From ac30cbdceac428fa206a939e5d820b2bd77227fc Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 8 Jun 2009 09:14:19 +0200 Subject: Make QCharRef known to QStringBuilder. --- src/corelib/tools/qstringbuilder.cpp | 4 ++-- src/corelib/tools/qstringbuilder.h | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp index 4f24f76..03d8160 100644 --- a/src/corelib/tools/qstringbuilder.cpp +++ b/src/corelib/tools/qstringbuilder.cpp @@ -111,7 +111,7 @@ The QStringBuilder class is not to be used explicitly in user code. Instances of the class are created as return values of the operator%() function, acting on objects of type \c QString, \c QLatin1String, - \c QLatin1Literal, \c \QStringRef, \c QChar, + \c QLatin1Literal, \c \QStringRef, \c QChar, \c QCharRef, \c QLatin1Char, and \c char. Concatenating strings with operator%() generally yields better @@ -130,6 +130,6 @@ This function is usable with arguments of type \c QString, \c QLatin1String, \c QLatin1Literal, \c QStringRef, - \c QChar, \c QLatin1Char, and \c char. + \c QChar, \c QCharRef, \c QLatin1Char, and \c char. */ diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index 7b16197..2c31476 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -122,6 +122,16 @@ template <> struct QConcatenable } }; +template <> struct QConcatenable +{ + typedef QCharRef type; + static int size(const QCharRef &) { return 1; } + static inline void appendTo(const QCharRef &c, QChar *&out) + { + *out++ = QChar(c); + } +}; + template <> struct QConcatenable { typedef QLatin1String type; @@ -173,8 +183,8 @@ template <> struct QConcatenable template struct QConcatenable { typedef char type[N]; - static int size(const char *) { return N - 1; } - static inline void appendTo(const char *a, QChar *&out) + static int size(const char[N]) { return N - 1; } + static inline void appendTo(const char a[N], QChar *&out) { for (int i = 0; i < N - 1; ++i) *out++ = QLatin1Char(a[i]); -- cgit v0.12