Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qndeffilter.h
Go to the documentation of this file.
1// Copyright (C) 2021 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 QNDEFFILTER_H
5#define QNDEFFILTER_H
6
7#include <QtCore/QSharedDataPointer>
8#include <QtNfc/qtnfcglobal.h>
9#include <QtNfc/QNdefRecord>
10
11QT_BEGIN_NAMESPACE
12
13class QNdefMessage;
14
15class QNdefFilterPrivate;
16class Q_NFC_EXPORT QNdefFilter
17{
18public:
19 QNdefFilter();
20 QNdefFilter(const QNdefFilter &other);
21 ~QNdefFilter();
22
23 void clear();
24
25 void setOrderMatch(bool on);
26 bool orderMatch() const;
27
28 struct Record {
29 QNdefRecord::TypeNameFormat typeNameFormat;
30 QByteArray type;
31 unsigned int minimum;
32 unsigned int maximum;
33 };
34
35 template<typename T>
36 bool appendRecord(unsigned int min = 1, unsigned int max = 1);
37 bool appendRecord(QNdefRecord::TypeNameFormat typeNameFormat, const QByteArray &type,
38 unsigned int min = 1, unsigned int max = 1);
39 bool appendRecord(const Record &record);
40
41 qsizetype recordCount() const;
42 Record recordAt(qsizetype i) const;
43
44 QNdefFilter &operator=(const QNdefFilter &other);
45
46 bool match(const QNdefMessage &message) const;
47
48private:
49 QSharedDataPointer<QNdefFilterPrivate> d;
50};
51
52template <typename T>
53bool QNdefFilter::appendRecord(unsigned int min, unsigned int max)
54{
55 T record;
56
57 return appendRecord(record.typeNameFormat(), record.type(), min, max);
58}
59
60QT_END_NAMESPACE
61
62#endif // QNDEFFILTER_H
The QNdefFilter class provides a filter for matching NDEF messages.
Definition qndeffilter.h:17
static bool verifyRecord(const QNdefFilter::Record &record)