| 1 | // Copyright (C) 2017 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 | // Qt-Security score:significant reason:default |
| 4 | |
| 5 | #ifndef QMQTTMESSAGE_H |
| 6 | #define QMQTTMESSAGE_H |
| 7 | |
| 8 | #include <QtMqtt/qmqttglobal.h> |
| 9 | #include <QtMqtt/qmqttpublishproperties.h> |
| 10 | #include <QtMqtt/qmqtttopicname.h> |
| 11 | |
| 12 | #include <QtCore/QObject> |
| 13 | #include <QtCore/QSharedDataPointer> |
| 14 | |
| 15 | QT_BEGIN_NAMESPACE |
| 16 | |
| 17 | class QMqttMessagePrivate; |
| 18 | |
| 19 | class Q_MQTT_EXPORT QMqttMessage |
| 20 | { |
| 21 | Q_GADGET |
| 22 | Q_PROPERTY(QMqttTopicName topic READ topic CONSTANT) |
| 23 | Q_PROPERTY(QByteArray payload READ payload CONSTANT) |
| 24 | Q_PROPERTY(quint16 id READ id CONSTANT) |
| 25 | Q_PROPERTY(quint8 qos READ qos CONSTANT) |
| 26 | Q_PROPERTY(bool duplicate READ duplicate CONSTANT) |
| 27 | Q_PROPERTY(bool retain READ retain CONSTANT) |
| 28 | |
| 29 | public: |
| 30 | QMqttMessage(); |
| 31 | QMqttMessage(const QMqttMessage& other); |
| 32 | ~QMqttMessage(); |
| 33 | |
| 34 | QMqttMessage& operator=(const QMqttMessage &other); |
| 35 | bool operator==(const QMqttMessage &other) const; |
| 36 | inline bool operator!=(const QMqttMessage &other) const; |
| 37 | |
| 38 | const QByteArray &payload() const; |
| 39 | quint8 qos() const; |
| 40 | quint16 id() const; |
| 41 | QMqttTopicName topic() const; |
| 42 | bool duplicate() const; |
| 43 | bool retain() const; |
| 44 | |
| 45 | QMqttPublishProperties publishProperties() const; |
| 46 | private: |
| 47 | friend class QMqttConnection; |
| 48 | QMqttMessage(const QMqttTopicName &topic, const QByteArray &payload, |
| 49 | quint16 id, quint8 qos, |
| 50 | bool dup, bool retain); |
| 51 | QExplicitlySharedDataPointer<QMqttMessagePrivate> d; |
| 52 | }; |
| 53 | |
| 54 | QT_END_NAMESPACE |
| 55 | |
| 56 | Q_DECLARE_METATYPE(QMqttMessage) |
| 57 | |
| 58 | #endif // QMQTTMESSAGE_H |
| 59 |
