summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2015-05-27 08:46:18 +0400
committerAlex Blasche <alexander.blasche@theqtcompany.com>2015-05-27 13:04:46 +0000
commitdb13bb190e1686cbacbcc8bc841c65e5dc477c28 (patch)
treec030e09c27135248f2d305e0ade0b0b278d8ee53
parent7be49c9c1c14375b9ce8595b54766220c3bc1b25 (diff)
Provide missing comparison operators
Change-Id: Ic940a8a61797c05f930b8063b67c1602292bb266 Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
-rw-r--r--src/bluetooth/qbluetoothhostinfo.cpp23
-rw-r--r--src/bluetooth/qbluetoothhostinfo.h3
2 files changed, 26 insertions, 0 deletions
diff --git a/src/bluetooth/qbluetoothhostinfo.cpp b/src/bluetooth/qbluetoothhostinfo.cpp
index 1304f18a..f3671695 100644
--- a/src/bluetooth/qbluetoothhostinfo.cpp
+++ b/src/bluetooth/qbluetoothhostinfo.cpp
@@ -89,6 +89,29 @@ QBluetoothHostInfo &QBluetoothHostInfo::operator=(const QBluetoothHostInfo &othe
}
/*!
+ \since 5.5
+
+ Returns true if \a other is equal to this QBluetoothHostInfo, otherwise false.
+*/
+bool QBluetoothHostInfo::operator==(const QBluetoothHostInfo &other) const
+{
+ if (d_ptr == other.d_ptr)
+ return true;
+
+ return d_ptr->m_address == other.d_ptr->m_address && d_ptr->m_name == other.d_ptr->m_name;
+}
+
+/*!
+ \since 5.5
+
+ Returns true if \a other is not equal to this QBluetoothHostInfo, otherwise false.
+*/
+bool QBluetoothHostInfo::operator!=(const QBluetoothHostInfo &other) const
+{
+ return !operator==(other);
+}
+
+/*!
Returns the Bluetooth address as a QBluetoothAddress.
*/
QBluetoothAddress QBluetoothHostInfo::address() const
diff --git a/src/bluetooth/qbluetoothhostinfo.h b/src/bluetooth/qbluetoothhostinfo.h
index 3b15f14c..30e9e249 100644
--- a/src/bluetooth/qbluetoothhostinfo.h
+++ b/src/bluetooth/qbluetoothhostinfo.h
@@ -49,6 +49,9 @@ public:
QBluetoothHostInfo &operator=(const QBluetoothHostInfo &other);
+ bool operator==(const QBluetoothHostInfo &other) const;
+ bool operator!=(const QBluetoothHostInfo &other) const;
+
QBluetoothAddress address() const;
void setAddress(const QBluetoothAddress &address);