QtNetwork: make all Q_DECLARE_SHARED types nothrow move-assignable

Change-Id: Ib29ec4b73a4cdc51074997f7d167c289cf5af7a4
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
bb10
Marc Mutz 2015-06-25 18:41:14 +02:00
parent bc1804fa72
commit 65343eb283
16 changed files with 99 additions and 42 deletions

View File

@ -60,9 +60,12 @@ public:
QNetworkCacheMetaData(const QNetworkCacheMetaData &other);
~QNetworkCacheMetaData();
#ifdef Q_COMPILER_RVALUE_REFS
QNetworkCacheMetaData &operator=(QNetworkCacheMetaData &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QNetworkCacheMetaData &operator=(const QNetworkCacheMetaData &other);
void swap(QNetworkCacheMetaData &other)
void swap(QNetworkCacheMetaData &other) Q_DECL_NOTHROW
{ qSwap(d, other.d); }
bool operator==(const QNetworkCacheMetaData &other) const;

View File

@ -51,9 +51,12 @@ public:
QHttpPart();
QHttpPart(const QHttpPart &other);
~QHttpPart();
#ifdef Q_COMPILER_RVALUE_REFS
QHttpPart &operator=(QHttpPart &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QHttpPart &operator=(const QHttpPart &other);
void swap(QHttpPart &other) { qSwap(d, other.d); }
void swap(QHttpPart &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
bool operator==(const QHttpPart &other) const;
inline bool operator!=(const QHttpPart &other) const

View File

@ -59,9 +59,12 @@ public:
explicit QNetworkCookie(const QByteArray &name = QByteArray(), const QByteArray &value = QByteArray());
QNetworkCookie(const QNetworkCookie &other);
~QNetworkCookie();
#ifdef Q_COMPILER_RVALUE_REFS
QNetworkCookie &operator=(QNetworkCookie &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QNetworkCookie &operator=(const QNetworkCookie &other);
void swap(QNetworkCookie &other) { qSwap(d, other.d); }
void swap(QNetworkCookie &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
bool operator==(const QNetworkCookie &other) const;
inline bool operator!=(const QNetworkCookie &other) const

View File

@ -106,9 +106,12 @@ public:
explicit QNetworkRequest(const QUrl &url = QUrl());
QNetworkRequest(const QNetworkRequest &other);
~QNetworkRequest();
#ifdef Q_COMPILER_RVALUE_REFS
QNetworkRequest &operator=(QNetworkRequest &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QNetworkRequest &operator=(const QNetworkRequest &other);
inline void swap(QNetworkRequest &other) { qSwap(d, other.d); }
void swap(QNetworkRequest &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
bool operator==(const QNetworkRequest &other) const;
inline bool operator!=(const QNetworkRequest &other) const

View File

@ -49,10 +49,13 @@ class Q_NETWORK_EXPORT QNetworkConfiguration
public:
QNetworkConfiguration();
QNetworkConfiguration(const QNetworkConfiguration& other);
#ifdef Q_COMPILER_RVALUE_REFS
QNetworkConfiguration &operator=(QNetworkConfiguration &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QNetworkConfiguration &operator=(const QNetworkConfiguration &other);
~QNetworkConfiguration();
void swap(QNetworkConfiguration &other) { qSwap(d, other.d); }
void swap(QNetworkConfiguration &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
bool operator==(const QNetworkConfiguration &other) const;
inline bool operator!=(const QNetworkConfiguration &other) const

View File

@ -55,16 +55,18 @@ class Q_NETWORK_EXPORT QDnsDomainNameRecord
public:
QDnsDomainNameRecord();
QDnsDomainNameRecord(const QDnsDomainNameRecord &other);
#ifdef Q_COMPILER_RVALUE_REFS
QDnsDomainNameRecord &operator=(QDnsDomainNameRecord &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QDnsDomainNameRecord &operator=(const QDnsDomainNameRecord &other);
~QDnsDomainNameRecord();
void swap(QDnsDomainNameRecord &other) { qSwap(d, other.d); }
void swap(QDnsDomainNameRecord &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
QString name() const;
quint32 timeToLive() const;
QString value() const;
QDnsDomainNameRecord &operator=(const QDnsDomainNameRecord &other);
private:
QSharedDataPointer<QDnsDomainNameRecordPrivate> d;
friend class QDnsLookupRunnable;
@ -77,16 +79,18 @@ class Q_NETWORK_EXPORT QDnsHostAddressRecord
public:
QDnsHostAddressRecord();
QDnsHostAddressRecord(const QDnsHostAddressRecord &other);
#ifdef Q_COMPILER_RVALUE_REFS
QDnsHostAddressRecord &operator=(QDnsHostAddressRecord &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QDnsHostAddressRecord &operator=(const QDnsHostAddressRecord &other);
~QDnsHostAddressRecord();
void swap(QDnsHostAddressRecord &other) { qSwap(d, other.d); }
void swap(QDnsHostAddressRecord &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
QString name() const;
quint32 timeToLive() const;
QHostAddress value() const;
QDnsHostAddressRecord &operator=(const QDnsHostAddressRecord &other);
private:
QSharedDataPointer<QDnsHostAddressRecordPrivate> d;
friend class QDnsLookupRunnable;
@ -99,17 +103,19 @@ class Q_NETWORK_EXPORT QDnsMailExchangeRecord
public:
QDnsMailExchangeRecord();
QDnsMailExchangeRecord(const QDnsMailExchangeRecord &other);
#ifdef Q_COMPILER_RVALUE_REFS
QDnsMailExchangeRecord &operator=(QDnsMailExchangeRecord &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QDnsMailExchangeRecord &operator=(const QDnsMailExchangeRecord &other);
~QDnsMailExchangeRecord();
void swap(QDnsMailExchangeRecord &other) { qSwap(d, other.d); }
void swap(QDnsMailExchangeRecord &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
QString exchange() const;
QString name() const;
quint16 preference() const;
quint32 timeToLive() const;
QDnsMailExchangeRecord &operator=(const QDnsMailExchangeRecord &other);
private:
QSharedDataPointer<QDnsMailExchangeRecordPrivate> d;
friend class QDnsLookupRunnable;
@ -122,9 +128,13 @@ class Q_NETWORK_EXPORT QDnsServiceRecord
public:
QDnsServiceRecord();
QDnsServiceRecord(const QDnsServiceRecord &other);
#ifdef Q_COMPILER_RVALUE_REFS
QDnsServiceRecord &operator=(QDnsServiceRecord &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QDnsServiceRecord &operator=(const QDnsServiceRecord &other);
~QDnsServiceRecord();
void swap(QDnsServiceRecord &other) { qSwap(d, other.d); }
void swap(QDnsServiceRecord &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
QString name() const;
quint16 port() const;
@ -133,8 +143,6 @@ public:
quint32 timeToLive() const;
quint16 weight() const;
QDnsServiceRecord &operator=(const QDnsServiceRecord &other);
private:
QSharedDataPointer<QDnsServiceRecordPrivate> d;
friend class QDnsLookupRunnable;
@ -147,16 +155,18 @@ class Q_NETWORK_EXPORT QDnsTextRecord
public:
QDnsTextRecord();
QDnsTextRecord(const QDnsTextRecord &other);
#ifdef Q_COMPILER_RVALUE_REFS
QDnsTextRecord &operator=(QDnsTextRecord &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QDnsTextRecord &operator=(const QDnsTextRecord &other);
~QDnsTextRecord();
void swap(QDnsTextRecord &other) { qSwap(d, other.d); }
void swap(QDnsTextRecord &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
QString name() const;
quint32 timeToLive() const;
QList<QByteArray> values() const;
QDnsTextRecord &operator=(const QDnsTextRecord &other);
private:
QSharedDataPointer<QDnsTextRecordPrivate> d;
friend class QDnsLookupRunnable;

View File

@ -84,9 +84,16 @@ public:
QHostAddress(SpecialAddress address);
~QHostAddress();
#ifdef Q_COMPILER_RVALUE_REFS
QHostAddress &operator=(QHostAddress &&other) Q_DECL_NOTHROW
{ swap(other); return *this; }
#endif
QHostAddress &operator=(const QHostAddress &other);
QHostAddress &operator=(const QString &address);
void swap(QHostAddress &other) Q_DECL_NOTHROW { d.swap(other.d); }
void setAddress(quint32 ip4Addr);
void setAddress(quint8 *ip6Addr); // ### Qt 6: remove me
void setAddress(const quint8 *ip6Addr);

View File

@ -51,10 +51,13 @@ class Q_NETWORK_EXPORT QNetworkAddressEntry
public:
QNetworkAddressEntry();
QNetworkAddressEntry(const QNetworkAddressEntry &other);
#ifdef Q_COMPILER_RVALUE_REFS
QNetworkAddressEntry &operator=(QNetworkAddressEntry &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QNetworkAddressEntry &operator=(const QNetworkAddressEntry &other);
~QNetworkAddressEntry();
void swap(QNetworkAddressEntry &other) { qSwap(d, other.d); }
void swap(QNetworkAddressEntry &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
bool operator==(const QNetworkAddressEntry &other) const;
inline bool operator!=(const QNetworkAddressEntry &other) const
@ -93,10 +96,13 @@ public:
QNetworkInterface();
QNetworkInterface(const QNetworkInterface &other);
#ifdef Q_COMPILER_RVALUE_REFS
QNetworkInterface &operator=(QNetworkInterface &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QNetworkInterface &operator=(const QNetworkInterface &other);
~QNetworkInterface();
void swap(QNetworkInterface &other) { qSwap(d, other.d); }
void swap(QNetworkInterface &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
bool isValid() const;

View File

@ -63,7 +63,6 @@ public:
QueryType queryType = TcpSocket);
explicit QNetworkProxyQuery(quint16 bindPort, const QString &protocolTag = QString(),
QueryType queryType = TcpServer);
QNetworkProxyQuery(const QNetworkProxyQuery &other);
#ifndef QT_NO_BEARERMANAGEMENT
QNetworkProxyQuery(const QNetworkConfiguration &networkConfiguration,
const QUrl &requestUrl, QueryType queryType = UrlRequest);
@ -74,10 +73,14 @@ public:
quint16 bindPort, const QString &protocolTag = QString(),
QueryType queryType = TcpServer);
#endif
~QNetworkProxyQuery();
QNetworkProxyQuery(const QNetworkProxyQuery &other);
#ifdef Q_COMPILER_RVALUE_REFS
QNetworkProxyQuery &operator=(QNetworkProxyQuery &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QNetworkProxyQuery &operator=(const QNetworkProxyQuery &other);
~QNetworkProxyQuery();
void swap(QNetworkProxyQuery &other) { qSwap(d, other.d); }
void swap(QNetworkProxyQuery &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
bool operator==(const QNetworkProxyQuery &other) const;
inline bool operator!=(const QNetworkProxyQuery &other) const
@ -139,10 +142,13 @@ public:
QNetworkProxy(ProxyType type, const QString &hostName = QString(), quint16 port = 0,
const QString &user = QString(), const QString &password = QString());
QNetworkProxy(const QNetworkProxy &other);
#ifdef Q_COMPILER_RVALUE_REFS
QNetworkProxy &operator=(QNetworkProxy &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QNetworkProxy &operator=(const QNetworkProxy &other);
~QNetworkProxy();
void swap(QNetworkProxy &other) { qSwap(d, other.d); }
void swap(QNetworkProxy &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
bool operator==(const QNetworkProxy &other) const;
inline bool operator!=(const QNetworkProxy &other) const

View File

@ -83,9 +83,12 @@ public:
explicit QSslCertificate(const QByteArray &data = QByteArray(), QSsl::EncodingFormat format = QSsl::Pem);
QSslCertificate(const QSslCertificate &other);
~QSslCertificate();
#ifdef Q_COMPILER_RVALUE_REFS
QSslCertificate &operator=(QSslCertificate &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QSslCertificate &operator=(const QSslCertificate &other);
inline void swap(QSslCertificate &other)
void swap(QSslCertificate &other) Q_DECL_NOTHROW
{ qSwap(d, other.d); }
bool operator==(const QSslCertificate &other) const;

View File

@ -51,11 +51,13 @@ class Q_NETWORK_EXPORT QSslCertificateExtension
public:
QSslCertificateExtension();
QSslCertificateExtension(const QSslCertificateExtension &other);
#ifdef Q_COMPILER_RVALUE_REFS
QSslCertificateExtension &operator=(QSslCertificateExtension &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QSslCertificateExtension &operator=(const QSslCertificateExtension &other);
~QSslCertificateExtension();
QSslCertificateExtension &operator=(const QSslCertificateExtension &other);
void swap(QSslCertificateExtension &other) { qSwap(d, other.d); }
void swap(QSslCertificateExtension &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
QString oid() const;
QString name() const;

View File

@ -52,10 +52,13 @@ public:
explicit QSslCipher(const QString &name);
QSslCipher(const QString &name, QSsl::SslProtocol protocol);
QSslCipher(const QSslCipher &other);
~QSslCipher();
#ifdef Q_COMPILER_RVALUE_REFS
QSslCipher &operator=(QSslCipher &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QSslCipher &operator=(const QSslCipher &other);
~QSslCipher();
inline void swap(QSslCipher &other)
void swap(QSslCipher &other) Q_DECL_NOTHROW
{ qSwap(d, other.d); }
bool operator==(const QSslCipher &other) const;

View File

@ -71,9 +71,12 @@ public:
QSslConfiguration();
QSslConfiguration(const QSslConfiguration &other);
~QSslConfiguration();
#ifdef Q_COMPILER_RVALUE_REFS
QSslConfiguration &operator=(QSslConfiguration &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QSslConfiguration &operator=(const QSslConfiguration &other);
inline void swap(QSslConfiguration &other)
void swap(QSslConfiguration &other) Q_DECL_NOTHROW
{ qSwap(d, other.d); }
bool operator==(const QSslConfiguration &other) const;

View File

@ -84,10 +84,13 @@ public:
QSslError(const QSslError &other);
inline void swap(QSslError &other)
void swap(QSslError &other) Q_DECL_NOTHROW
{ qSwap(d, other.d); }
~QSslError();
#ifdef Q_COMPILER_RVALUE_REFS
QSslError &operator=(QSslError &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QSslError &operator=(const QSslError &other);
bool operator==(const QSslError &other) const;
inline bool operator!=(const QSslError &other) const

View File

@ -64,10 +64,13 @@ public:
const QByteArray &passPhrase = QByteArray());
explicit QSslKey(Qt::HANDLE handle, QSsl::KeyType type = QSsl::PrivateKey);
QSslKey(const QSslKey &other);
~QSslKey();
#ifdef Q_COMPILER_RVALUE_REFS
QSslKey &operator=(QSslKey &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
QSslKey &operator=(const QSslKey &other);
~QSslKey();
inline void swap(QSslKey &other) { qSwap(d, other.d); }
void swap(QSslKey &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
bool isNull() const;
void clear();

View File

@ -52,14 +52,10 @@ public:
QSslPreSharedKeyAuthenticator &operator=(const QSslPreSharedKeyAuthenticator &authenticator);
#ifdef Q_COMPILER_RVALUE_REFS
inline QSslPreSharedKeyAuthenticator &operator=(QSslPreSharedKeyAuthenticator &&authenticator)
{ d.swap(authenticator.d); return *this; }
QSslPreSharedKeyAuthenticator &operator=(QSslPreSharedKeyAuthenticator &&other) Q_DECL_NOTHROW { swap(other); return *this; }
#endif
void swap(QSslPreSharedKeyAuthenticator &authenticator)
{
d.swap(authenticator.d);
}
void swap(QSslPreSharedKeyAuthenticator &other) Q_DECL_NOTHROW { qSwap(d, other.d); }
QByteArray identityHint() const;