QXmlStream*: make nothrow move assignable and -constructible
Unfortunately, we cannot rely on Q_DECL_EQ_DEFAULT, so I
needed to code the special member functions by hand.
The 'reserved' field is pretty useless, since the
existing ctors didn't initialize it, but just in
case someone finds a way how to store information
in there, deal with the field in the usual way:
set to nullptr in the move ctor and swap in the
move assignment operator.
Also schedule all this for removal again come Qt 6
(then without the reserved field).
This amends a83be780ae
,
which only dealt with QXmlStreamAttribute.
Change-Id: I6898e5d0423c9519f7c07d23e2c6d2700508151e
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This commit is contained in:
parent
d06b4ca9a1
commit
6ffb0bdf60
@ -99,13 +99,16 @@ class QXmlStreamReaderPrivate;
|
|||||||
class QXmlStreamAttributes;
|
class QXmlStreamAttributes;
|
||||||
class Q_CORE_EXPORT QXmlStreamAttribute {
|
class Q_CORE_EXPORT QXmlStreamAttribute {
|
||||||
QXmlStreamStringRef m_name, m_namespaceUri, m_qualifiedName, m_value;
|
QXmlStreamStringRef m_name, m_namespaceUri, m_qualifiedName, m_value;
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
void *reserved;
|
void *reserved;
|
||||||
|
#endif
|
||||||
uint m_isDefault : 1;
|
uint m_isDefault : 1;
|
||||||
friend class QXmlStreamReaderPrivate;
|
friend class QXmlStreamReaderPrivate;
|
||||||
friend class QXmlStreamAttributes;
|
friend class QXmlStreamAttributes;
|
||||||
public:
|
public:
|
||||||
QXmlStreamAttribute();
|
QXmlStreamAttribute();
|
||||||
QXmlStreamAttribute(const QString &qualifiedName, const QString &value);
|
QXmlStreamAttribute(const QString &qualifiedName, const QString &value);
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
QXmlStreamAttribute(const QString &namespaceUri, const QString &name, const QString &value);
|
QXmlStreamAttribute(const QString &namespaceUri, const QString &name, const QString &value);
|
||||||
QXmlStreamAttribute(const QXmlStreamAttribute &);
|
QXmlStreamAttribute(const QXmlStreamAttribute &);
|
||||||
#ifdef Q_COMPILER_RVALUE_REFS
|
#ifdef Q_COMPILER_RVALUE_REFS
|
||||||
@ -132,6 +135,8 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
QXmlStreamAttribute& operator=(const QXmlStreamAttribute &);
|
QXmlStreamAttribute& operator=(const QXmlStreamAttribute &);
|
||||||
~QXmlStreamAttribute();
|
~QXmlStreamAttribute();
|
||||||
|
#endif // < Qt 6
|
||||||
|
|
||||||
inline QStringRef namespaceUri() const { return m_namespaceUri; }
|
inline QStringRef namespaceUri() const { return m_namespaceUri; }
|
||||||
inline QStringRef name() const { return m_name; }
|
inline QStringRef name() const { return m_name; }
|
||||||
inline QStringRef qualifiedName() const { return m_qualifiedName; }
|
inline QStringRef qualifiedName() const { return m_qualifiedName; }
|
||||||
@ -185,15 +190,34 @@ public:
|
|||||||
|
|
||||||
class Q_CORE_EXPORT QXmlStreamNamespaceDeclaration {
|
class Q_CORE_EXPORT QXmlStreamNamespaceDeclaration {
|
||||||
QXmlStreamStringRef m_prefix, m_namespaceUri;
|
QXmlStreamStringRef m_prefix, m_namespaceUri;
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
void *reserved;
|
void *reserved;
|
||||||
|
#endif
|
||||||
|
|
||||||
friend class QXmlStreamReaderPrivate;
|
friend class QXmlStreamReaderPrivate;
|
||||||
public:
|
public:
|
||||||
QXmlStreamNamespaceDeclaration();
|
QXmlStreamNamespaceDeclaration();
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
QXmlStreamNamespaceDeclaration(const QXmlStreamNamespaceDeclaration &);
|
QXmlStreamNamespaceDeclaration(const QXmlStreamNamespaceDeclaration &);
|
||||||
|
QXmlStreamNamespaceDeclaration(QXmlStreamNamespaceDeclaration &&other) Q_DECL_NOTHROW // = default
|
||||||
|
: m_prefix(std::move(other.m_prefix)),
|
||||||
|
m_namespaceUri(std::move(other.m_namespaceUri)),
|
||||||
|
reserved(other.reserved)
|
||||||
|
{
|
||||||
|
other.reserved = nullptr;
|
||||||
|
}
|
||||||
|
QXmlStreamNamespaceDeclaration &operator=(QXmlStreamNamespaceDeclaration &&other) Q_DECL_NOTHROW // = default
|
||||||
|
{
|
||||||
|
m_prefix = std::move(other.m_prefix);
|
||||||
|
m_namespaceUri = std::move(other.m_namespaceUri);
|
||||||
|
qSwap(reserved, other.reserved);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
QXmlStreamNamespaceDeclaration(const QString &prefix, const QString &namespaceUri);
|
QXmlStreamNamespaceDeclaration(const QString &prefix, const QString &namespaceUri);
|
||||||
~QXmlStreamNamespaceDeclaration();
|
~QXmlStreamNamespaceDeclaration();
|
||||||
QXmlStreamNamespaceDeclaration& operator=(const QXmlStreamNamespaceDeclaration &);
|
QXmlStreamNamespaceDeclaration& operator=(const QXmlStreamNamespaceDeclaration &);
|
||||||
|
#endif // < Qt 6
|
||||||
|
|
||||||
inline QStringRef prefix() const { return m_prefix; }
|
inline QStringRef prefix() const { return m_prefix; }
|
||||||
inline QStringRef namespaceUri() const { return m_namespaceUri; }
|
inline QStringRef namespaceUri() const { return m_namespaceUri; }
|
||||||
inline bool operator==(const QXmlStreamNamespaceDeclaration &other) const {
|
inline bool operator==(const QXmlStreamNamespaceDeclaration &other) const {
|
||||||
@ -208,14 +232,35 @@ typedef QVector<QXmlStreamNamespaceDeclaration> QXmlStreamNamespaceDeclarations;
|
|||||||
|
|
||||||
class Q_CORE_EXPORT QXmlStreamNotationDeclaration {
|
class Q_CORE_EXPORT QXmlStreamNotationDeclaration {
|
||||||
QXmlStreamStringRef m_name, m_systemId, m_publicId;
|
QXmlStreamStringRef m_name, m_systemId, m_publicId;
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
void *reserved;
|
void *reserved;
|
||||||
|
#endif
|
||||||
|
|
||||||
friend class QXmlStreamReaderPrivate;
|
friend class QXmlStreamReaderPrivate;
|
||||||
public:
|
public:
|
||||||
QXmlStreamNotationDeclaration();
|
QXmlStreamNotationDeclaration();
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
~QXmlStreamNotationDeclaration();
|
~QXmlStreamNotationDeclaration();
|
||||||
QXmlStreamNotationDeclaration(const QXmlStreamNotationDeclaration &);
|
QXmlStreamNotationDeclaration(const QXmlStreamNotationDeclaration &);
|
||||||
|
QXmlStreamNotationDeclaration(QXmlStreamNotationDeclaration &&other) Q_DECL_NOTHROW // = default
|
||||||
|
: m_name(std::move(other.m_name)),
|
||||||
|
m_systemId(std::move(other.m_systemId)),
|
||||||
|
m_publicId(std::move(other.m_publicId)),
|
||||||
|
reserved(other.reserved)
|
||||||
|
{
|
||||||
|
other.reserved = nullptr;
|
||||||
|
}
|
||||||
QXmlStreamNotationDeclaration& operator=(const QXmlStreamNotationDeclaration &);
|
QXmlStreamNotationDeclaration& operator=(const QXmlStreamNotationDeclaration &);
|
||||||
|
QXmlStreamNotationDeclaration &operator=(QXmlStreamNotationDeclaration &&other) Q_DECL_NOTHROW // = default
|
||||||
|
{
|
||||||
|
m_name = std::move(other.m_name);
|
||||||
|
m_systemId = std::move(other.m_systemId);
|
||||||
|
m_publicId = std::move(other.m_publicId);
|
||||||
|
qSwap(reserved, other.reserved);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
#endif // < Qt 6
|
||||||
|
|
||||||
inline QStringRef name() const { return m_name; }
|
inline QStringRef name() const { return m_name; }
|
||||||
inline QStringRef systemId() const { return m_systemId; }
|
inline QStringRef systemId() const { return m_systemId; }
|
||||||
inline QStringRef publicId() const { return m_publicId; }
|
inline QStringRef publicId() const { return m_publicId; }
|
||||||
@ -232,14 +277,39 @@ typedef QVector<QXmlStreamNotationDeclaration> QXmlStreamNotationDeclarations;
|
|||||||
|
|
||||||
class Q_CORE_EXPORT QXmlStreamEntityDeclaration {
|
class Q_CORE_EXPORT QXmlStreamEntityDeclaration {
|
||||||
QXmlStreamStringRef m_name, m_notationName, m_systemId, m_publicId, m_value;
|
QXmlStreamStringRef m_name, m_notationName, m_systemId, m_publicId, m_value;
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
void *reserved;
|
void *reserved;
|
||||||
|
#endif
|
||||||
|
|
||||||
friend class QXmlStreamReaderPrivate;
|
friend class QXmlStreamReaderPrivate;
|
||||||
public:
|
public:
|
||||||
QXmlStreamEntityDeclaration();
|
QXmlStreamEntityDeclaration();
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
~QXmlStreamEntityDeclaration();
|
~QXmlStreamEntityDeclaration();
|
||||||
QXmlStreamEntityDeclaration(const QXmlStreamEntityDeclaration &);
|
QXmlStreamEntityDeclaration(const QXmlStreamEntityDeclaration &);
|
||||||
|
QXmlStreamEntityDeclaration(QXmlStreamEntityDeclaration &&other) Q_DECL_NOTHROW // = default
|
||||||
|
: m_name(std::move(other.m_name)),
|
||||||
|
m_notationName(std::move(other.m_notationName)),
|
||||||
|
m_systemId(std::move(other.m_systemId)),
|
||||||
|
m_publicId(std::move(other.m_publicId)),
|
||||||
|
m_value(std::move(other.m_value)),
|
||||||
|
reserved(other.reserved)
|
||||||
|
{
|
||||||
|
other.reserved = nullptr;
|
||||||
|
}
|
||||||
QXmlStreamEntityDeclaration& operator=(const QXmlStreamEntityDeclaration &);
|
QXmlStreamEntityDeclaration& operator=(const QXmlStreamEntityDeclaration &);
|
||||||
|
QXmlStreamEntityDeclaration &operator=(QXmlStreamEntityDeclaration &&other) Q_DECL_NOTHROW // = default
|
||||||
|
{
|
||||||
|
m_name = std::move(other.m_name);
|
||||||
|
m_notationName = std::move(other.m_notationName);
|
||||||
|
m_systemId = std::move(other.m_systemId);
|
||||||
|
m_publicId = std::move(other.m_publicId);
|
||||||
|
m_value = std::move(other.m_value);
|
||||||
|
qSwap(reserved, other.reserved);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
#endif // < Qt 6
|
||||||
|
|
||||||
inline QStringRef name() const { return m_name; }
|
inline QStringRef name() const { return m_name; }
|
||||||
inline QStringRef notationName() const { return m_notationName; }
|
inline QStringRef notationName() const { return m_notationName; }
|
||||||
inline QStringRef systemId() const { return m_systemId; }
|
inline QStringRef systemId() const { return m_systemId; }
|
||||||
|
Loading…
Reference in New Issue
Block a user