QCborMap: add missing comparator to QCborValueConstRef
And ensure all combination of CBOR types are tested. Amends e5ebb9022ab9e00ab01d0bce527755da77083217 Change-Id: I5f663c2f9f4149af84fefffd17c02d352cd41f3f Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
This commit is contained in:
parent
a30912b906
commit
facb6f9477
@ -19,7 +19,7 @@ using namespace QtCbor;
|
|||||||
\brief The QCborMap class is used to hold an associative container representable in CBOR.
|
\brief The QCborMap class is used to hold an associative container representable in CBOR.
|
||||||
|
|
||||||
\compares strong
|
\compares strong
|
||||||
\compareswith strong QCborValue
|
\compareswith strong QCborValue QCborValueConstRef
|
||||||
\endcompareswith
|
\endcompareswith
|
||||||
|
|
||||||
This class can be used to hold an associative container in CBOR, a map
|
This class can be used to hold an associative container in CBOR, a map
|
||||||
|
@ -326,6 +326,19 @@ private:
|
|||||||
}
|
}
|
||||||
Q_DECLARE_STRONGLY_ORDERED(QCborMap, QCborValue)
|
Q_DECLARE_STRONGLY_ORDERED(QCborMap, QCborValue)
|
||||||
|
|
||||||
|
friend bool comparesEqual(const QCborMap &lhs, const QCborValueConstRef &rhs) noexcept
|
||||||
|
{
|
||||||
|
return lhs.compare(rhs.toMap()) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend Qt::strong_ordering compareThreeWay(const QCborMap &lhs,
|
||||||
|
const QCborValueConstRef &rhs) noexcept
|
||||||
|
{
|
||||||
|
int c = lhs.compare(rhs.toMap());
|
||||||
|
return Qt::compareThreeWay(c, 0);
|
||||||
|
}
|
||||||
|
Q_DECLARE_STRONGLY_ORDERED(QCborMap, QCborValueConstRef)
|
||||||
|
|
||||||
explicit QCborMap(QCborContainerPrivate &dd) noexcept;
|
explicit QCborMap(QCborContainerPrivate &dd) noexcept;
|
||||||
QExplicitlySharedDataPointer<QCborContainerPrivate> d;
|
QExplicitlySharedDataPointer<QCborContainerPrivate> d;
|
||||||
};
|
};
|
||||||
|
@ -452,17 +452,25 @@ void tst_QCborValue::extendedTypes_data()
|
|||||||
|
|
||||||
void tst_QCborValue::compareCompiles()
|
void tst_QCborValue::compareCompiles()
|
||||||
{
|
{
|
||||||
|
// homogeneous types
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QCborValue>();
|
QTestPrivate::testAllComparisonOperatorsCompile<QCborValue>();
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QCborValueRef>();
|
QTestPrivate::testAllComparisonOperatorsCompile<QCborValueRef>();
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QCborValueConstRef>();
|
QTestPrivate::testAllComparisonOperatorsCompile<QCborValueConstRef>();
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QCborArray>();
|
QTestPrivate::testAllComparisonOperatorsCompile<QCborArray>();
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QCborMap>();
|
QTestPrivate::testAllComparisonOperatorsCompile<QCborMap>();
|
||||||
|
|
||||||
|
// QCborValue, Ref and ConstRef
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QCborValueRef, QCborValueConstRef>();
|
QTestPrivate::testAllComparisonOperatorsCompile<QCborValueRef, QCborValueConstRef>();
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QCborValueConstRef, QCborValue>();
|
QTestPrivate::testAllComparisonOperatorsCompile<QCborValueConstRef, QCborValue>();
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QCborValueRef, QCborValue>();
|
QTestPrivate::testAllComparisonOperatorsCompile<QCborValueRef, QCborValue>();
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QCborValueConstRef, QCborArray>();
|
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QCborValueRef, QCborArray>();
|
// QCbor{Array,Map} <=> QCborValue{,Ref,ConstRef}
|
||||||
|
QTestPrivate::testAllComparisonOperatorsCompile<QCborArray, QCborValue>();
|
||||||
|
QTestPrivate::testAllComparisonOperatorsCompile<QCborArray, QCborValueRef>();
|
||||||
|
QTestPrivate::testAllComparisonOperatorsCompile<QCborArray, QCborValueConstRef>();
|
||||||
QTestPrivate::testAllComparisonOperatorsCompile<QCborMap, QCborValue>();
|
QTestPrivate::testAllComparisonOperatorsCompile<QCborMap, QCborValue>();
|
||||||
|
QTestPrivate::testAllComparisonOperatorsCompile<QCborMap, QCborValueRef>();
|
||||||
|
QTestPrivate::testAllComparisonOperatorsCompile<QCborMap, QCborValueConstRef>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QCborValue::extendedTypes()
|
void tst_QCborValue::extendedTypes()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user