diff options
author | Jesus Fernandez <jesus.fernandez@qt.io> | 2017-04-27 19:08:56 +0200 |
---|---|---|
committer | Jesus Fernandez <Jesus.Fernandez@qt.io> | 2017-05-16 09:55:46 +0000 |
commit | 904788e3c6e800e4a8b641b549cbfd86f2045f80 (patch) | |
tree | b4cb6a1bfe96bce217321428380b61ee477e3294 /src | |
parent | cafefd1d33349209617d391b3b49c9663590b3c9 (diff) |
Add swap and move operator to QHostInfo
Also mark as shared-come-qt6,
[ChangeLog][QtNetwork][QHostInfo] Added swap() and move operator.
Change-Id: I8f422868f0487a37aeba3bc74685dc4912e9b3a4
Coverity-Id: 168204
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/network/kernel/qhostinfo.cpp | 21 | ||||
-rw-r--r-- | src/network/kernel/qhostinfo.h | 5 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index 46123eb8a7..d2e61778ec 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -279,6 +279,27 @@ int QHostInfo::lookupHost(const QString &name, QObject *receiver, } /*! + \fn QHostInfo &QHostInfo::operator=(QHostInfo &&other) + + Move-assigns \a other to this QHostInfo instance. + + \note The moved-from object \a other is placed in a + partially-formed state, in which the only valid operations are + destruction and assignment of a new value. + + \since 5.10 +*/ + +/*! + \fn void QHostInfo::swap(QHostInfo &other) + + Swaps host-info \other with this host-info. This operation is + very fast and never fails. + + \since 5.10 +*/ + +/*! \fn int QHostInfo::lookupHost(const QString &name, const QObject *receiver, PointerToMemberFunction function) \since 5.9 diff --git a/src/network/kernel/qhostinfo.h b/src/network/kernel/qhostinfo.h index 00c70ae9b9..c5727bb6eb 100644 --- a/src/network/kernel/qhostinfo.h +++ b/src/network/kernel/qhostinfo.h @@ -63,8 +63,11 @@ public: explicit QHostInfo(int lookupId = -1); QHostInfo(const QHostInfo &d); QHostInfo &operator=(const QHostInfo &d); + QHostInfo &operator=(QHostInfo &&other) Q_DECL_NOTHROW { swap(other); return *this; } ~QHostInfo(); + void swap(QHostInfo &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + QString hostName() const; void setHostName(const QString &name); @@ -154,6 +157,8 @@ private: QtPrivate::QSlotObjectBase *slotObj); }; +Q_DECLARE_SHARED_NOT_MOVABLE_UNTIL_QT6(QHostInfo) + QT_END_NAMESPACE Q_DECLARE_METATYPE(QHostInfo) |