1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
// Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QOPCUAVARIANT_H
#define QOPCUAVARIANT_H
#include <QtOpcUa/qopcuaglobal.h>
#include <QtCore/qlist.h>
#include <QtCore/qshareddata.h>
#include <QtCore/qvariant.h>
QT_BEGIN_NAMESPACE
class QOpcUaVariantData;
QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QOpcUaVariantData, Q_OPCUA_EXPORT)
class QOpcUaVariant
{
public:
enum class ValueType {
Unknown = 0,
Boolean = 1,
SByte = 2,
Byte = 3,
Int16 = 4,
UInt16 = 5,
Int32 = 6,
UInt32 = 7,
Int64 = 8,
UInt64 = 9,
Float = 10,
Double = 11,
String = 12,
DateTime = 13,
Guid = 14,
ByteString = 15,
XmlElement = 16,
NodeId = 17,
ExpandedNodeId = 18,
StatusCode = 19,
QualifiedName = 20,
LocalizedText = 21,
ExtensionObject = 22,
DataValue = 23,
Variant = 24,
DiagnosticInfo = 25,
};
Q_OPCUA_EXPORT QOpcUaVariant();
Q_OPCUA_EXPORT QOpcUaVariant(const QVariant &value, ValueType type, bool isArray = false,
const QList<qint32> &arrayDimensions = {});
Q_OPCUA_EXPORT QOpcUaVariant(const QOpcUaVariant &other);
Q_OPCUA_EXPORT ~QOpcUaVariant();
void swap(QOpcUaVariant &other) noexcept
{ data.swap(other.data); }
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QOpcUaVariant)
QOpcUaVariant(QOpcUaVariant &&other) noexcept = default;
Q_OPCUA_EXPORT QOpcUaVariant &operator=(const QOpcUaVariant &rhs);
friend Q_OPCUA_EXPORT bool operator==(const QOpcUaVariant &lhs, const QOpcUaVariant &rhs) noexcept;
friend inline bool operator!=(const QOpcUaVariant &lhs, const QOpcUaVariant &rhs) noexcept
{
return !(lhs == rhs);
}
Q_OPCUA_EXPORT QVariant value() const;
Q_OPCUA_EXPORT void setValue(const QVariant &value, ValueType type, bool isArray = false,
const QList<qint32> &arrayDimensions = {});
Q_OPCUA_EXPORT ValueType type() const;
Q_OPCUA_EXPORT bool isArray() const;
Q_OPCUA_EXPORT QList<qint32> arrayDimensions() const;
Q_OPCUA_EXPORT operator QVariant() const;
private:
QExplicitlySharedDataPointer<QOpcUaVariantData> data;
};
Q_DECLARE_SHARED(QOpcUaVariant)
QT_END_NAMESPACE
#endif // QOPCUAVARIANT_H
|