diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2012-04-05 14:49:02 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-06 16:08:02 +0200 |
commit | b0aa023aa2e08fb24eb1220c92bec02df3df8c90 (patch) | |
tree | 1660f4eb0b552ff32bb86f47f6ac7f9cca7878ac /src/network | |
parent | 7d63fa6edcbe706bf0eab2c7e24efa1ed8940e6d (diff) |
QtNetwork: add member-swap to shared classes
Implemented as in other shared classes (e.g. QPen).
Change-Id: Ib3d87ff99603e617cc8810489f9f5e9fe054cd2a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'src/network')
28 files changed, 202 insertions, 0 deletions
diff --git a/src/network/access/qabstractnetworkcache.cpp b/src/network/access/qabstractnetworkcache.cpp index 70b1211595..5bdb7039e5 100644 --- a/src/network/access/qabstractnetworkcache.cpp +++ b/src/network/access/qabstractnetworkcache.cpp @@ -149,6 +149,14 @@ QNetworkCacheMetaData &QNetworkCacheMetaData::operator=(const QNetworkCacheMetaD } /*! + \fn void QNetworkCacheMetaData::swap(QNetworkCacheMetaData &other) + \since 5.0 + + Swaps this metadata instance with \a other. This function is very + fast and never fails. + */ + +/*! Returns true if this meta data is equal to the \a other meta data; otherwise returns false. \sa operator!=() diff --git a/src/network/access/qabstractnetworkcache.h b/src/network/access/qabstractnetworkcache.h index 8d7e77eeb0..a27d0fb4f0 100644 --- a/src/network/access/qabstractnetworkcache.h +++ b/src/network/access/qabstractnetworkcache.h @@ -71,6 +71,10 @@ public: ~QNetworkCacheMetaData(); QNetworkCacheMetaData &operator=(const QNetworkCacheMetaData &other); + + void swap(QNetworkCacheMetaData &other) + { qSwap(d, other.d); } + bool operator==(const QNetworkCacheMetaData &other) const; inline bool operator!=(const QNetworkCacheMetaData &other) const { return !(*this == other); } diff --git a/src/network/access/qhttpmultipart.cpp b/src/network/access/qhttpmultipart.cpp index ca7e2f6be8..281629a808 100644 --- a/src/network/access/qhttpmultipart.cpp +++ b/src/network/access/qhttpmultipart.cpp @@ -125,6 +125,14 @@ QHttpPart &QHttpPart::operator=(const QHttpPart &other) } /*! + \fn void QHttpPart::swap(QHttpPart &other) + \since 5.0 + + Swaps this HTTP part with \a other. This function is very fast and + never fails. +*/ + +/*! Returns true if this object is the same as \a other (i.e., if they have the same headers and body). diff --git a/src/network/access/qhttpmultipart.h b/src/network/access/qhttpmultipart.h index 378ae3cd9e..993cb9a987 100644 --- a/src/network/access/qhttpmultipart.h +++ b/src/network/access/qhttpmultipart.h @@ -62,6 +62,9 @@ public: QHttpPart(const QHttpPart &other); ~QHttpPart(); QHttpPart &operator=(const QHttpPart &other); + + void swap(QHttpPart &other) { qSwap(d, other.d); } + bool operator==(const QHttpPart &other) const; inline bool operator!=(const QHttpPart &other) const { return !operator==(other); } diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 1fdf798dc6..2a3db12f51 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -144,6 +144,14 @@ QNetworkCookie &QNetworkCookie::operator=(const QNetworkCookie &other) } /*! + \fn void QNetworkCookie::swap(QNetworkCookie &other) + \since 5.0 + + Swaps this cookie with \a other. This function is very fast and + never fails. +*/ + +/*! \fn bool QNetworkCookie::operator!=(const QNetworkCookie &other) const Returns true if this cookie is not equal to \a other. diff --git a/src/network/access/qnetworkcookie.h b/src/network/access/qnetworkcookie.h index 5553e857de..8925791710 100644 --- a/src/network/access/qnetworkcookie.h +++ b/src/network/access/qnetworkcookie.h @@ -70,6 +70,9 @@ public: QNetworkCookie(const QNetworkCookie &other); ~QNetworkCookie(); QNetworkCookie &operator=(const QNetworkCookie &other); + + void swap(QNetworkCookie &other) { qSwap(d, other.d); } + bool operator==(const QNetworkCookie &other) const; inline bool operator!=(const QNetworkCookie &other) const { return !(*this == other); } diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index cb4614bb0a..b6447e7314 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -396,6 +396,14 @@ QNetworkRequest &QNetworkRequest::operator=(const QNetworkRequest &other) } /*! + \fn void QNetworkRequest::swap(QNetworkRequest &other) + \since 5.0 + + Swaps this network request with \a other. This function is very + fast and never fails. +*/ + +/*! Returns the URL this network request is referring to. \sa setUrl() diff --git a/src/network/access/qnetworkrequest.h b/src/network/access/qnetworkrequest.h index 68fc655b7a..6aa365dc08 100644 --- a/src/network/access/qnetworkrequest.h +++ b/src/network/access/qnetworkrequest.h @@ -114,6 +114,8 @@ public: ~QNetworkRequest(); QNetworkRequest &operator=(const QNetworkRequest &other); + inline void swap(QNetworkRequest &other) { qSwap(d, other.d); } + bool operator==(const QNetworkRequest &other) const; inline bool operator!=(const QNetworkRequest &other) const { return !operator==(other); } diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index 0aa843f393..9e3f685642 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -234,6 +234,14 @@ QNetworkConfiguration &QNetworkConfiguration::operator=(const QNetworkConfigurat } /*! + \fn void QNetworkConfiguration::swap(QNetworkConfiguration &other) + \since 5.0 + + Swaps this network configuration with \a other. This function is + very fast and never fails. +*/ + +/*! Returns true, if this configuration is the same as the \a other configuration given; otherwise returns false. */ diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index 2feb3d2394..807589cf45 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -61,6 +61,8 @@ public: QNetworkConfiguration &operator=(const QNetworkConfiguration &other); ~QNetworkConfiguration(); + void swap(QNetworkConfiguration &other) { qSwap(d, other.d); } + bool operator==(const QNetworkConfiguration &other) const; inline bool operator!=(const QNetworkConfiguration &other) const { return !operator==(other); } diff --git a/src/network/kernel/qdnslookup.cpp b/src/network/kernel/qdnslookup.cpp index a826422978..f962b2ee3d 100644 --- a/src/network/kernel/qdnslookup.cpp +++ b/src/network/kernel/qdnslookup.cpp @@ -545,6 +545,12 @@ QDnsDomainNameRecord &QDnsDomainNameRecord::operator=(const QDnsDomainNameRecord d = other.d; return *this; } +/*! + \fn void QDnsDomainNameRecord::swap(QDnsDomainNameRecord &other) + + Swaps this domain-name record instance with \a other. This + function is very fast and never fails. +*/ /*! \class QDnsHostAddressRecord @@ -623,6 +629,12 @@ QDnsHostAddressRecord &QDnsHostAddressRecord::operator=(const QDnsHostAddressRec d = other.d; return *this; } +/*! + \fn void QDnsHostAddressRecord::swap(QDnsHostAddressRecord &other) + + Swaps this host address record instance with \a other. This + function is very fast and never fails. +*/ /*! \class QDnsMailExchangeRecord @@ -712,6 +724,12 @@ QDnsMailExchangeRecord &QDnsMailExchangeRecord::operator=(const QDnsMailExchange d = other.d; return *this; } +/*! + \fn void QDnsMailExchangeRecord::swap(QDnsMailExchangeRecord &other) + + Swaps this mail exchange record with \a other. This function is + very fast and never fails. +*/ /*! \class QDnsServiceRecord @@ -826,6 +844,12 @@ QDnsServiceRecord &QDnsServiceRecord::operator=(const QDnsServiceRecord &other) d = other.d; return *this; } +/*! + \fn void QDnsServiceRecord::swap(QDnsServiceRecord &other) + + Swaps this service record instance with \a other. This function is + very fast and never fails. +*/ /*! \class QDnsTextRecord @@ -906,6 +930,12 @@ QDnsTextRecord &QDnsTextRecord::operator=(const QDnsTextRecord &other) d = other.d; return *this; } +/*! + \fn void QDnsTextRecord::swap(QDnsTextRecord &other) + + Swaps this text record instance with \a other. This function is + very fast and never fails. +*/ void QDnsLookupPrivate::_q_lookupFinished(const QDnsLookupReply &_reply) { diff --git a/src/network/kernel/qdnslookup.h b/src/network/kernel/qdnslookup.h index 89e8cbb852..f9f7261cbe 100644 --- a/src/network/kernel/qdnslookup.h +++ b/src/network/kernel/qdnslookup.h @@ -69,6 +69,8 @@ public: QDnsDomainNameRecord(const QDnsDomainNameRecord &other); ~QDnsDomainNameRecord(); + void swap(QDnsDomainNameRecord &other) { qSwap(d, other.d); } + QString name() const; quint32 timeToLive() const; QString value() const; @@ -87,6 +89,8 @@ public: QDnsHostAddressRecord(const QDnsHostAddressRecord &other); ~QDnsHostAddressRecord(); + void swap(QDnsHostAddressRecord &other) { qSwap(d, other.d); } + QString name() const; quint32 timeToLive() const; QHostAddress value() const; @@ -105,6 +109,8 @@ public: QDnsMailExchangeRecord(const QDnsMailExchangeRecord &other); ~QDnsMailExchangeRecord(); + void swap(QDnsMailExchangeRecord &other) { qSwap(d, other.d); } + QString exchange() const; QString name() const; quint16 preference() const; @@ -124,6 +130,8 @@ public: QDnsServiceRecord(const QDnsServiceRecord &other); ~QDnsServiceRecord(); + void swap(QDnsServiceRecord &other) { qSwap(d, other.d); } + QString name() const; quint16 port() const; quint16 priority() const; @@ -145,6 +153,8 @@ public: QDnsTextRecord(const QDnsTextRecord &other); ~QDnsTextRecord(); + void swap(QDnsTextRecord &other) { qSwap(d, other.d); } + QString name() const; quint32 timeToLive() const; QList<QByteArray> values() const; diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index 947b2ab0d9..422585113a 100644 --- a/src/network/kernel/qnetworkinterface.cpp +++ b/src/network/kernel/qnetworkinterface.cpp @@ -185,6 +185,14 @@ QNetworkAddressEntry &QNetworkAddressEntry::operator=(const QNetworkAddressEntry } /*! + \fn void QNetworkAddressEntry::swap(QNetworkAddressEntry &other) + \since 5.0 + + Swaps this network address entry instance with \a other. This + function is very fast and never fails. +*/ + +/*! Destroys this QNetworkAddressEntry object. */ QNetworkAddressEntry::~QNetworkAddressEntry() @@ -417,6 +425,14 @@ QNetworkInterface &QNetworkInterface::operator=(const QNetworkInterface &other) } /*! + \fn void QNetworkInterface::swap(QNetworkInterface &other) + \since 5.0 + + Swaps this network interface instance with \a other. This function + is very fast and never fails. +*/ + +/*! Returns true if this QNetworkInterface object contains valid information about a network interface. */ diff --git a/src/network/kernel/qnetworkinterface.h b/src/network/kernel/qnetworkinterface.h index dfdbb789fa..6ce5a9126a 100644 --- a/src/network/kernel/qnetworkinterface.h +++ b/src/network/kernel/qnetworkinterface.h @@ -63,6 +63,9 @@ public: QNetworkAddressEntry(const QNetworkAddressEntry &other); QNetworkAddressEntry &operator=(const QNetworkAddressEntry &other); ~QNetworkAddressEntry(); + + void swap(QNetworkAddressEntry &other) { qSwap(d, other.d); } + bool operator==(const QNetworkAddressEntry &other) const; inline bool operator!=(const QNetworkAddressEntry &other) const { return !(*this == other); } @@ -101,6 +104,8 @@ public: QNetworkInterface &operator=(const QNetworkInterface &other); ~QNetworkInterface(); + void swap(QNetworkInterface &other) { qSwap(d, other.d); } + bool isValid() const; int index() const; diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index 7a10ecf7ed..21d5748562 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -511,6 +511,14 @@ QNetworkProxy &QNetworkProxy::operator=(const QNetworkProxy &other) } /*! + \fn void QNetworkProxy::swap(QNetworkProxy &other) + \since 5.0 + + Swaps this network proxy instance with \a other. This function is + very fast and never fails. +*/ + +/*! Sets the proxy type for this instance to be \a type. Note that changing the type of a proxy does not change @@ -1132,6 +1140,14 @@ QNetworkProxyQuery &QNetworkProxyQuery::operator=(const QNetworkProxyQuery &othe } /*! + \fn void QNetworkProxyQuery::swap(QNetworkProxyQuery &other) + \since 5.0 + + Swaps this network proxy query instance with \a other. This + function is very fast and never fails. +*/ + +/*! Returns true if this QNetworkProxyQuery object contains the same data as \a other. */ diff --git a/src/network/kernel/qnetworkproxy.h b/src/network/kernel/qnetworkproxy.h index 2e5c3ed687..5287546849 100644 --- a/src/network/kernel/qnetworkproxy.h +++ b/src/network/kernel/qnetworkproxy.h @@ -86,6 +86,9 @@ public: #endif ~QNetworkProxyQuery(); QNetworkProxyQuery &operator=(const QNetworkProxyQuery &other); + + void swap(QNetworkProxyQuery &other) { qSwap(d, other.d); } + bool operator==(const QNetworkProxyQuery &other) const; inline bool operator!=(const QNetworkProxyQuery &other) const { return !(*this == other); } @@ -147,6 +150,9 @@ public: QNetworkProxy(const QNetworkProxy &other); QNetworkProxy &operator=(const QNetworkProxy &other); ~QNetworkProxy(); + + void swap(QNetworkProxy &other) { qSwap(d, other.d); } + bool operator==(const QNetworkProxy &other) const; inline bool operator!=(const QNetworkProxy &other) const { return !(*this == other); } diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 1b9563b0f5..6287cef214 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -191,6 +191,14 @@ QSslCertificate &QSslCertificate::operator=(const QSslCertificate &other) } /*! + \fn void QSslCertificate::swap(QSslCertificate &other) + \since 5.0 + + Swaps this certificate instance with \a other. This function is + very fast and never fails. +*/ + +/*! Returns true if this certificate is the same as \a other; otherwise returns false. */ diff --git a/src/network/ssl/qsslcertificate.h b/src/network/ssl/qsslcertificate.h index ff86e95909..a0ec195b6a 100644 --- a/src/network/ssl/qsslcertificate.h +++ b/src/network/ssl/qsslcertificate.h @@ -87,6 +87,10 @@ public: QSslCertificate(const QSslCertificate &other); ~QSslCertificate(); QSslCertificate &operator=(const QSslCertificate &other); + + inline void swap(QSslCertificate &other) + { qSwap(d, other.d); } + bool operator==(const QSslCertificate &other) const; inline bool operator!=(const QSslCertificate &other) const { return !operator==(other); } diff --git a/src/network/ssl/qsslcertificateextension.cpp b/src/network/ssl/qsslcertificateextension.cpp index fae261a258..e68180cab6 100644 --- a/src/network/ssl/qsslcertificateextension.cpp +++ b/src/network/ssl/qsslcertificateextension.cpp @@ -166,6 +166,13 @@ QSslCertificateExtension &QSslCertificateExtension::operator=(const QSslCertific } /*! + \fn void QSslCertificateExtension::swap(QSslCertificateExtension &other) + + Swaps this certificate extension instance with \a other. This + function is very fast and never fails. +*/ + +/*! Returns the ASN.1 OID of this extension. */ QString QSslCertificateExtension::oid() const diff --git a/src/network/ssl/qsslcertificateextension.h b/src/network/ssl/qsslcertificateextension.h index 1ba294ba1b..3ba90cefe3 100644 --- a/src/network/ssl/qsslcertificateextension.h +++ b/src/network/ssl/qsslcertificateextension.h @@ -65,6 +65,8 @@ public: QSslCertificateExtension &operator=(const QSslCertificateExtension &other); + void swap(QSslCertificateExtension &other) { qSwap(d, other.d); } + QString oid() const; QString name() const; QVariant value() const; diff --git a/src/network/ssl/qsslcipher.cpp b/src/network/ssl/qsslcipher.cpp index ae24e9e3e2..f7e2118fe4 100644 --- a/src/network/ssl/qsslcipher.cpp +++ b/src/network/ssl/qsslcipher.cpp @@ -124,6 +124,14 @@ QSslCipher &QSslCipher::operator=(const QSslCipher &other) } /*! + \fn void QSslCipher::swap(QSslCipher &other) + \since 5.0 + + Swaps this cipher instance with \a other. This function is very + fast and never fails. +*/ + +/*! Returns true if this cipher is the same as \a other; otherwise, false is returned. */ diff --git a/src/network/ssl/qsslcipher.h b/src/network/ssl/qsslcipher.h index 78989b7cb8..48b9d13615 100644 --- a/src/network/ssl/qsslcipher.h +++ b/src/network/ssl/qsslcipher.h @@ -63,6 +63,10 @@ public: QSslCipher(const QSslCipher &other); ~QSslCipher(); QSslCipher &operator=(const QSslCipher &other); + + inline void swap(QSslCipher &other) + { qSwap(d, other.d); } + bool operator==(const QSslCipher &other) const; inline bool operator!=(const QSslCipher &other) const { return !operator==(other); } diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp index f7b3228816..3dedd29bfe 100644 --- a/src/network/ssl/qsslconfiguration.cpp +++ b/src/network/ssl/qsslconfiguration.cpp @@ -149,6 +149,14 @@ QSslConfiguration &QSslConfiguration::operator=(const QSslConfiguration &other) } /*! + \fn void QSslConfiguration::swap(QSslConfiguration &other) + \since 5.0 + + Swaps this SSL configuration instance with \a other. This function + is very fast and never fails. +*/ + +/*! Returns true if this QSslConfiguration object is equal to \a other. diff --git a/src/network/ssl/qsslconfiguration.h b/src/network/ssl/qsslconfiguration.h index 0ef6a6b4f3..d57ba38561 100644 --- a/src/network/ssl/qsslconfiguration.h +++ b/src/network/ssl/qsslconfiguration.h @@ -82,6 +82,9 @@ public: ~QSslConfiguration(); QSslConfiguration &operator=(const QSslConfiguration &other); + inline void swap(QSslConfiguration &other) + { qSwap(d, other.d); } + bool operator==(const QSslConfiguration &other) const; inline bool operator!=(const QSslConfiguration &other) const { return !(*this == other); } diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp index 224ef9db8f..5c00907802 100644 --- a/src/network/ssl/qsslerror.cpp +++ b/src/network/ssl/qsslerror.cpp @@ -173,6 +173,14 @@ QSslError &QSslError::operator=(const QSslError &other) } /*! + \fn void QSslError::swap(QSslError &other) + \since 5.0 + + Swaps this error instance with \a other. This function is very + fast and never fails. +*/ + +/*! \since 4.4 Returns true if this error is equal to \a other; otherwise returns false. diff --git a/src/network/ssl/qsslerror.h b/src/network/ssl/qsslerror.h index a84010adbe..fe9a8ece5e 100644 --- a/src/network/ssl/qsslerror.h +++ b/src/network/ssl/qsslerror.h @@ -94,6 +94,9 @@ public: QSslError(const QSslError &other); + inline void swap(QSslError &other) + { qSwap(d, other.d); } + ~QSslError(); QSslError &operator=(const QSslError &other); bool operator==(const QSslError &other) const; diff --git a/src/network/ssl/qsslkey.cpp b/src/network/ssl/qsslkey.cpp index e934a2e383..31f211c3e7 100644 --- a/src/network/ssl/qsslkey.cpp +++ b/src/network/ssl/qsslkey.cpp @@ -313,6 +313,14 @@ QSslKey &QSslKey::operator=(const QSslKey &other) } /*! + \fn void QSslKey::swap(QSslKey &other) + \since 5.0 + + Swaps this ssl key with \a other. This function is very fast and + never fails. +*/ + +/*! Returns true if this is a null key; otherwise false. \sa clear() diff --git a/src/network/ssl/qsslkey.h b/src/network/ssl/qsslkey.h index e64df5fce7..3a1a8cd696 100644 --- a/src/network/ssl/qsslkey.h +++ b/src/network/ssl/qsslkey.h @@ -77,6 +77,8 @@ public: ~QSslKey(); QSslKey &operator=(const QSslKey &other); + inline void swap(QSslKey &other) { qSwap(d, other.d); } + bool isNull() const; void clear(); |