Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qbluetoothaddress.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QBLUETOOTHADDRESS_H
5#define QBLUETOOTHADDRESS_H
6
7#include <QtBluetooth/qtbluetoothglobal.h>
8
9#include <QtCore/QByteArray>
10#include <QtCore/qhashfunctions.h>
11#include <QtCore/QString>
12#include <QtCore/QMetaType>
13#include <QtCore/QDebug>
14
16
17class QT6_ONLY(Q_BLUETOOTH_EXPORT) QBluetoothAddress
18{
19public:
20 constexpr QBluetoothAddress() noexcept {};
21 constexpr explicit QBluetoothAddress(quint64 address) noexcept : m_address(address) {};
22 QT7_ONLY(Q_BLUETOOTH_EXPORT)
23 explicit QBluetoothAddress(const QString &address);
24#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
25 QT_BLUETOOTH_INLINE_SINCE(6, 6)
27 QT_BLUETOOTH_INLINE_SINCE(6, 6)
29
30 QT_BLUETOOTH_INLINE_SINCE(6, 6)
31 QBluetoothAddress &operator=(const QBluetoothAddress &other) noexcept;
32 QBluetoothAddress(QBluetoothAddress &&) noexcept = default;
33 QBluetoothAddress &operator=(QBluetoothAddress &&) noexcept = default;
34#endif // Qt 6
35
36 QT_BLUETOOTH_INLINE_SINCE(6, 6)
37 bool isNull() const noexcept;
38
39 QT_BLUETOOTH_INLINE_SINCE(6, 6)
40 void clear() noexcept;
41
42 friend bool operator<(const QBluetoothAddress &a, const QBluetoothAddress &b)
43 {
44 return a.m_address < b.m_address;
45 }
46 friend bool operator==(const QBluetoothAddress &a, const QBluetoothAddress &b)
47 {
48 return a.m_address == b.m_address;
49 }
50 inline friend bool operator!=(const QBluetoothAddress &a, const QBluetoothAddress &b)
51 {
52 return a.m_address != b.m_address;
53 }
54
55 QT_BLUETOOTH_INLINE_SINCE(6, 6)
56 quint64 toUInt64() const noexcept;
57 QT7_ONLY(Q_BLUETOOTH_EXPORT)
58 QString toString() const;
59
60private:
61 quint64 m_address = { 0 };
62 friend QT7_ONLY(constexpr) size_t qHash(const QBluetoothAddress &key, size_t seed = 0) noexcept
63 { return qHash(key.m_address, seed); }
64#ifndef QT_NO_DEBUG_STREAM
66 {
67 return streamingOperator(d, a);
68 }
69 QT7_ONLY(Q_BLUETOOTH_EXPORT)
70 static QDebug streamingOperator(QDebug, const QBluetoothAddress &address);
71#endif
72};
73
74#if QT_BLUETOOTH_INLINE_IMPL_SINCE(6, 6)
75#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
76QBluetoothAddress::QBluetoothAddress(const QBluetoothAddress &) noexcept = default;
77QBluetoothAddress &QBluetoothAddress::operator=(const QBluetoothAddress &) noexcept = default;
78QBluetoothAddress::~QBluetoothAddress() = default;
79#endif
80
81void QBluetoothAddress::clear() noexcept
82{
83 m_address = 0;
84}
85
86bool QBluetoothAddress::isNull() const noexcept
87{
88 return m_address == 0;
89}
90
91quint64 QBluetoothAddress::toUInt64() const noexcept
92{
93 return m_address;
94}
95#endif // QT_BLUETOOTH_INLINE_IMPL_SINCE(6, 6)
96
98
100
101#endif
\inmodule QtBluetooth
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
b clear()
Combined button and popup list for selecting options.
constexpr bool operator!=(const timespec &t1, const timespec &t2)
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
#define QT_DECL_METATYPE_EXTERN(TYPE, EXPORT)
Definition qmetatype.h:1388
GLboolean GLboolean GLboolean b
GLuint64 key
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint GLuint64EXT address
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Definition qrandom.cpp:196
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
static bool operator<(const QSettingsIniKey &k1, const QSettingsIniKey &k2)
unsigned long long quint64
Definition qtypes.h:61
QDataStream & operator<<(QDataStream &out, const MyClass &myObj)
[4]
QSharedPointer< T > other(t)
[5]
char * toString(const MyType &t)
[31]