summaryrefslogtreecommitdiffstats
path: root/src
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:39 +0000
commit2697d7714159d031be6c1eb4dfee937a5b4e29d8 (patch)
treeb810aff2ce2b2798b553fa21f3dfa40f4991353a /src
parentf9de9eae3ab4ada318de1b1a2e64a0f76d6a0c52 (diff)
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 <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/xml/qxmlstream.cpp7
-rw-r--r--src/corelib/xml/qxmlstream.h9
2 files changed, 16 insertions, 0 deletions
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;