summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2017-03-03 07:26:44 +0100
committerAndré Hartmann <aha_1980@gmx.de>2017-03-06 13:35:27 +0000
commit15d3834f6dbe319827abdbdb92383846dd7cac3c (patch)
treea9426b18315eb7096784debf1d61ba8156f064e9
parent38703176f77ededf1b44946a6c38d6998c5e6796 (diff)
QCanBusDeviceInfo: Public API improvement
Fixes issues pointed out in the API review. Change-Id: Ia335440e7df48ee93b3243cf5686e23a3859febc Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/serialbus/qcanbusdeviceinfo.cpp6
-rw-r--r--src/serialbus/qcanbusdeviceinfo.h15
2 files changed, 15 insertions, 6 deletions
diff --git a/src/serialbus/qcanbusdeviceinfo.cpp b/src/serialbus/qcanbusdeviceinfo.cpp
index 418e4f0..42f3d39 100644
--- a/src/serialbus/qcanbusdeviceinfo.cpp
+++ b/src/serialbus/qcanbusdeviceinfo.cpp
@@ -84,14 +84,12 @@ QCanBusDeviceInfo::~QCanBusDeviceInfo()
}
/*!
+ \fn void QCanBusDeviceInfo::swap(const QCanBusDeviceInfo &other)
Swap this instance's shared data pointer with the shared data pointer in
\a other.
\internal
*/
-void QCanBusDeviceInfo::swap(QCanBusDeviceInfo other)
-{
- d_ptr.swap(other.d_ptr);
-}
+
/*!
Sets the QCanBusDeviceInfo object to be equal to \a other.
diff --git a/src/serialbus/qcanbusdeviceinfo.h b/src/serialbus/qcanbusdeviceinfo.h
index 33bf1c8..fb79f6d 100644
--- a/src/serialbus/qcanbusdeviceinfo.h
+++ b/src/serialbus/qcanbusdeviceinfo.h
@@ -53,8 +53,17 @@ public:
QCanBusDeviceInfo(const QCanBusDeviceInfo &other);
~QCanBusDeviceInfo();
- void swap(QCanBusDeviceInfo other);
+ void swap(QCanBusDeviceInfo &other) Q_DECL_NOTHROW
+ {
+ qSwap(d_ptr, other.d_ptr);
+ }
+
QCanBusDeviceInfo &operator=(const QCanBusDeviceInfo &other);
+ QCanBusDeviceInfo &operator=(QCanBusDeviceInfo &&other) Q_DECL_NOTHROW
+ {
+ swap(other);
+ return *this;
+ }
QString name() const;
@@ -65,11 +74,13 @@ private:
friend class QCanBusDevice;
friend class GenericBusPlugin;
- QCanBusDeviceInfo(QCanBusDeviceInfoPrivate &dd);
+ explicit QCanBusDeviceInfo(QCanBusDeviceInfoPrivate &dd);
QSharedDataPointer<QCanBusDeviceInfoPrivate> d_ptr;
};
+Q_DECLARE_SHARED(QCanBusDeviceInfo)
+
QT_END_NAMESPACE
#endif // QCANBUSDEVICEINFO_H