using hashes to perform comparisons between blackmisc value objects stored inside of QVariant

refs #81
This commit is contained in:
Klaus Basan
2013-12-22 20:40:30 +00:00
committed by Mathew Sutcliffe
parent 67a5dbfe48
commit a280d239e6
22 changed files with 416 additions and 0 deletions

View File

@@ -71,6 +71,18 @@ namespace BlackMisc
return LATorLON(a);
}
/*
* Compare
*/
template <class LATorLON> int CEarthAngle<LATorLON>::compare(const QVariant &qv) const
{
Q_ASSERT(qv.canConvert<LATorLON>() || qv.canConvert<CAngle>());
Q_ASSERT(qv.isValid() && !qv.isNull());
if (qv.canConvert<LATorLON>())
return this->toAngle().compare(qv.value<LATorLON>().toAngle());
else
return this->toAngle().compare(qv.value<CAngle>());
}
// see here for the reason of thess forward instantiations
// http://www.parashift.com/c++-faq/separate-template-class-defn-from-decl.html