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 | #include <QtOpcUa/qtopcuaexports.h> |
5 | |
6 | #include <QtCore/qcontainerfwd.h> |
7 | #include <QtCore/qshareddata.h> |
8 | #include <QtCore/qstringfwd.h> |
9 | |
10 | #ifndef QOPCUAGENERICSTRUCTVALUE_H |
11 | #define QOPCUAGENERICSTRUCTVALUE_H |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | #ifndef QT_NO_DEBUG_STREAM |
16 | class QDebug; |
17 | #endif |
18 | |
19 | class QOpcUaStructureDefinition; |
20 | class QOpcUaGenericStructValueData; |
21 | |
22 | QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QOpcUaGenericStructValueData, Q_OPCUA_EXPORT) |
23 | class QOpcUaGenericStructValue { |
24 | public: |
25 | Q_OPCUA_EXPORT QOpcUaGenericStructValue(); |
26 | Q_OPCUA_EXPORT ~QOpcUaGenericStructValue(); |
27 | Q_OPCUA_EXPORT QOpcUaGenericStructValue(const QString &typeName, const QString &typeId, const QOpcUaStructureDefinition &definition); |
28 | Q_OPCUA_EXPORT QOpcUaGenericStructValue(const QString &typeName, const QString &typeId, const QOpcUaStructureDefinition &definition, |
29 | const QHash<QString, QVariant> &fields); |
30 | Q_OPCUA_EXPORT QOpcUaGenericStructValue(const QOpcUaGenericStructValue &other); |
31 | QOpcUaGenericStructValue(QOpcUaGenericStructValue &&other) noexcept = default; |
32 | Q_OPCUA_EXPORT QOpcUaGenericStructValue &operator=(const QOpcUaGenericStructValue &rhs); |
33 | void swap(QOpcUaGenericStructValue &other) noexcept |
34 | { data.swap(other&: other.data); } |
35 | QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QOpcUaGenericStructValue) |
36 | |
37 | Q_OPCUA_EXPORT operator QVariant() const; |
38 | |
39 | Q_OPCUA_EXPORT QString typeName() const; |
40 | Q_OPCUA_EXPORT void setTypeName(const QString &typeName); |
41 | |
42 | Q_OPCUA_EXPORT QString typeId() const; |
43 | Q_OPCUA_EXPORT void setTypeId(const QString &typeId); |
44 | |
45 | Q_OPCUA_EXPORT QOpcUaStructureDefinition structureDefinition() const; |
46 | Q_OPCUA_EXPORT void setStructureDefinition(const QOpcUaStructureDefinition &structureDefinition); |
47 | |
48 | Q_OPCUA_EXPORT QHash<QString, QVariant> fields() const; |
49 | Q_OPCUA_EXPORT QHash<QString, QVariant> &fieldsRef(); |
50 | Q_OPCUA_EXPORT void setFields(const QHash<QString, QVariant> &fields); |
51 | |
52 | #ifndef QT_NO_DEBUG_STREAM |
53 | Q_OPCUA_EXPORT QString toString() const; |
54 | |
55 | friend QDebug Q_OPCUA_EXPORT operator<<(QDebug debug, const QOpcUaGenericStructValue &s); |
56 | #endif |
57 | |
58 | private: |
59 | QExplicitlySharedDataPointer<QOpcUaGenericStructValueData> data; |
60 | |
61 | friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaGenericStructValue &lhs, |
62 | const QOpcUaGenericStructValue &rhs) noexcept; |
63 | friend bool operator==(const QOpcUaGenericStructValue &lhs, |
64 | const QOpcUaGenericStructValue &rhs) noexcept |
65 | { return comparesEqual(lhs, rhs); } |
66 | friend bool operator!=(const QOpcUaGenericStructValue &lhs, |
67 | const QOpcUaGenericStructValue &rhs) noexcept |
68 | { |
69 | return !(lhs == rhs); |
70 | } |
71 | }; |
72 | |
73 | Q_DECLARE_SHARED(QOpcUaGenericStructValue) |
74 | |
75 | QT_END_NAMESPACE |
76 | |
77 | #endif // QOPCUAGENERICSTRUCTVALUE_H |
78 | |