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>bb10
parent
f9de9eae3a
commit
2697d77141
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue