mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
refs #126 null unit infrastructure, a sentinel to mark an uninitialized or unused physical quantity
This commit is contained in:
@@ -39,8 +39,7 @@ namespace BlackMisc
|
||||
*/
|
||||
double CMeasurementUnit::convertFrom(double value, const CMeasurementUnit &unit) const
|
||||
{
|
||||
Q_ASSERT(this->m_converter);
|
||||
Q_ASSERT(unit.m_converter);
|
||||
if (this->isNull() || unit.isNull()) return -1; // models the previous behaviour of using -1 as a sentinel value
|
||||
if (this->m_converter == unit.m_converter) return value;
|
||||
return this->m_converter->fromDefault(unit.m_converter->toDefault(value));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user