Allow QChar::SpecialCharacter with QStringBuilder.
Change-Id: I3c91fd516bb13e5534aa6f26ee9df745c990dfb5 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
612152fad8
commit
e1cc0d6bbc
@ -167,6 +167,16 @@ template <> struct QConcatenable<QChar> : private QAbstractConcatenable
|
||||
{ *out++ = c; }
|
||||
};
|
||||
|
||||
template <> struct QConcatenable<QChar::SpecialCharacter> : private QAbstractConcatenable
|
||||
{
|
||||
typedef QChar::SpecialCharacter type;
|
||||
typedef QString ConvertTo;
|
||||
enum { ExactSize = true };
|
||||
static int size(const QChar::SpecialCharacter) { return 1; }
|
||||
static inline void appendTo(const QChar::SpecialCharacter c, QChar *&out)
|
||||
{ *out++ = c; }
|
||||
};
|
||||
|
||||
template <> struct QConcatenable<QCharRef> : private QAbstractConcatenable
|
||||
{
|
||||
typedef QCharRef type;
|
||||
|
@ -73,6 +73,7 @@ void runScenario()
|
||||
QString string(l1string);
|
||||
QStringRef stringref(&string, 2, 10);
|
||||
QLatin1Char achar('c');
|
||||
QChar::SpecialCharacter special(QChar::Nbsp);
|
||||
QString r2(QLatin1String(LITERAL LITERAL));
|
||||
QString r3 = QString::fromUtf8(UTF8_LITERAL UTF8_LITERAL);
|
||||
QString r;
|
||||
@ -97,6 +98,8 @@ void runScenario()
|
||||
QCOMPARE(r, QString(string P achar));
|
||||
r = achar + string;
|
||||
QCOMPARE(r, QString(achar P string));
|
||||
r = special + string;
|
||||
QCOMPARE(r, QString(special P string));
|
||||
|
||||
#ifdef Q_COMPILER_UNICODE_STRINGS
|
||||
r = QStringLiteral(UNICODE_LITERAL);
|
||||
|
Loading…
Reference in New Issue
Block a user