refs #434 CPropertyIndexVariantMap: removed operator templates and replaced CVariant comparison operators with a named method, matches().

This commit is contained in:
Mathew Sutcliffe
2015-06-01 21:06:43 +01:00
parent e76015004b
commit ada03ee513
5 changed files with 35 additions and 52 deletions

View File

@@ -31,10 +31,10 @@ namespace BlackMisc
return !(b == a);
}
bool operator==(const CPropertyIndexVariantMap &indexMap, const CVariant &variant)
bool CPropertyIndexVariantMap::matchesVariant(const CVariant &variant) const
{
if (indexMap.isEmpty()) return indexMap.isWildcard();
const auto &map = indexMap.map();
if (this->isEmpty()) return this->isWildcard();
const auto &map = this->map();
for (auto it = map.begin(); it != map.end(); ++it)
{
// QVariant cannot be compared directly
@@ -45,21 +45,6 @@ namespace BlackMisc
return true;
}
bool operator!=(const CPropertyIndexVariantMap &indexMap, const CVariant &variant)
{
return !(indexMap == variant);
}
bool operator==(const CVariant &variant, const CPropertyIndexVariantMap &valueMap)
{
return valueMap == variant;
}
bool operator!=(const CVariant &variant, const CPropertyIndexVariantMap &valueMap)
{
return !(valueMap == variant);
}
QString CPropertyIndexVariantMap::convertToQString(bool i18n) const
{
if (this->isEmpty()) return QString("{wildcard: %1}").arg(this->m_wildcard ? "true" : "false");