refs #212, methods for parsing values

* PQ, set by other PQ
* PQ, set NULL
* PQ, CPqTime, implemented parse to string
* CPqTime to QTime
This commit is contained in:
Klaus Basan
2014-04-26 15:21:43 +02:00
parent adfeeba19d
commit ccb3600c6f
4 changed files with 81 additions and 4 deletions

View File

@@ -151,8 +151,8 @@ namespace BlackMisc
}
/*
* Multiply operator
*/
* Multiply operator
*/
template <class MU, class PQ> PQ CPhysicalQuantity<MU, PQ>::operator *(double factor) const
{
PQ copy = *derived();
@@ -306,6 +306,16 @@ namespace BlackMisc
this->m_value = json.value("value").toDouble();
}
/*
* Parse from string
*/
template <class MU, class PQ> void CPhysicalQuantity<MU, PQ>::parseFromString(const QString &value)
{
PQ parsed = CPqString::parse<PQ>(value);
this->m_value = parsed.m_value;
this->m_unit = parsed.m_unit;
}
/*
* metaTypeId
*/
@@ -320,7 +330,6 @@ namespace BlackMisc
template <class MU, class PQ> bool CPhysicalQuantity<MU, PQ>::isA(int metaTypeId) const
{
if (metaTypeId == qMetaTypeId<PQ>()) { return true; }
return this->CValueObject::isA(metaTypeId);
}