summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstringbuilder.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2011-10-20 12:47:04 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-23 23:26:28 +0200
commitd631c31235dc3ab682ba5d4cbb466680d47b36f2 (patch)
treef8c3ed874572caa33fa632451fa31b0b4ea354b1 /src/corelib/tools/qstringbuilder.h
parent33371c016e13dadcf7535e11e38065ab193b2c6e (diff)
Make QStringLiteral and QByteArrayLiteral always return the real types
Up until now, the macros would return an internal type that contained the pointer to the data. This breaks code that tried to use the macros with operators, like QStringBuilder but also when writing: QStringList() << QStringLiteral("a") << QStringLiteral("b"); This change seems to work fine now and I can also verify that this works: const auto str = QStringLiteral("Hello"); Even though it creates a QString, which is non-POD and non-constexpr. Change-Id: Iaf82af9bea4245513a1128ea54f9d2d3d785fb09 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Diffstat (limited to 'src/corelib/tools/qstringbuilder.h')
-rw-r--r--src/corelib/tools/qstringbuilder.h31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index 9a1fd6949b..9b1cd1ee7e 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -253,19 +253,6 @@ template <> struct QConcatenable<QString> : private QAbstractConcatenable
}
};
-template <> struct QConcatenable<QStringDataPtr> : private QAbstractConcatenable
-{
- typedef QStringDataPtr type;
- typedef QString ConvertTo;
- enum { ExactSize = true };
- static int size(const type &a) { return a.ptr->size; }
- static inline void appendTo(const type &a, QChar *&out)
- {
- memcpy(out, reinterpret_cast<const char*>(a.ptr->data()), sizeof(QChar) * a.ptr->size);
- out += a.ptr->size;
- }
-};
-
template <> struct QConcatenable<QStringRef> : private QAbstractConcatenable
{
typedef QStringRef type;
@@ -358,24 +345,6 @@ template <> struct QConcatenable<QByteArray> : private QAbstractConcatenable
}
};
-template <> struct QConcatenable<QByteArrayDataPtr> : private QAbstractConcatenable
-{
- typedef QByteArrayDataPtr type;
- typedef QByteArray ConvertTo;
- enum { ExactSize = false };
- static int size(const type &ba) { return ba.ptr->size; }
-#ifndef QT_NO_CAST_FROM_ASCII
- static inline QT_ASCII_CAST_WARN void appendTo(const type &a, QChar *&out)
- {
- QAbstractConcatenable::convertFromAscii(a.ptr->data(), a.ptr->size, out);
- }
-#endif
- static inline void appendTo(const type &ba, char *&out)
- {
- ::memcpy(out, ba.ptr->data(), ba.ptr->size);
- out += ba.ptr->size;
- }
-};
template <typename A, typename B>
struct QConcatenable< QStringBuilder<A, B> >