summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothuuid.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-08-10 21:15:38 +0200
committerMarc Mutz <marc.mutz@qt.io>2023-08-15 18:33:28 +0200
commitbfa5d5f6581439216ccbff97e1c9af76fc461dc7 (patch)
tree19b920f3f66adf3a5856888a9a510909352871d6 /src/bluetooth/qbluetoothuuid.h
parent1c49eaa90e45a534e69f3efae0afa5cd90e7ff1f (diff)
QBluetoothUuid: provide Endian overloads for quint128 functions
This mimicks the new APIs of the same name in QUuid. For QBluetoothUuid, this is wonderful news, because the old overloads that lack the Endian parameter are now _always_ referring to the old struct quint128, and are, as usual, defined in removed_api.cpp¹ ¹ with the caveat that QT_NO_INT128 is defined there globally, which may create problems for potential QT_REMOVED_SINCE(6, 7)s. A solution would be to move this stuff out into a compat/old_int128_api.cpp, but let's first get the 6.6 part done. The new overloads are now either `unsigned __int128` (#ifdef QT_SUPPORTS_INT128) or `struct quint128` (otherwise), never both, so we don't need a second TU to do the overloading at the ABI level. This leaves removed_api.cpp with its traditional role of dealing with QT_REMOVED_SINCE (with the caveat mentioned above) and the QT_SUPPORTS_INT128 handling is in qbluetoothuuid.{h,cpp}, where it belongs. This greatly simplifies the #ifdef'ery in all three files and allows to do away with the "normal" vs. "not typical" QT_REMOVED_SINCE(6, 6) section split. Amends 5d90296f312f72ffa6a5322df7b565c3e5521684. As a drive-by, fix missing Q_QDOC handling. Pick-to: 6.6 Change-Id: I4ead4ee39533967a78c145ef222d9991fdf4cd98 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/bluetooth/qbluetoothuuid.h')
-rw-r--r--src/bluetooth/qbluetoothuuid.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/bluetooth/qbluetoothuuid.h b/src/bluetooth/qbluetoothuuid.h
index f03dd63f..d91670d9 100644
--- a/src/bluetooth/qbluetoothuuid.h
+++ b/src/bluetooth/qbluetoothuuid.h
@@ -18,7 +18,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(CBUUID);
QT_BEGIN_NAMESPACE
-#if QT_BLUETOOTH_REMOVED_SINCE(6, 6) || !defined(QT_SUPPORTS_INT128)
+#if !defined(QT_SUPPORTS_INT128)
struct quint128
{
quint8 data[16];
@@ -350,8 +350,12 @@ public:
: QUuid(uuid, 0x0, 0x1000, 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb) {};
explicit constexpr QBluetoothUuid(quint32 uuid) noexcept
: QUuid(uuid, 0x0, 0x1000, 0x80, 0x00, 0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb) {};
+ // end of bluetooth-specific constructors; rest is essentially `using QUuid::QUuid;`
+#if QT_BLUETOOTH_REMOVED_SINCE(6, 6)
explicit QBluetoothUuid(quint128 uuid);
+#endif
+ explicit QBluetoothUuid(quint128 uuid, QSysInfo::Endian order = QSysInfo::BigEndian) noexcept;
explicit QBluetoothUuid(Id128Bytes uuid, QSysInfo::Endian order = QSysInfo::BigEndian) noexcept
: QUuid(uuid, order) {};
explicit QBluetoothUuid(const QString &uuid);
@@ -378,9 +382,12 @@ public:
quint16 toUInt16(bool *ok = nullptr) const;
quint32 toUInt32(bool *ok = nullptr) const;
-#if QT_BLUETOOTH_REMOVED_SINCE(6, 6) || !defined(QT_SUPPORTS_INT128)
+#if QT_BLUETOOTH_REMOVED_SINCE(6, 6)
quint128 toUInt128() const;
#endif
+#if defined(Q_QDOC) || !defined(QT_SUPPORTS_INT128) // otherwise falls back to QUuid::toUint128()
+ quint128 toUInt128(QSysInfo::Endian order = QSysInfo::BigEndian) const noexcept;
+#endif
#if defined(Q_OS_DARWIN) || defined(Q_QDOC)
static QBluetoothUuid fromCBUUID(CBUUID *cbUuid);