diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2024-02-27 15:46:42 +0100 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2024-03-01 10:39:31 +0100 |
commit | 1ecd5db64f9f4d0d5a57808934cde319625062b1 (patch) | |
tree | 422791abf62f0958ee10a4588c921a59c9042774 | |
parent | 0068a29f47542e9cee762883f066740c970f0c92 (diff) |
Rework newly-added relational operators
Do not export the hidden friend operator==().
Instead create a helper comparesEqual() hidden friend function and
export it.
This prepares for use of the comparison helper macros.
As a drive-by: move the relational operators to the private section.
Found in 6.7 API review.
Pick-to: 6.7
Change-Id: Id1a813f08bacdcf36417442f0a95774b0a9f7bdb
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
26 files changed, 134 insertions, 73 deletions
diff --git a/src/opcua/client/qopcuaattributeoperand.cpp b/src/opcua/client/qopcuaattributeoperand.cpp index c253d81..9760246 100644 --- a/src/opcua/client/qopcuaattributeoperand.cpp +++ b/src/opcua/client/qopcuaattributeoperand.cpp @@ -162,7 +162,7 @@ void QOpcUaAttributeOperand::setNodeId(const QString &nodeId) Returns \c true if \a lhs has the same value as \a rhs. */ -bool operator==(const QOpcUaAttributeOperand &lhs, const QOpcUaAttributeOperand &rhs) noexcept +bool comparesEqual(const QOpcUaAttributeOperand &lhs, const QOpcUaAttributeOperand &rhs) noexcept { return lhs.nodeId() == rhs.nodeId() && lhs.attributeId() == rhs.attributeId() && lhs.alias() == rhs.alias() && lhs.browsePath() == rhs.browsePath() && diff --git a/src/opcua/client/qopcuaattributeoperand.h b/src/opcua/client/qopcuaattributeoperand.h index 73963de..54f822a 100644 --- a/src/opcua/client/qopcuaattributeoperand.h +++ b/src/opcua/client/qopcuaattributeoperand.h @@ -43,13 +43,18 @@ public: QString indexRange() const; void setIndexRange(const QString &indexRange); - friend Q_OPCUA_EXPORT bool operator==(const QOpcUaAttributeOperand &lhs, const QOpcUaAttributeOperand &rhs) noexcept; - friend inline bool operator!=(const QOpcUaAttributeOperand &lhs, const QOpcUaAttributeOperand &rhs) noexcept +private: + friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaAttributeOperand &lhs, + const QOpcUaAttributeOperand &rhs) noexcept; + friend bool operator==(const QOpcUaAttributeOperand &lhs, + const QOpcUaAttributeOperand &rhs) noexcept + { return comparesEqual(lhs, rhs); } + friend bool operator!=(const QOpcUaAttributeOperand &lhs, + const QOpcUaAttributeOperand &rhs) noexcept { return !(lhs == rhs); } -private: QSharedDataPointer<QOpcUaAttributeOperandData> data; }; diff --git a/src/opcua/client/qopcuadatavalue.cpp b/src/opcua/client/qopcuadatavalue.cpp index 879411a..5c2ae20 100644 --- a/src/opcua/client/qopcuadatavalue.cpp +++ b/src/opcua/client/qopcuadatavalue.cpp @@ -199,7 +199,7 @@ void QOpcUaDataValue::setServerPicoseconds(quint16 serverPicoseconds) Returns \c true if \a lhs is equal to \a rhs. */ -bool operator==(const QOpcUaDataValue &lhs, const QOpcUaDataValue &rhs) noexcept +bool comparesEqual(const QOpcUaDataValue &lhs, const QOpcUaDataValue &rhs) noexcept { return lhs.data->serverTimestamp == rhs.data->serverTimestamp && lhs.data->serverPicoseconds == rhs.data->serverPicoseconds && diff --git a/src/opcua/client/qopcuadatavalue.h b/src/opcua/client/qopcuadatavalue.h index f382e1c..6df85dc 100644 --- a/src/opcua/client/qopcuadatavalue.h +++ b/src/opcua/client/qopcuadatavalue.h @@ -17,11 +17,6 @@ public: QOpcUaDataValue(); QOpcUaDataValue(const QOpcUaDataValue &other); QOpcUaDataValue &operator=(const QOpcUaDataValue &other); - friend Q_OPCUA_EXPORT bool operator==(const QOpcUaDataValue &lhs, const QOpcUaDataValue &rhs) noexcept; - friend inline bool operator!=(const QOpcUaDataValue &lhs, const QOpcUaDataValue &rhs) noexcept - { - return !(lhs == rhs); - } ~QOpcUaDataValue(); void swap(QOpcUaDataValue &other) noexcept @@ -49,6 +44,15 @@ public: private: QExplicitlySharedDataPointer<QOpcUaDataValueData> data; + + friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaDataValue &lhs, + const QOpcUaDataValue &rhs) noexcept; + friend bool operator==(const QOpcUaDataValue &lhs, const QOpcUaDataValue &rhs) noexcept + { return comparesEqual(lhs, rhs); } + friend bool operator!=(const QOpcUaDataValue &lhs, const QOpcUaDataValue &rhs) noexcept + { + return !(lhs == rhs); + } }; Q_DECLARE_SHARED(QOpcUaDataValue) diff --git a/src/opcua/client/qopcuadiagnosticinfo.cpp b/src/opcua/client/qopcuadiagnosticinfo.cpp index bb0bd41..174c720 100644 --- a/src/opcua/client/qopcuadiagnosticinfo.cpp +++ b/src/opcua/client/qopcuadiagnosticinfo.cpp @@ -113,7 +113,7 @@ QOpcUaDiagnosticInfo &QOpcUaDiagnosticInfo::operator=(const QOpcUaDiagnosticInfo Returns \c true if \a lhs is equal to \a rhs. */ -bool operator==(const QOpcUaDiagnosticInfo &lhs, const QOpcUaDiagnosticInfo &rhs) noexcept +bool comparesEqual(const QOpcUaDiagnosticInfo &lhs, const QOpcUaDiagnosticInfo &rhs) noexcept { if (lhs.hasSymbolicId() != rhs.hasSymbolicId() || (lhs.hasSymbolicId() && lhs.symbolicId() != rhs.symbolicId())) diff --git a/src/opcua/client/qopcuadiagnosticinfo.h b/src/opcua/client/qopcuadiagnosticinfo.h index 46c885c..e0b913c 100644 --- a/src/opcua/client/qopcuadiagnosticinfo.h +++ b/src/opcua/client/qopcuadiagnosticinfo.h @@ -26,11 +26,6 @@ public: { data.swap(other.data); } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QOpcUaDiagnosticInfo) - friend Q_OPCUA_EXPORT bool operator==(const QOpcUaDiagnosticInfo &lhs, const QOpcUaDiagnosticInfo &rhs) noexcept; - friend inline bool operator!=(const QOpcUaDiagnosticInfo &lhs, const QOpcUaDiagnosticInfo &rhs) noexcept - { - return !(lhs == rhs); - } Q_OPCUA_EXPORT operator QVariant() const; Q_OPCUA_EXPORT qint32 symbolicId() const; @@ -78,6 +73,17 @@ public: private: QExplicitlySharedDataPointer<QOpcUaDiagnosticInfoData> data; + + friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaDiagnosticInfo &lhs, + const QOpcUaDiagnosticInfo &rhs) noexcept; + friend bool operator==(const QOpcUaDiagnosticInfo &lhs, + const QOpcUaDiagnosticInfo &rhs) noexcept + { return comparesEqual(lhs, rhs); } + friend bool operator!=(const QOpcUaDiagnosticInfo &lhs, + const QOpcUaDiagnosticInfo &rhs) noexcept + { + return !(lhs == rhs); + } }; Q_DECLARE_SHARED(QOpcUaDiagnosticInfo) diff --git a/src/opcua/client/qopcuaelementoperand.cpp b/src/opcua/client/qopcuaelementoperand.cpp index 3d10c57..319bfdd 100644 --- a/src/opcua/client/qopcuaelementoperand.cpp +++ b/src/opcua/client/qopcuaelementoperand.cpp @@ -114,7 +114,7 @@ void QOpcUaElementOperand::setIndex(quint32 index) Returns \c true if \a lhs has the same value as \a rhs. */ -bool operator==(const QOpcUaElementOperand &lhs, const QOpcUaElementOperand &rhs) noexcept +bool comparesEqual(const QOpcUaElementOperand &lhs, const QOpcUaElementOperand &rhs) noexcept { return lhs.index() == rhs.index(); } diff --git a/src/opcua/client/qopcuaelementoperand.h b/src/opcua/client/qopcuaelementoperand.h index ec909dd..4545d3f 100644 --- a/src/opcua/client/qopcuaelementoperand.h +++ b/src/opcua/client/qopcuaelementoperand.h @@ -26,13 +26,18 @@ public: quint32 index() const; void setIndex(quint32 index); - friend Q_OPCUA_EXPORT bool operator==(const QOpcUaElementOperand &lhs, const QOpcUaElementOperand &rhs) noexcept; - friend inline bool operator!=(const QOpcUaElementOperand &lhs, const QOpcUaElementOperand &rhs) noexcept +private: + friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaElementOperand &lhs, + const QOpcUaElementOperand &rhs) noexcept; + friend bool operator==(const QOpcUaElementOperand &lhs, + const QOpcUaElementOperand &rhs) noexcept + { return comparesEqual(lhs, rhs); } + friend bool operator!=(const QOpcUaElementOperand &lhs, + const QOpcUaElementOperand &rhs) noexcept { return !(lhs == rhs); } -private: QSharedDataPointer<QOpcUaElementOperandData> data; }; diff --git a/src/opcua/client/qopcuaenumdefinition.cpp b/src/opcua/client/qopcuaenumdefinition.cpp index fd90971..a602d5d 100644 --- a/src/opcua/client/qopcuaenumdefinition.cpp +++ b/src/opcua/client/qopcuaenumdefinition.cpp @@ -92,7 +92,7 @@ QOpcUaEnumDefinition &QOpcUaEnumDefinition::operator=(const QOpcUaEnumDefinition Returns \c true if \a lhs is equal to \a rhs. */ -bool operator==(const QOpcUaEnumDefinition &lhs, const QOpcUaEnumDefinition &rhs) noexcept +bool comparesEqual(const QOpcUaEnumDefinition &lhs, const QOpcUaEnumDefinition &rhs) noexcept { return lhs.data->fields == rhs.fields(); } diff --git a/src/opcua/client/qopcuaenumdefinition.h b/src/opcua/client/qopcuaenumdefinition.h index a76b757..5459078 100644 --- a/src/opcua/client/qopcuaenumdefinition.h +++ b/src/opcua/client/qopcuaenumdefinition.h @@ -26,11 +26,6 @@ public: QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QOpcUaEnumDefinition) QOpcUaEnumDefinition(QOpcUaEnumDefinition &&other) noexcept = default; Q_OPCUA_EXPORT QOpcUaEnumDefinition &operator=(const QOpcUaEnumDefinition &rhs); - friend Q_OPCUA_EXPORT bool operator==(const QOpcUaEnumDefinition &lhs, const QOpcUaEnumDefinition &rhs) noexcept; - friend inline bool operator!=(const QOpcUaEnumDefinition &lhs, const QOpcUaEnumDefinition &rhs) noexcept - { - return !(lhs == rhs); - } Q_OPCUA_EXPORT operator QVariant() const; Q_OPCUA_EXPORT ~QOpcUaEnumDefinition(); @@ -39,6 +34,16 @@ public: private: QExplicitlySharedDataPointer<QOpcUaEnumDefinitionData> data; + + friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaEnumDefinition &lhs, + const QOpcUaEnumDefinition &rhs) noexcept; + friend bool operator==(const QOpcUaEnumDefinition &lhs, + const QOpcUaEnumDefinition &rhs) noexcept + { return comparesEqual(lhs, rhs); } + friend inline bool operator!=(const QOpcUaEnumDefinition &lhs, const QOpcUaEnumDefinition &rhs) noexcept + { + return !(lhs == rhs); + } }; Q_DECLARE_SHARED(QOpcUaEnumDefinition) diff --git a/src/opcua/client/qopcuaenumfield.cpp b/src/opcua/client/qopcuaenumfield.cpp index 48b9371..8a5ce28 100644 --- a/src/opcua/client/qopcuaenumfield.cpp +++ b/src/opcua/client/qopcuaenumfield.cpp @@ -94,7 +94,7 @@ QOpcUaEnumField &QOpcUaEnumField::operator=(const QOpcUaEnumField &rhs) Returns \c true if \a lhs is equal to \a rhs. */ -bool operator==(const QOpcUaEnumField &lhs, const QOpcUaEnumField &rhs) noexcept +bool comparesEqual(const QOpcUaEnumField &lhs, const QOpcUaEnumField &rhs) noexcept { return lhs.data->name == rhs.name(); } diff --git a/src/opcua/client/qopcuaenumfield.h b/src/opcua/client/qopcuaenumfield.h index 7ad39db..b38d2fa 100644 --- a/src/opcua/client/qopcuaenumfield.h +++ b/src/opcua/client/qopcuaenumfield.h @@ -28,11 +28,6 @@ public: QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QOpcUaEnumField) QOpcUaEnumField(QOpcUaEnumField &&other) noexcept = default; Q_OPCUA_EXPORT QOpcUaEnumField &operator=(const QOpcUaEnumField &rhs); - friend Q_OPCUA_EXPORT bool operator==(const QOpcUaEnumField &lhs, const QOpcUaEnumField &rhs) noexcept; - friend inline bool operator!=(const QOpcUaEnumField &lhs, const QOpcUaEnumField &rhs) noexcept - { - return !(lhs == rhs); - } Q_OPCUA_EXPORT operator QVariant() const; Q_OPCUA_EXPORT ~QOpcUaEnumField(); @@ -51,6 +46,15 @@ public: private: QExplicitlySharedDataPointer<QOpcUaEnumFieldData> data; + + friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaEnumField &lhs, + const QOpcUaEnumField &rhs) noexcept; + friend bool operator==(const QOpcUaEnumField &lhs, const QOpcUaEnumField &rhs) noexcept + { return comparesEqual(lhs, rhs); } + friend bool operator!=(const QOpcUaEnumField &lhs, const QOpcUaEnumField &rhs) noexcept + { + return !(lhs == rhs); + } }; Q_DECLARE_SHARED(QOpcUaEnumField) diff --git a/src/opcua/client/qopcuagenericstructvalue.cpp b/src/opcua/client/qopcuagenericstructvalue.cpp index 79107e2..f596c99 100644 --- a/src/opcua/client/qopcuagenericstructvalue.cpp +++ b/src/opcua/client/qopcuagenericstructvalue.cpp @@ -155,7 +155,7 @@ QOpcUaGenericStructValue &QOpcUaGenericStructValue::operator=(const QOpcUaGeneri Returns \c true if \a lhs is equal to \a rhs. */ -bool operator==(const QOpcUaGenericStructValue &lhs, const QOpcUaGenericStructValue &rhs) noexcept +bool comparesEqual(const QOpcUaGenericStructValue &lhs, const QOpcUaGenericStructValue &rhs) noexcept { return lhs.typeName() == rhs.typeName() && lhs.typeId() == rhs.typeId() && lhs.structureDefinition() == rhs.structureDefinition() && lhs.fields() == rhs.fields(); diff --git a/src/opcua/client/qopcuagenericstructvalue.h b/src/opcua/client/qopcuagenericstructvalue.h index 56863bf..7447119 100644 --- a/src/opcua/client/qopcuagenericstructvalue.h +++ b/src/opcua/client/qopcuagenericstructvalue.h @@ -34,11 +34,6 @@ public: { data.swap(other.data); } QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QOpcUaGenericStructValue) - friend Q_OPCUA_EXPORT bool operator==(const QOpcUaGenericStructValue &lhs, const QOpcUaGenericStructValue &rhs) noexcept; - friend inline bool operator!=(const QOpcUaGenericStructValue &lhs, const QOpcUaGenericStructValue &rhs) noexcept - { - return !(lhs == rhs); - } Q_OPCUA_EXPORT operator QVariant() const; Q_OPCUA_EXPORT QString typeName() const; @@ -62,6 +57,17 @@ public: private: QExplicitlySharedDataPointer<QOpcUaGenericStructValueData> data; + + friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaGenericStructValue &lhs, + const QOpcUaGenericStructValue &rhs) noexcept; + friend bool operator==(const QOpcUaGenericStructValue &lhs, + const QOpcUaGenericStructValue &rhs) noexcept + { return comparesEqual(lhs, rhs); } + friend bool operator!=(const QOpcUaGenericStructValue &lhs, + const QOpcUaGenericStructValue &rhs) noexcept + { + return !(lhs == rhs); + } }; Q_DECLARE_SHARED(QOpcUaGenericStructValue) diff --git a/src/opcua/client/qopcuahistoryevent.cpp b/src/opcua/client/qopcuahistoryevent.cpp index 7bca9f5..f605219 100644 --- a/src/opcua/client/qopcuahistoryevent.cpp +++ b/src/opcua/client/qopcuahistoryevent.cpp @@ -175,7 +175,7 @@ QOpcUaHistoryEvent &QOpcUaHistoryEvent::operator=(const QOpcUaHistoryEvent &othe Returns \c true if \a rhs and \a lhs contain the same values. */ -bool operator==(const QOpcUaHistoryEvent &lhs, const QOpcUaHistoryEvent &rhs) noexcept +bool comparesEqual(const QOpcUaHistoryEvent &lhs, const QOpcUaHistoryEvent &rhs) noexcept { return lhs.events() == rhs.events() && lhs.statusCode() == rhs.statusCode() && lhs.nodeId() == rhs.nodeId(); } diff --git a/src/opcua/client/qopcuahistoryevent.h b/src/opcua/client/qopcuahistoryevent.h index 9be2186..1060972 100644 --- a/src/opcua/client/qopcuahistoryevent.h +++ b/src/opcua/client/qopcuahistoryevent.h @@ -38,13 +38,16 @@ public: Q_OPCUA_EXPORT QString nodeId() const; Q_OPCUA_EXPORT void setNodeId(const QString &nodeId); - - friend Q_OPCUA_EXPORT bool operator==(const QOpcUaHistoryEvent &lhs, const QOpcUaHistoryEvent &rhs) noexcept; - friend inline bool operator!=(const QOpcUaHistoryEvent &lhs, const QOpcUaHistoryEvent &rhs) noexcept +private: + friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaHistoryEvent &lhs, + const QOpcUaHistoryEvent &rhs) noexcept; + friend bool operator==(const QOpcUaHistoryEvent &lhs, const QOpcUaHistoryEvent &rhs) noexcept + { return comparesEqual(lhs, rhs); } + friend bool operator!=(const QOpcUaHistoryEvent &lhs, const QOpcUaHistoryEvent &rhs) noexcept { return !(lhs == rhs); } -private: + QExplicitlySharedDataPointer<QOpcUaHistoryEventData> data; }; diff --git a/src/opcua/client/qopcuahistoryreadeventrequest.cpp b/src/opcua/client/qopcuahistoryreadeventrequest.cpp index 5d7e02b..96d7726 100644 --- a/src/opcua/client/qopcuahistoryreadeventrequest.cpp +++ b/src/opcua/client/qopcuahistoryreadeventrequest.cpp @@ -228,8 +228,8 @@ QOpcUaHistoryReadEventRequest &QOpcUaHistoryReadEventRequest::operator=(const QO Two QOpcUaHistoryReadEventRequest items are considered equal if their \c startTimestamp, \c endTimestamp, \c numValuesPerNode, \c filter and \c nodesToRead are equal. */ -bool operator==(const QOpcUaHistoryReadEventRequest &lhs, - const QOpcUaHistoryReadEventRequest &rhs) noexcept +bool comparesEqual(const QOpcUaHistoryReadEventRequest &lhs, + const QOpcUaHistoryReadEventRequest &rhs) noexcept { return (lhs.data->startTimestamp == rhs.data->startTimestamp && lhs.data->endTimestamp == rhs.data->endTimestamp && diff --git a/src/opcua/client/qopcuahistoryreadeventrequest.h b/src/opcua/client/qopcuahistoryreadeventrequest.h index 32fdde0..48ddb88 100644 --- a/src/opcua/client/qopcuahistoryreadeventrequest.h +++ b/src/opcua/client/qopcuahistoryreadeventrequest.h @@ -55,15 +55,18 @@ public: Q_OPCUA_EXPORT void addNodeToRead(const QOpcUaReadItem &nodeToRead); - friend Q_OPCUA_EXPORT bool operator==(const QOpcUaHistoryReadEventRequest &lhs, - const QOpcUaHistoryReadEventRequest &rhs) noexcept; - friend inline bool operator!=(const QOpcUaHistoryReadEventRequest &lhs, - const QOpcUaHistoryReadEventRequest &rhs) noexcept +private: + friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaHistoryReadEventRequest &lhs, + const QOpcUaHistoryReadEventRequest &rhs) noexcept; + friend bool operator==(const QOpcUaHistoryReadEventRequest &lhs, + const QOpcUaHistoryReadEventRequest &rhs) noexcept + { return comparesEqual(lhs, rhs); } + friend bool operator!=(const QOpcUaHistoryReadEventRequest &lhs, + const QOpcUaHistoryReadEventRequest &rhs) noexcept { return !(lhs == rhs); } -private: QExplicitlySharedDataPointer<QOpcUaHistoryReadEventRequestData> data; }; diff --git a/src/opcua/client/qopcualiteraloperand.cpp b/src/opcua/client/qopcualiteraloperand.cpp index e96f69f..3bab744 100644 --- a/src/opcua/client/qopcualiteraloperand.cpp +++ b/src/opcua/client/qopcualiteraloperand.cpp @@ -109,7 +109,7 @@ void QOpcUaLiteralOperand::setValue(const QVariant &value) Returns \c true if \a lhs has the same value as \a rhs. */ -bool operator==(const QOpcUaLiteralOperand &lhs, const QOpcUaLiteralOperand &rhs) noexcept +bool comparesEqual(const QOpcUaLiteralOperand &lhs, const QOpcUaLiteralOperand &rhs) noexcept { return lhs.value() == rhs.value() && lhs.type() == rhs.type(); } diff --git a/src/opcua/client/qopcualiteraloperand.h b/src/opcua/client/qopcualiteraloperand.h index 09cadf5..f6978ad 100644 --- a/src/opcua/client/qopcualiteraloperand.h +++ b/src/opcua/client/qopcualiteraloperand.h @@ -28,14 +28,18 @@ public: QOpcUa::Types type() const; void setType(QOpcUa::Types type); - friend Q_OPCUA_EXPORT bool operator==(const QOpcUaLiteralOperand &lhs, const QOpcUaLiteralOperand &rhs) noexcept; - friend inline bool operator!=(const QOpcUaLiteralOperand &lhs, const QOpcUaLiteralOperand &rhs) noexcept +private: + friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaLiteralOperand &lhs, + const QOpcUaLiteralOperand &rhs) noexcept; + friend bool operator==(const QOpcUaLiteralOperand &lhs, + const QOpcUaLiteralOperand &rhs) noexcept + { return comparesEqual(lhs, rhs); } + friend bool operator!=(const QOpcUaLiteralOperand &lhs, + const QOpcUaLiteralOperand &rhs) noexcept { return !(lhs == rhs); } - -private: QSharedDataPointer<QOpcUaLiteralOperandData> data; }; diff --git a/src/opcua/client/qopcuastructuredefinition.cpp b/src/opcua/client/qopcuastructuredefinition.cpp index c5691b7..395d35b 100644 --- a/src/opcua/client/qopcuastructuredefinition.cpp +++ b/src/opcua/client/qopcuastructuredefinition.cpp @@ -95,7 +95,7 @@ QOpcUaStructureDefinition &QOpcUaStructureDefinition::operator=(const QOpcUaStru Returns \c true if \a lhs is equal to \a rhs. */ -bool operator==(const QOpcUaStructureDefinition &lhs, const QOpcUaStructureDefinition &rhs) noexcept +bool comparesEqual(const QOpcUaStructureDefinition &lhs, const QOpcUaStructureDefinition &rhs) noexcept { return lhs.data->defaultEncodingId == rhs.defaultEncodingId() && lhs.data->baseDataType == rhs.baseDataType() && diff --git a/src/opcua/client/qopcuastructuredefinition.h b/src/opcua/client/qopcuastructuredefinition.h index f4c94df..911317c 100644 --- a/src/opcua/client/qopcuastructuredefinition.h +++ b/src/opcua/client/qopcuastructuredefinition.h @@ -27,11 +27,6 @@ public: QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QOpcUaStructureDefinition) QOpcUaStructureDefinition(QOpcUaStructureDefinition &&other) noexcept = default; Q_OPCUA_EXPORT QOpcUaStructureDefinition &operator=(const QOpcUaStructureDefinition &); - friend Q_OPCUA_EXPORT bool operator==(const QOpcUaStructureDefinition &lhs, const QOpcUaStructureDefinition &rhs) noexcept; - friend inline bool operator!=(const QOpcUaStructureDefinition &lhs, const QOpcUaStructureDefinition &rhs) noexcept - { - return !(lhs == rhs); - } Q_OPCUA_EXPORT operator QVariant() const; Q_OPCUA_EXPORT ~QOpcUaStructureDefinition(); @@ -55,6 +50,17 @@ public: private: QExplicitlySharedDataPointer<QOpcUaStructureDefinitionData> data; + + friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaStructureDefinition &lhs, + const QOpcUaStructureDefinition &rhs) noexcept; + friend bool operator==(const QOpcUaStructureDefinition &lhs, + const QOpcUaStructureDefinition &rhs) noexcept + { return comparesEqual(lhs, rhs); } + friend bool operator!=(const QOpcUaStructureDefinition &lhs, + const QOpcUaStructureDefinition &rhs) noexcept + { + return !(lhs == rhs); + } }; Q_DECLARE_SHARED(QOpcUaStructureDefinition) diff --git a/src/opcua/client/qopcuastructurefield.cpp b/src/opcua/client/qopcuastructurefield.cpp index 41993d2..2491ca2 100644 --- a/src/opcua/client/qopcuastructurefield.cpp +++ b/src/opcua/client/qopcuastructurefield.cpp @@ -98,7 +98,7 @@ QOpcUaStructureField &QOpcUaStructureField::operator=(const QOpcUaStructureField Returns \c true \a lhs is equal to \a rhs. */ -bool operator==(const QOpcUaStructureField &lhs, const QOpcUaStructureField &rhs) noexcept +bool comparesEqual(const QOpcUaStructureField &lhs, const QOpcUaStructureField &rhs) noexcept { return lhs.data->name == rhs.name() && lhs.data->description == rhs.description() && diff --git a/src/opcua/client/qopcuastructurefield.h b/src/opcua/client/qopcuastructurefield.h index 556af76..fcab68a 100644 --- a/src/opcua/client/qopcuastructurefield.h +++ b/src/opcua/client/qopcuastructurefield.h @@ -27,11 +27,6 @@ public: QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QOpcUaStructureField) QOpcUaStructureField(QOpcUaStructureField &&other) noexcept = default; Q_OPCUA_EXPORT QOpcUaStructureField &operator=(const QOpcUaStructureField &rhs); - friend Q_OPCUA_EXPORT bool operator==(const QOpcUaStructureField &lhs, const QOpcUaStructureField &rhs) noexcept; - friend inline bool operator!=(const QOpcUaStructureField &lhs, const QOpcUaStructureField &rhs) noexcept - { - return !(lhs == rhs); - } Q_OPCUA_EXPORT operator QVariant() const; Q_OPCUA_EXPORT ~QOpcUaStructureField(); @@ -58,6 +53,17 @@ public: private: QExplicitlySharedDataPointer<QOpcUaStructureFieldData> data; + + friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaStructureField &lhs, + const QOpcUaStructureField &rhs) noexcept; + friend bool operator==(const QOpcUaStructureField &lhs, + const QOpcUaStructureField &rhs) noexcept + { return comparesEqual(lhs, rhs); } + friend inline bool operator!=(const QOpcUaStructureField &lhs, + const QOpcUaStructureField &rhs) noexcept + { + return !(lhs == rhs); + } }; Q_DECLARE_SHARED(QOpcUaStructureField) diff --git a/src/opcua/client/qopcuavariant.cpp b/src/opcua/client/qopcuavariant.cpp index 7e894c8..c2c1cb1 100644 --- a/src/opcua/client/qopcuavariant.cpp +++ b/src/opcua/client/qopcuavariant.cpp @@ -146,7 +146,7 @@ QOpcUaVariant &QOpcUaVariant::operator=(const QOpcUaVariant &rhs) } -bool operator==(const QOpcUaVariant &lhs, const QOpcUaVariant &rhs) noexcept +bool comparesEqual(const QOpcUaVariant &lhs, const QOpcUaVariant &rhs) noexcept { return lhs.data->value == rhs.data->value && lhs.data->valueType == rhs.data->valueType && diff --git a/src/opcua/client/qopcuavariant.h b/src/opcua/client/qopcuavariant.h index da16339..39a55a6 100644 --- a/src/opcua/client/qopcuavariant.h +++ b/src/opcua/client/qopcuavariant.h @@ -59,11 +59,6 @@ public: 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(ValueType type, const QVariant &value, bool isArray = false, @@ -77,6 +72,15 @@ public: private: QExplicitlySharedDataPointer<QOpcUaVariantData> data; + + friend Q_OPCUA_EXPORT bool comparesEqual(const QOpcUaVariant &lhs, + const QOpcUaVariant &rhs) noexcept; + friend bool operator==(const QOpcUaVariant &lhs, const QOpcUaVariant &rhs) noexcept + { return comparesEqual(lhs, rhs); } + friend bool operator!=(const QOpcUaVariant &lhs, const QOpcUaVariant &rhs) noexcept + { + return !(lhs == rhs); + } }; Q_DECLARE_SHARED(QOpcUaVariant) |