| 1 | // Copyright (C) 2023 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 QOPCUASTRUCTUREFIELD_H |
| 5 | #define QOPCUASTRUCTUREFIELD_H |
| 6 | |
| 7 | #include <QtOpcUa/qopcuaglobal.h> |
| 8 | |
| 9 | #include <QtCore/qcontainerfwd.h> |
| 10 | #include <QtCore/qshareddata.h> |
| 11 | #include <QtCore/qstringfwd.h> |
| 12 | |
| 13 | QT_BEGIN_NAMESPACE |
| 14 | |
| 15 | class QOpcUaStructureFieldData; |
| 16 | class QOpcUaLocalizedText; |
| 17 | |
| 18 | QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QOpcUaStructureFieldData, Q_OPCUA_EXPORT) |
| 19 | |
| 20 | class QOpcUaStructureField |
| 21 | { |
| 22 | public: |
| 23 | Q_OPCUA_EXPORT explicit QOpcUaStructureField(qint32 valueRank = -1); |
| 24 | Q_OPCUA_EXPORT QOpcUaStructureField(const QOpcUaStructureField &other); |
| 25 | void swap(QOpcUaStructureField &other) noexcept |
| 26 | { data.swap(other&: other.data); } |
| 27 | QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QOpcUaStructureField) |
| 28 | QOpcUaStructureField(QOpcUaStructureField &&other) noexcept = default; |
| 29 | Q_OPCUA_EXPORT QOpcUaStructureField &operator=(const QOpcUaStructureField &other); |
| 30 | Q_OPCUA_EXPORT operator QVariant() const; |
| 31 | Q_OPCUA_EXPORT ~QOpcUaStructureField(); |
| 32 | |
| 33 | Q_OPCUA_EXPORT QString name() const; |
| 34 | Q_OPCUA_EXPORT void setName(const QString &name); |
| 35 | |
| 36 | Q_OPCUA_EXPORT QOpcUaLocalizedText description() const; |
| 37 | Q_OPCUA_EXPORT void setDescription(const QOpcUaLocalizedText &description); |
| 38 | |
| 39 | Q_OPCUA_EXPORT QString dataType() const; |
| 40 | Q_OPCUA_EXPORT void setDataType(const QString &dataTypeId); |
| 41 | |
| 42 | Q_OPCUA_EXPORT qint32 valueRank() const; |
| 43 | Q_OPCUA_EXPORT void setValueRank(qint32 valueRank); |
| 44 | |
| 45 | Q_OPCUA_EXPORT QList<quint32> arrayDimensions() const; |
| 46 | Q_OPCUA_EXPORT void setArrayDimensions(const QList<quint32> &arrayDimensions); |
| 47 | |
| 48 | Q_OPCUA_EXPORT quint32 maxStringLength() const; |
| 49 | Q_OPCUA_EXPORT void setMaxStringLength(quint32 maxStringLength); |
| 50 | |
| 51 | Q_OPCUA_EXPORT bool isOptional() const; |
| 52 | Q_OPCUA_EXPORT void setIsOptional(bool isOptional); |
| 53 | |
| 54 | private: |
| 55 | QExplicitlySharedDataPointer<QOpcUaStructureFieldData> data; |
| 56 | |
| 57 | friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaStructureField &lhs, |
| 58 | const QOpcUaStructureField &rhs) noexcept; |
| 59 | friend bool operator==(const QOpcUaStructureField &lhs, |
| 60 | const QOpcUaStructureField &rhs) noexcept |
| 61 | { return comparesEqual(lhs, rhs); } |
| 62 | friend inline bool operator!=(const QOpcUaStructureField &lhs, |
| 63 | const QOpcUaStructureField &rhs) noexcept |
| 64 | { |
| 65 | return !(lhs == rhs); |
| 66 | } |
| 67 | }; |
| 68 | |
| 69 | Q_DECLARE_SHARED(QOpcUaStructureField) |
| 70 | |
| 71 | QT_END_NAMESPACE |
| 72 | |
| 73 | #endif // QOPCUASTRUCTUREFIELD_H |
| 74 |
