| 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 QCANMESSAGEDESCRIPTION_H | 
| 5 | #define QCANMESSAGEDESCRIPTION_H | 
| 6 | |
| 7 | #include <QtCore/QDebug> | 
| 8 | #include <QtCore/QExplicitlySharedDataPointer> | 
| 9 | |
| 10 | #include <QtSerialBus/qcancommondefinitions.h> | 
| 11 | #include <QtSerialBus/qtserialbusglobal.h> | 
| 12 | |
| 13 | QT_BEGIN_NAMESPACE | 
| 14 | |
| 15 | class QCanSignalDescription; | 
| 16 | |
| 17 | class QCanMessageDescriptionPrivate; | 
| 18 | QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QCanMessageDescriptionPrivate, Q_SERIALBUS_EXPORT) | 
| 19 | |
| 20 | class QCanMessageDescription | 
| 21 | { | 
| 22 | public: | 
| 23 | Q_SERIALBUS_EXPORT QCanMessageDescription(); | 
| 24 | Q_SERIALBUS_EXPORT QCanMessageDescription(const QCanMessageDescription &other); | 
| 25 | QCanMessageDescription(QCanMessageDescription &&other) noexcept = default; | 
| 26 | ~QCanMessageDescription() = default; | 
| 27 | |
| 28 | Q_SERIALBUS_EXPORT QCanMessageDescription &operator=(const QCanMessageDescription &other); | 
| 29 | QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QCanMessageDescription) | 
| 30 | |
| 31 | void swap(QCanMessageDescription &other) noexcept { d.swap(other&: other.d); } | 
| 32 | |
| 33 | Q_SERIALBUS_EXPORT bool isValid() const; | 
| 34 | |
| 35 | Q_SERIALBUS_EXPORT QtCanBus::UniqueId uniqueId() const; | 
| 36 | Q_SERIALBUS_EXPORT void setUniqueId(QtCanBus::UniqueId id); | 
| 37 | |
| 38 | Q_SERIALBUS_EXPORT QString name() const; | 
| 39 | Q_SERIALBUS_EXPORT void setName(const QString &name); | 
| 40 | |
| 41 | Q_SERIALBUS_EXPORT quint8 size() const; | 
| 42 | Q_SERIALBUS_EXPORT void setSize(quint8 size); | 
| 43 | |
| 44 | Q_SERIALBUS_EXPORT QString transmitter() const; | 
| 45 | Q_SERIALBUS_EXPORT void setTransmitter(const QString &transmitter); | 
| 46 | |
| 47 | Q_SERIALBUS_EXPORT QString comment() const; | 
| 48 | Q_SERIALBUS_EXPORT void setComment(const QString &text); | 
| 49 | |
| 50 | Q_SERIALBUS_EXPORT QList<QCanSignalDescription> signalDescriptions() const; | 
| 51 | Q_SERIALBUS_EXPORT QCanSignalDescription signalDescriptionForName(const QString &name) const; | 
| 52 | Q_SERIALBUS_EXPORT void clearSignalDescriptions(); | 
| 53 | Q_SERIALBUS_EXPORT void addSignalDescription(const QCanSignalDescription &description); | 
| 54 | Q_SERIALBUS_EXPORT | 
| 55 | void setSignalDescriptions(const QList<QCanSignalDescription> &descriptions); | 
| 56 | |
| 57 | private: | 
| 58 | QExplicitlySharedDataPointer<QCanMessageDescriptionPrivate> d; | 
| 59 | friend class QCanMessageDescriptionPrivate; | 
| 60 | |
| 61 | friend void qHash(const QCanMessageDescription &desc, size_t seed) noexcept = delete; | 
| 62 | friend void operator==(const QCanMessageDescription &lhs, | 
| 63 | const QCanMessageDescription &rhs) noexcept = delete; | 
| 64 | friend void operator!=(const QCanMessageDescription &lhs, | 
| 65 | const QCanMessageDescription &rhs) noexcept = delete; | 
| 66 | |
| 67 | #ifndef QT_NO_DEBUG_STREAM | 
| 68 | friend QDebug operator<<(QDebug dbg, const QCanMessageDescription &msg) | 
| 69 | { | 
| 70 | return debugStreaming(dbg, msg); | 
| 71 | } | 
| 72 | Q_SERIALBUS_EXPORT static QDebug debugStreaming(QDebug dbg, const QCanMessageDescription &msg); | 
| 73 | #endif // QT_NO_DEBUG_STREAM | 
| 74 | }; | 
| 75 | |
| 76 | Q_DECLARE_SHARED(QCanMessageDescription) | 
| 77 | |
| 78 | QT_END_NAMESPACE | 
| 79 | |
| 80 | #endif // QCANMESSAGEDESCRIPTION_H | 
| 81 | 
