From 2697d7714159d031be6c1eb4dfee937a5b4e29d8 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 19 Oct 2015 12:39:13 +0200 Subject: QXmlStreamStringRef: mark as shared-not-movable-until-qt6 Requires adding member swap. Member-swap is also necessary to fix the deleted move-assignment operator of this class, on which QXmlStreamAttribute heavily relies for its own move assignment operator. That's why it's not proposed for dev, but 5.6. Change-Id: Id7d0823d44fc6e55ada7c096ae95444f6bb50963 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/corelib/xml/qxmlstream.cpp | 7 +++++++ src/corelib/xml/qxmlstream.h | 9 +++++++++ 2 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index 69e2e5d5c1..64a130e45a 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -2622,6 +2622,13 @@ QXmlStreamEntityDeclaration::~QXmlStreamEntityDeclaration() { } +/*! \fn QXmlStreamStringRef::swap(QXmlStreamStringRef &other) + \since 5.6 + + Swaps this string reference's contents with \a other. + This function is very fast and never fails. +*/ + /*! \fn QStringRef QXmlStreamEntityDeclaration::name() const Returns the entity name. diff --git a/src/corelib/xml/qxmlstream.h b/src/corelib/xml/qxmlstream.h index 7b1ea624c5..4e603a951a 100644 --- a/src/corelib/xml/qxmlstream.h +++ b/src/corelib/xml/qxmlstream.h @@ -54,12 +54,21 @@ public: :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(){} + + void swap(QXmlStreamStringRef &other) Q_DECL_NOTHROW + { + qSwap(m_string, other.m_string); + qSwap(m_position, other.m_position); + qSwap(m_size, other.m_size); + } + inline void clear() { m_string.clear(); m_position = m_size = 0; } inline operator QStringRef() const { return QStringRef(&m_string, m_position, m_size); } inline const QString *string() const { return &m_string; } inline int position() const { return m_position; } inline int size() const { return m_size; } }; +Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QXmlStreamStringRef) class QXmlStreamReaderPrivate; -- cgit v1.2.3