| 1 | // Copyright (C) 2016 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 QNDEFMESSAGE_H |
| 5 | #define QNDEFMESSAGE_H |
| 6 | |
| 7 | #include <QtCore/QSet> |
| 8 | #include <QtCore/QList> |
| 9 | #include <QtCore/QMetaType> |
| 10 | #include <QtNfc/qtnfcglobal.h> |
| 11 | #include <QtNfc/QNdefRecord> |
| 12 | |
| 13 | QT_BEGIN_NAMESPACE |
| 14 | |
| 15 | // This class used to be exported exposing QList methods, see QTBUG-102367. |
| 16 | #if defined(QT_BUILD_NFC_LIB) |
| 17 | # define Q_NFC_EXPORT_COMPAT QT6_ONLY(Q_NFC_EXPORT) |
| 18 | #else |
| 19 | # define Q_NFC_EXPORT_COMPAT |
| 20 | #endif |
| 21 | |
| 22 | class QNdefMessage : public QList<QNdefRecord> |
| 23 | { |
| 24 | public: |
| 25 | Q_NFC_EXPORT_COMPAT |
| 26 | QNdefMessage() = default; |
| 27 | Q_NFC_EXPORT_COMPAT |
| 28 | explicit QNdefMessage(const QNdefRecord &record) { append(t: record); } |
| 29 | Q_NFC_EXPORT_COMPAT |
| 30 | QNdefMessage(const QNdefMessage &message) = default; |
| 31 | Q_NFC_EXPORT_COMPAT |
| 32 | QNdefMessage(const QList<QNdefRecord> &records) : QList<QNdefRecord>(records) { } |
| 33 | |
| 34 | Q_NFC_EXPORT_COMPAT |
| 35 | QNdefMessage &operator=(const QNdefMessage &other) = default; |
| 36 | Q_NFC_EXPORT_COMPAT |
| 37 | QNdefMessage &operator=(QNdefMessage &&other) noexcept = default; |
| 38 | |
| 39 | Q_NFC_EXPORT bool operator==(const QNdefMessage &other) const; |
| 40 | |
| 41 | Q_NFC_EXPORT QByteArray toByteArray() const; |
| 42 | |
| 43 | Q_NFC_EXPORT static QNdefMessage fromByteArray(const QByteArray &message); |
| 44 | }; |
| 45 | |
| 46 | QT_END_NAMESPACE |
| 47 | |
| 48 | QT_DECL_METATYPE_EXTERN(QNdefMessage, Q_NFC_EXPORT) |
| 49 | |
| 50 | #endif // QNDEFMESSAGE_H |
| 51 |
