mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 23:25:53 +08:00
refs #413 CVariant and CPropertyIndexVariantMap equality operator templates support any metatype-registered class, not just CValueObject subclasses.
This commit is contained in:
@@ -116,22 +116,22 @@ namespace BlackMisc
|
||||
|
||||
//! Operator == with CValueObject
|
||||
//! \todo Still needed?
|
||||
template <class T, class = typename std::enable_if<IsValueObject<T>::value>::type>
|
||||
template <class T, class = typename std::enable_if<QMetaTypeId<T>::Defined>::type>
|
||||
friend bool operator ==(const CPropertyIndexVariantMap &valueMap, const T &valueObject) { return valueMap == CVariant::from(valueObject); }
|
||||
|
||||
//! Operator != with CValueObject
|
||||
//! \todo Still needed?
|
||||
template <class T, class = typename std::enable_if<IsValueObject<T>::value>::type>
|
||||
template <class T, class = typename std::enable_if<QMetaTypeId<T>::Defined>::type>
|
||||
friend bool operator !=(const CPropertyIndexVariantMap &valueMap, const T &valueObject) { return valueMap != CVariant::from(valueObject); }
|
||||
|
||||
//! Operator == with CValueObject
|
||||
//! \todo Still needed?
|
||||
template <class T, class = typename std::enable_if<IsValueObject<T>::value>::type>
|
||||
template <class T, class = typename std::enable_if<QMetaTypeId<T>::Defined>::type>
|
||||
friend bool operator ==(const T &valueObject, const CPropertyIndexVariantMap &valueMap) { return valueMap == CVariant::from(valueObject); }
|
||||
|
||||
//! Operator != with CValueObject
|
||||
//! \todo Still needed?
|
||||
template <class T, class = typename std::enable_if<IsValueObject<T>::value>::type>
|
||||
template <class T, class = typename std::enable_if<QMetaTypeId<T>::Defined>::type>
|
||||
friend bool operator !=(const T &valueObject, const CPropertyIndexVariantMap &valueMap) { return valueMap != CVariant::from(valueObject); }
|
||||
|
||||
//! Map
|
||||
|
||||
@@ -239,7 +239,7 @@ namespace BlackMisc
|
||||
};
|
||||
|
||||
//! Compare stored value of CVariant with any CValueObject derived class.
|
||||
template <class T, class = typename std::enable_if<IsValueObject<T>::value>::type>
|
||||
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; }
|
||||
@@ -247,21 +247,21 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
//! Compare stored value of CVariant with any CValueObject derived class.
|
||||
template <class T, class = typename std::enable_if<IsValueObject<T>::value>::type>
|
||||
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<IsValueObject<T>::value>::type>
|
||||
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<IsValueObject<T>::value>::type>
|
||||
template <class T, class = typename std::enable_if<QMetaTypeId<T>::Defined>::type>
|
||||
bool operator !=(const CVariant &variant, const T &value)
|
||||
{
|
||||
return !(value == variant);
|
||||
|
||||
Reference in New Issue
Block a user