| 1 | // Copyright (C) 2015 basysKom GmbH, opensource@basyskom.com |
| 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 QOPCUACONTENTFILTERELEMENT_H |
| 5 | #define QOPCUACONTENTFILTERELEMENT_H |
| 6 | |
| 7 | #include <QtOpcUa/qopcuaglobal.h> |
| 8 | |
| 9 | #include <QtCore/qshareddata.h> |
| 10 | #include <QtCore/qvariant.h> |
| 11 | #include <QtCore/qlist.h> |
| 12 | |
| 13 | QT_BEGIN_NAMESPACE |
| 14 | |
| 15 | class QOpcUaSimpleAttributeOperand; |
| 16 | class QOpcUaAttributeOperand; |
| 17 | class QOpcUaElementOperand; |
| 18 | class QOpcUaLiteralOperand; |
| 19 | |
| 20 | class QOpcUaContentFilterElementData; |
| 21 | class Q_OPCUA_EXPORT QOpcUaContentFilterElement |
| 22 | { |
| 23 | public: |
| 24 | QOpcUaContentFilterElement(); |
| 25 | QOpcUaContentFilterElement(const QOpcUaContentFilterElement &); |
| 26 | QOpcUaContentFilterElement &operator=(const QOpcUaContentFilterElement &); |
| 27 | #if QT_OPCUA_REMOVED_SINCE(6, 7) |
| 28 | bool operator==(const QOpcUaContentFilterElement &rhs) const; |
| 29 | #endif |
| 30 | operator QVariant() const; |
| 31 | ~QOpcUaContentFilterElement(); |
| 32 | |
| 33 | // Specified in OPC UA 1.05 part 4, 7.7.3 |
| 34 | enum FilterOperator : quint32 { |
| 35 | Equals = 0, |
| 36 | IsNull = 1, |
| 37 | GreaterThan = 2, |
| 38 | LessThan = 3, |
| 39 | GreaterThanOrEqual = 4, |
| 40 | LessThanOrEqual = 5, |
| 41 | Like = 6, |
| 42 | Not = 7, |
| 43 | Between = 8, |
| 44 | InList = 9, |
| 45 | And = 10, |
| 46 | Or = 11, |
| 47 | Cast = 12, |
| 48 | InView = 13, |
| 49 | OfType = 14, |
| 50 | RelatedTo = 15, |
| 51 | BitwiseAnd = 16, |
| 52 | BitwiseOr = 17, |
| 53 | }; |
| 54 | |
| 55 | QOpcUaContentFilterElement &operator<<(FilterOperator op); |
| 56 | QOpcUaContentFilterElement &operator<<(const QOpcUaSimpleAttributeOperand &op); |
| 57 | QOpcUaContentFilterElement &operator<<(const QOpcUaAttributeOperand &op); |
| 58 | QOpcUaContentFilterElement &operator<<(const QOpcUaLiteralOperand &op); |
| 59 | QOpcUaContentFilterElement &operator<<(const QOpcUaElementOperand &op); |
| 60 | |
| 61 | |
| 62 | QOpcUaContentFilterElement::FilterOperator filterOperator() const; |
| 63 | void setFilterOperator(QOpcUaContentFilterElement::FilterOperator filterOperator); |
| 64 | |
| 65 | QList<QVariant> filterOperands() const; |
| 66 | QList<QVariant> &filterOperandsRef(); |
| 67 | void setFilterOperands(const QList<QVariant> &filterOperands); |
| 68 | |
| 69 | private: |
| 70 | QSharedDataPointer<QOpcUaContentFilterElementData> data; |
| 71 | |
| 72 | friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaContentFilterElement &lhs, |
| 73 | const QOpcUaContentFilterElement &rhs) noexcept; |
| 74 | |
| 75 | friend bool operator==(const QOpcUaContentFilterElement &lhs, |
| 76 | const QOpcUaContentFilterElement &rhs) noexcept |
| 77 | { return comparesEqual(lhs, rhs); } |
| 78 | friend bool operator!=(const QOpcUaContentFilterElement &lhs, |
| 79 | const QOpcUaContentFilterElement &rhs) noexcept |
| 80 | { return !comparesEqual(lhs, rhs); } |
| 81 | }; |
| 82 | |
| 83 | QT_END_NAMESPACE |
| 84 | |
| 85 | Q_DECLARE_METATYPE(QOpcUaContentFilterElement) |
| 86 | |
| 87 | #endif // QOPCUACONTENTFILTERELEMENT_H |
| 88 | |