1// Copyright (C) 2022 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 QCANUNIQUEIDDESCRIPTION_H
5#define QCANUNIQUEIDDESCRIPTION_H
6
7#include <QtCore/QExplicitlySharedDataPointer>
8
9#include <QtSerialBus/qcancommondefinitions.h>
10#include <QtSerialBus/qtserialbusglobal.h>
11
12QT_BEGIN_NAMESPACE
13
14class QCanUniqueIdDescriptionPrivate;
15QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QCanUniqueIdDescriptionPrivate, Q_SERIALBUS_EXPORT)
16
17class QCanUniqueIdDescription
18{
19public:
20 Q_SERIALBUS_EXPORT QCanUniqueIdDescription();
21 Q_SERIALBUS_EXPORT QCanUniqueIdDescription(const QCanUniqueIdDescription &other);
22 QCanUniqueIdDescription(QCanUniqueIdDescription &&other) noexcept = default;
23 ~QCanUniqueIdDescription() = default;
24
25 Q_SERIALBUS_EXPORT QCanUniqueIdDescription &operator=(const QCanUniqueIdDescription &other);
26 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QCanUniqueIdDescription)
27
28 void swap(QCanUniqueIdDescription &other) noexcept { d.swap(other&: other.d); }
29
30 Q_SERIALBUS_EXPORT bool isValid() const;
31
32 Q_SERIALBUS_EXPORT QtCanBus::DataSource source() const;
33 Q_SERIALBUS_EXPORT void setSource(QtCanBus::DataSource source);
34
35 Q_SERIALBUS_EXPORT quint16 startBit() const;
36 Q_SERIALBUS_EXPORT void setStartBit(quint16 bit);
37
38 Q_SERIALBUS_EXPORT quint8 bitLength() const;
39 Q_SERIALBUS_EXPORT void setBitLength(quint8 length);
40
41 Q_SERIALBUS_EXPORT QSysInfo::Endian endian() const;
42 Q_SERIALBUS_EXPORT void setEndian(QSysInfo::Endian endian);
43
44private:
45 QExplicitlySharedDataPointer<QCanUniqueIdDescriptionPrivate> d;
46 friend class QCanUniqueIdDescriptionPrivate;
47
48 friend void qHash(const QCanUniqueIdDescription &desc, size_t seed) noexcept = delete;
49 friend void operator==(const QCanUniqueIdDescription &lhs,
50 const QCanUniqueIdDescription &rhs) noexcept = delete;
51 friend void operator!=(const QCanUniqueIdDescription &lhs,
52 const QCanUniqueIdDescription &rhs) noexcept = delete;
53};
54
55QT_END_NAMESPACE
56
57#endif // QCANUNIQUEIDDESCRIPTION_H
58

source code of qtserialbus/src/serialbus/qcanuniqueiddescription.h