diff options
author | hjk <qtc-committer@nokia.com> | 2009-06-08 07:14:19 (GMT) |
---|---|---|
committer | hjk <qtc-committer@nokia.com> | 2009-06-08 07:18:09 (GMT) |
commit | ac30cbdceac428fa206a939e5d820b2bd77227fc (patch) | |
tree | 8f826e81815746b21d95f82d95eb8f2a79639850 /src/corelib/tools | |
parent | d3bda146c4076dce3e260b4ef47f6bbc2d191b25 (diff) | |
download | Qt-ac30cbdceac428fa206a939e5d820b2bd77227fc.zip Qt-ac30cbdceac428fa206a939e5d820b2bd77227fc.tar.gz Qt-ac30cbdceac428fa206a939e5d820b2bd77227fc.tar.bz2 |
Make QCharRef known to QStringBuilder.
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qstringbuilder.cpp | 4 | ||||
-rw-r--r-- | 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<QChar> } }; +template <> struct QConcatenable<QCharRef> +{ + 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<QLatin1String> { typedef QLatin1String type; @@ -173,8 +183,8 @@ template <> struct QConcatenable<QStringRef> template <int N> struct QConcatenable<char[N]> { 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]); |