summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/removed_api.cpp
blob: c4f37b689e8195ef9a314a75c31e6690e34ba7a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright (C) 2022 Intel Corporation.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#define QT_BLUETOOTH_BUILD_REMOVED_API

// Undefine Qt 128-bit int types
#define QT_NO_INT128

#include "qtbluetoothglobal.h"

QT_USE_NAMESPACE

#if QT_BLUETOOTH_REMOVED_SINCE(6, 6)

#include "qbluetoothaddress.h" // inlined API

#include "qbluetoothuuid.h"

static_assert(std::is_aggregate_v<quint128>);
static_assert(std::is_trivial_v<quint128>);

// These legacy functions can't just call the new (quint128, Endian) overloads,
// as the latter may see either QtCore's quint128 (__int128 built-in) _or_ our
// fake version from qbluetoothuuid.h. This TU must _always_ see the fake ones
// (as that is what we had in 6.5):
#ifdef QT_SUPPORTS_INT128
#  error This TU requires QT_NO_INT128 to be defined.
#endif

QBluetoothUuid::QBluetoothUuid(quint128 uuid)
    : QUuid(fromBytes(uuid.data))
{}

quint128 QBluetoothUuid::toUInt128() const
{
    quint128 uuid;
    const auto bytes = toBytes();
    memcpy(uuid.data, bytes.data, sizeof(uuid.data));
    return uuid;
}

// END quint128 functions

QBluetoothUuid::QBluetoothUuid(const QString &uuid)
    : QUuid(qToAnyStringViewIgnoringNull(uuid))
{
}

#ifndef QT_NO_DEBUG_STREAM
QDebug QBluetoothUuid::streamingOperator(QDebug debug, const QBluetoothUuid &uuid)
{
    debug << uuid.toString();
    return debug;
}
#endif // QT_NO_DEBUG_STREAM

#endif // QT_BLUETOOTH_REMOVED_SINCE(6, 6)