1 | // Copyright (C) 2019 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 OPCUAEVENTFILTER_P_H |
5 | #define OPCUAEVENTFILTER_P_H |
6 | |
7 | #include <QQmlListProperty> |
8 | |
9 | #include <private/opcuasimpleattributeoperand_p.h> |
10 | #include <private/opcuafilterelement_p.h> |
11 | |
12 | #include <QOpcUaMonitoringParameters> |
13 | #include <QList> |
14 | #include <QtQml/qqml.h> |
15 | |
16 | // |
17 | // W A R N I N G |
18 | // ------------- |
19 | // |
20 | // This file is not part of the Qt API. It exists purely as an |
21 | // implementation detail. This header file may change from version to |
22 | // version without notice, or even be removed. |
23 | // |
24 | // We mean it. |
25 | // |
26 | |
27 | QT_BEGIN_NAMESPACE |
28 | |
29 | class OpcUaNodeId; |
30 | class OpcUaRelativeNodePath; |
31 | |
32 | class OpcUaEventFilter : public QObject { |
33 | Q_OBJECT |
34 | Q_PROPERTY(QQmlListProperty<OpcUaFilterElement> where READ filterElements) |
35 | Q_PROPERTY(QQmlListProperty<OpcUaSimpleAttributeOperand> select READ selectors) |
36 | |
37 | QML_NAMED_ELEMENT(EventFilter) |
38 | QML_ADDED_IN_VERSION(5, 13) |
39 | |
40 | public: |
41 | explicit OpcUaEventFilter(QObject *parent = nullptr); |
42 | ~OpcUaEventFilter(); |
43 | bool operator==(const OpcUaEventFilter &other) const; |
44 | QOpcUaMonitoringParameters::EventFilter filter(QOpcUaClient *client) const; |
45 | |
46 | QQmlListProperty<OpcUaSimpleAttributeOperand> selectors(); |
47 | void appendSelector(OpcUaSimpleAttributeOperand *selector); |
48 | int selectorCount() const; |
49 | OpcUaSimpleAttributeOperand *selector(int index) const; |
50 | void clearSelectors(); |
51 | |
52 | QQmlListProperty<OpcUaFilterElement> filterElements(); |
53 | void appendFilterElement(OpcUaFilterElement *filterElement); |
54 | int filterElementCount() const; |
55 | OpcUaFilterElement *filterElement(int index) const; |
56 | void clearFilterElements(); |
57 | |
58 | signals: |
59 | void dataChanged(); |
60 | |
61 | private: |
62 | static void appendSelector(QQmlListProperty<OpcUaSimpleAttributeOperand> *list, OpcUaSimpleAttributeOperand *); |
63 | static qsizetype selectorCount(QQmlListProperty<OpcUaSimpleAttributeOperand> *list); |
64 | static OpcUaSimpleAttributeOperand* selector(QQmlListProperty<OpcUaSimpleAttributeOperand> *list, qsizetype index); |
65 | static void clearSelectors(QQmlListProperty<OpcUaSimpleAttributeOperand> *list); |
66 | |
67 | static void appendFilterElement(QQmlListProperty<OpcUaFilterElement> *list, OpcUaFilterElement *nodeId); |
68 | static qsizetype filterElementCount(QQmlListProperty<OpcUaFilterElement> *list); |
69 | static OpcUaFilterElement* filterElement(QQmlListProperty<OpcUaFilterElement> *list, qsizetype index); |
70 | static void clearFilterElements(QQmlListProperty<OpcUaFilterElement> *list); |
71 | |
72 | QList<OpcUaFilterElement*> m_filterElements; |
73 | QList<OpcUaSimpleAttributeOperand*> m_selectors; |
74 | }; |
75 | |
76 | QT_END_NAMESPACE |
77 | |
78 | #endif // OPCUAEVENTFILTER_P_H |
79 |