mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-27 02:55:44 +08:00
refs #434 Removed CVariant comparison operator templates.
This commit is contained in:
@@ -291,35 +291,6 @@ namespace BlackMisc
|
|||||||
uint getValueHash() const;
|
uint getValueHash() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Compare stored value of CVariant with any CValueObject derived class.
|
|
||||||
template <class T, class = typename std::enable_if<QMetaTypeId<T>::Defined>::type>
|
|
||||||
bool operator ==(const T &value, const CVariant &variant)
|
|
||||||
{
|
|
||||||
if (variant.canConvert<T>()) { return variant.value<T>() == value; }
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Compare stored value of CVariant with any CValueObject derived class.
|
|
||||||
template <class T, class = typename std::enable_if<QMetaTypeId<T>::Defined>::type>
|
|
||||||
bool operator !=(const T &value, const CVariant &variant)
|
|
||||||
{
|
|
||||||
return !(value == variant);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Compare stored value of CVariant with any CValueObject derived class.
|
|
||||||
template <class T, class = typename std::enable_if<QMetaTypeId<T>::Defined>::type>
|
|
||||||
bool operator ==(const CVariant &variant, const T &value)
|
|
||||||
{
|
|
||||||
return value == variant;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Compare stored value of CVariant with any CValueObject derived class.
|
|
||||||
template <class T, class = typename std::enable_if<QMetaTypeId<T>::Defined>::type>
|
|
||||||
bool operator !=(const CVariant &variant, const T &value)
|
|
||||||
{
|
|
||||||
return !(value == variant);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Private
|
namespace Private
|
||||||
{
|
{
|
||||||
//! \private Needed so we can copy forward-declared CVariant.
|
//! \private Needed so we can copy forward-declared CVariant.
|
||||||
|
|||||||
@@ -64,10 +64,10 @@ namespace BlackMiscTest
|
|||||||
|
|
||||||
QVERIFY2(station1 == station2, "Station should be equal");
|
QVERIFY2(station1 == station2, "Station should be equal");
|
||||||
QVERIFY2(station1 != station3, "Station should not be equal");
|
QVERIFY2(station1 != station3, "Station should not be equal");
|
||||||
QVERIFY2(station1qv == station1, "Station should be equal (CVariant)");
|
QVERIFY2(station1qv == CVariant::from(station1), "Station should be equal (CVariant)");
|
||||||
QVERIFY2(station1 == station1qv, "Station should be equal (CVariant)");
|
QVERIFY2(CVariant::from(station1) == station1qv, "Station should be equal (CVariant)");
|
||||||
QVERIFY2(station2 == station1qv, "Station should be equal (CVariant)");
|
QVERIFY2(CVariant::from(station2) == station1qv, "Station should be equal (CVariant)");
|
||||||
QVERIFY2(station3 != station1qv, "Station should be equal (CVariant)");
|
QVERIFY2(CVariant::from(station3) != station1qv, "Station should be equal (CVariant)");
|
||||||
|
|
||||||
QVERIFY2(compare(station1, station1) == 0, "Station should be equal");
|
QVERIFY2(compare(station1, station1) == 0, "Station should be equal");
|
||||||
QVERIFY2(compare(station1, station2) == 0, "Station should be equal");
|
QVERIFY2(compare(station1, station2) == 0, "Station should be equal");
|
||||||
|
|||||||
Reference in New Issue
Block a user