| 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 QOPCUASTRUCTUREDEFINITION_H | 
| 5 | #define QOPCUASTRUCTUREDEFINITION_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 QOpcUaStructureDefinitionData; | 
| 16 | class QOpcUaStructureField; | 
| 17 | |
| 18 | QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QOpcUaStructureDefinitionData, Q_OPCUA_EXPORT) | 
| 19 | |
| 20 | class QOpcUaStructureDefinition | 
| 21 | { | 
| 22 | public: | 
| 23 | Q_OPCUA_EXPORT QOpcUaStructureDefinition(); | 
| 24 | Q_OPCUA_EXPORT QOpcUaStructureDefinition(const QOpcUaStructureDefinition &); | 
| 25 | void swap(QOpcUaStructureDefinition &other) noexcept | 
| 26 | { data.swap(other&: other.data); } | 
| 27 | QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QOpcUaStructureDefinition) | 
| 28 | QOpcUaStructureDefinition(QOpcUaStructureDefinition &&other) noexcept = default; | 
| 29 | Q_OPCUA_EXPORT QOpcUaStructureDefinition &operator=(const QOpcUaStructureDefinition &); | 
| 30 | Q_OPCUA_EXPORT operator QVariant() const; | 
| 31 | Q_OPCUA_EXPORT ~QOpcUaStructureDefinition(); | 
| 32 | |
| 33 | enum class StructureType { | 
| 34 | Structure = 0, | 
| 35 | StructureWithOptionalFields = 1, | 
| 36 | Union = 2, | 
| 37 | }; | 
| 38 | |
| 39 | Q_OPCUA_EXPORT QString defaultEncodingId() const; | 
| 40 | Q_OPCUA_EXPORT void setDefaultEncodingId(const QString &defaultEncodingId); | 
| 41 | |
| 42 | Q_OPCUA_EXPORT QString baseDataType() const; | 
| 43 | Q_OPCUA_EXPORT void setBaseDataType(const QString &baseDataType); | 
| 44 | |
| 45 | Q_OPCUA_EXPORT QOpcUaStructureDefinition::StructureType structureType() const; | 
| 46 | Q_OPCUA_EXPORT void setStructureType(const QOpcUaStructureDefinition::StructureType &structureType); | 
| 47 | |
| 48 | Q_OPCUA_EXPORT QList<QOpcUaStructureField> fields() const; | 
| 49 | Q_OPCUA_EXPORT void setFields(const QList<QOpcUaStructureField> &fields); | 
| 50 | |
| 51 | private: | 
| 52 | QExplicitlySharedDataPointer<QOpcUaStructureDefinitionData> data; | 
| 53 | |
| 54 | friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaStructureDefinition &lhs, | 
| 55 | const QOpcUaStructureDefinition &rhs) noexcept; | 
| 56 | friend bool operator==(const QOpcUaStructureDefinition &lhs, | 
| 57 | const QOpcUaStructureDefinition &rhs) noexcept | 
| 58 | { return comparesEqual(lhs, rhs); } | 
| 59 | friend bool operator!=(const QOpcUaStructureDefinition &lhs, | 
| 60 | const QOpcUaStructureDefinition &rhs) noexcept | 
| 61 | { | 
| 62 | return !(lhs == rhs); | 
| 63 | } | 
| 64 | }; | 
| 65 | |
| 66 | Q_DECLARE_SHARED(QOpcUaStructureDefinition) | 
| 67 | |
| 68 | QT_END_NAMESPACE | 
| 69 | |
| 70 | #endif // QOPCUASTRUCTUREDEFINITION_H | 
| 71 | 
