123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- #ifndef QMQTT_MESSAGE_H
- #define QMQTT_MESSAGE_H
- #include <qmqtt_global.h>
- #include <QMetaType>
- #include <QString>
- #include <QByteArray>
- #include <QSharedDataPointer>
- namespace QMQTT {
- class MessagePrivate;
- class Q_MQTT_EXPORT Message
- {
- public:
- Message();
- explicit Message(const quint16 id, const QString &topic, const QByteArray &payload,
- const quint8 qos = 0, const bool retain = false, const bool dup = false);
- Message(const Message &other);
- ~Message();
- Message &operator=(const Message &other);
- #ifdef Q_COMPILER_RVALUE_REFS
- inline Message &operator=(Message &&other) Q_DECL_NOTHROW
- { swap(other); return *this; }
- #endif
- bool operator==(const Message &other) const;
- inline bool operator!=(const Message &other) const
- { return !operator==(other); }
- inline void swap(Message &other) Q_DECL_NOTHROW
- { qSwap(d, other.d); }
- quint16 id() const;
- void setId(const quint16 id);
- quint8 qos() const;
- void setQos(const quint8 qos);
- bool retain() const;
- void setRetain(const bool retain);
- bool dup() const;
- void setDup(const bool dup);
- QString topic() const;
- void setTopic(const QString &topic);
- QByteArray payload() const;
- void setPayload(const QByteArray &payload);
- private:
- QSharedDataPointer<MessagePrivate> d;
- };
- }
- Q_DECLARE_SHARED(QMQTT::Message)
- Q_DECLARE_METATYPE(QMQTT::Message)
- #endif
|