QOpcUaVariant Class

The OPC UA Variant. 更多...

头: #include <QOpcUaVariant>
CMake: find_package(Qt6 REQUIRED COMPONENTS OpcUa)
target_link_libraries(mytarget PRIVATE Qt6::OpcUa)
qmake: QT += opcua
Since: Qt 6.7

公共类型

enum class ValueType { Unknown, Boolean, SByte, Byte, Int16, …, DiagnosticInfo }

公共函数

QOpcUaVariant ()
QOpcUaVariant (QOpcUaVariant::ValueType type , const QVariant & value )
QOpcUaVariant (QOpcUaVariant::ValueType type , const QVariant & value , const QList<qint32> arrayDimensions )
QOpcUaVariant (const QOpcUaVariant & other )
QOpcUaVariant (QOpcUaVariant && other )
~QOpcUaVariant ()
QList<qint32> arrayDimensions () const
bool isArray () const
void setArrayDimensions (const QList<qint32> & arrayDimensions )
void setValue (QOpcUaVariant::ValueType type , const QVariant & value )
void setValue (QOpcUaVariant::ValueType type , const QVariant & value , const QList<qint32> & arrayDimensions )
void swap (QOpcUaVariant & other )
QOpcUaVariant::ValueType type () const
QVariant value () const
QVariant operator QVariant () const
QOpcUaVariant & operator= (QOpcUaVariant && other )
QOpcUaVariant & operator= (const QOpcUaVariant & rhs )
bool operator!= (const QOpcUaVariant & lhs , const QOpcUaVariant & rhs )
bool operator== (const QOpcUaVariant & lhs , const QOpcUaVariant & rhs )

详细描述

The OPC UA variant is an union of all built-in OPC UA types and also contains information about the array dimensions associated with the value. This class is currently only supported by QOpcUaBinaryDataEncoding and QOpcUaGenericStructHandler .

成员类型文档编制

enum class QOpcUaVariant:: ValueType

This enum contains the possible value types of an OPC UA variant.

常量 描述
QOpcUaVariant::ValueType::Unknown 0
QOpcUaVariant::ValueType::Boolean 1
QOpcUaVariant::ValueType::SByte 2
QOpcUaVariant::ValueType::Byte 3
QOpcUaVariant::ValueType::Int16 4
QOpcUaVariant::ValueType::UInt16 5
QOpcUaVariant::ValueType::Int32 6
QOpcUaVariant::ValueType::UInt32 7 ,
QOpcUaVariant::ValueType::Int64 8
QOpcUaVariant::ValueType::UInt64 9
QOpcUaVariant::ValueType::Float 10
QOpcUaVariant::ValueType::Double 11
QOpcUaVariant::ValueType::String 12
QOpcUaVariant::ValueType::DateTime 13
QOpcUaVariant::ValueType::Guid 14
QOpcUaVariant::ValueType::ByteString 15
QOpcUaVariant::ValueType::XmlElement 16
QOpcUaVariant::ValueType::NodeId 17
QOpcUaVariant::ValueType::ExpandedNodeId 18
QOpcUaVariant::ValueType::StatusCode 19
QOpcUaVariant::ValueType::QualifiedName 20
QOpcUaVariant::ValueType::LocalizedText 21
QOpcUaVariant::ValueType::ExtensionObject 22
QOpcUaVariant::ValueType::DataValue 23
QOpcUaVariant::ValueType::Variant 24
QOpcUaVariant::ValueType::DiagnosticInfo 25

成员函数文档编制

QOpcUaVariant:: QOpcUaVariant ()

Default constructs a new OPC UA variant.

QOpcUaVariant:: QOpcUaVariant ( QOpcUaVariant::ValueType type , const QVariant & value )

Constructs a new OPC UA variant of type type 采用值 value .

Scalar values must be passed as a QVariant containing a value of type . Array values must be passed as a QVariant 包含 QList of type .

QOpcUaVariant:: QOpcUaVariant ( QOpcUaVariant::ValueType type , const QVariant & value , const QList < qint32 > arrayDimensions )

Constructs a new OPC UA variant of type type 采用值 value and array dimensions arrayDimensions .

Scalar values must be passed as a QVariant containing a value of type . Array values must be passed as a QVariant 包含 QList of type .

QOpcUaVariant:: QOpcUaVariant (const QOpcUaVariant & other )

Constructs a new OPC UA variant from other .

[noexcept] QOpcUaVariant:: QOpcUaVariant ( QOpcUaVariant && other )

Move-constructs a new OPC UA variant from other .

注意: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.

[noexcept] QOpcUaVariant:: ~QOpcUaVariant ()

Destroys this OPC UA variant.

QList < qint32 > QOpcUaVariant:: arrayDimensions () const

Returns the array dimensions of this OPC UA variant.

另请参阅 setArrayDimensions ().

bool QOpcUaVariant:: isArray () const

返回 true if this OPC UA variant contains an array value.

void QOpcUaVariant:: setArrayDimensions (const QList < qint32 > & arrayDimensions )

Sets the array dimensions to arrayDimensions .

另请参阅 arrayDimensions ().

void QOpcUaVariant:: setValue ( QOpcUaVariant::ValueType type , const QVariant & value )

Sets the value of this OPC UA variant to value and the type to type .

Scalar values must be passed as a QVariant containing a value of type . Array values must be passed as a QVariant 包含 QList of type .

另请参阅 value ().

void QOpcUaVariant:: setValue ( QOpcUaVariant::ValueType type , const QVariant & value , const QList < qint32 > & arrayDimensions )

Sets the value of this OPC UA variant to value , the type to type and the array dimensions to arrayDimensions .

Scalar values must be passed as a QVariant containing a value of type . Array values must be passed as a QVariant 包含 QList of type .

[noexcept] void QOpcUaVariant:: swap ( QOpcUaVariant & other )

Swaps enum definition object other with this OPC UA variant object. This operation is very fast and never fails.

QOpcUaVariant::ValueType QOpcUaVariant:: type () const

Returns the value type of this OPC UA variant.

QVariant QOpcUaVariant:: value () const

Returns the value of this OPC UA variant.

另请参阅 setValue ().

QVariant QOpcUaVariant:: operator QVariant () const

返回 QVariant containing this OPC UA variant.

[noexcept] QOpcUaVariant &QOpcUaVariant:: operator= ( QOpcUaVariant && other )

移动赋值 other 到此 QOpcUaVariant 实例。

注意: The moved-from object other is placed in a partially-formed state, in which the only valid operations are destruction and assignment of a new value.

QOpcUaVariant &QOpcUaVariant:: operator= (const QOpcUaVariant & rhs )

设置值从 rhs in this OPC UA variant.

相关非成员

[noexcept] bool operator!= (const QOpcUaVariant & lhs , const QOpcUaVariant & rhs )

返回 true if lhs 不等于 rhs .

[noexcept] bool operator== (const QOpcUaVariant & lhs , const QOpcUaVariant & rhs )

返回 true if lhs 等于 rhs .