summaryrefslogtreecommitdiffstats
path: root/src/corelib/xml
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-10-19 12:39:13 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-11-19 07:40:49 +0000
commit62f2a0fb0dd43f16c59897b0f77cfdddd9332a03 (patch)
tree72d70b2a1a57ec26a6eaca3bc4a18c157e9dd68a /src/corelib/xml
parent2697d7714159d031be6c1eb4dfee937a5b4e29d8 (diff)
QXmlStreamStringRef: unbreak move special member functions
The QXmlStreamAttribute move operations expect QXmlStreamStringRef to have move special member functions, but in fact the non-trivial QXmlStreamStringRef dtor prevented them from being generated by the compiler. We can't remove the dtor, because it's exported :( So provide all the move special member functions by hand, and since their presence in turn prevents the copy special member functions from being generated, provide those too. Change-Id: I494aea24981cdb661abe33a96976a363cfe7ef1b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/corelib/xml')
-rw-r--r--src/corelib/xml/qxmlstream.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/corelib/xml/qxmlstream.h b/src/corelib/xml/qxmlstream.h
index 4e603a951a..34f26cb953 100644
--- a/src/corelib/xml/qxmlstream.h
+++ b/src/corelib/xml/qxmlstream.h
@@ -53,7 +53,22 @@ public:
inline QXmlStreamStringRef(const QStringRef &aString)
:m_string(aString.string()?*aString.string():QString()), m_position(aString.position()), m_size(aString.size()){}
inline QXmlStreamStringRef(const QString &aString):m_string(aString), m_position(0), m_size(aString.size()){}
- inline ~QXmlStreamStringRef(){}
+
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
+ QXmlStreamStringRef(const QXmlStreamStringRef &other) // = default
+ : m_string(other.m_string), m_position(other.m_position), m_size(other.m_size) {}
+#ifdef Q_COMPILER_RVALUE_REFS
+ QXmlStreamStringRef(QXmlStreamStringRef &&other) Q_DECL_NOTHROW // = default
+ : m_string(std::move(other.m_string)), m_position(other.m_position), m_size(other.m_size) {}
+ QXmlStreamStringRef &operator=(QXmlStreamStringRef &&other) Q_DECL_NOTHROW // = default
+ { swap(other); return *this; }
+#endif
+ QXmlStreamStringRef &operator=(const QXmlStreamStringRef &other) // = default
+ { m_string = other.m_string; m_position = other.m_position; m_size = other.m_size; return *this; }
+ inline ~QXmlStreamStringRef() {} // ### this prevents (or deprecates) all the move/copy special member functions,
+ // ### that's why we need to provide them by hand above. We can't remove it in
+ // ### Qt 5, since that would change the way its passed to functions. In Qt 6, remove all.
+#endif // Qt < 6.0
void swap(QXmlStreamStringRef &other) Q_DECL_NOTHROW
{