implementing UnitsCalculator and disable changes in Sketcher

This commit is contained in:
jriegel
2013-11-09 07:34:56 +01:00
parent 33242fd8d7
commit ae8898561a
9 changed files with 221 additions and 15 deletions

View File

@@ -120,6 +120,35 @@ double Quantity::getUserPrefered(QString &unitString)const
return Base::UnitsApi::schemaPrefUnit(_Unit,unitString).getValue() * _Value;
}
std::string Quantity::getUserString(void)const
{
std::stringstream sstream;
sstream << _Value << _Unit.getString();
//TODO: implementing
return sstream.str();
}
/// true if it has a number without a unit
bool Quantity::isDimensionless(void)const
{
return _Value != DOUBLE_MIN && _Unit.isEmpty();
}
// true if it has a number and a valid unit
bool Quantity::isQuantity(void)const
{
return _Value != DOUBLE_MIN && !_Unit.isEmpty();
}
// true if it has a number with or without a unit
bool Quantity::isValid(void)const
{
return _Value != DOUBLE_MIN ;
}
void Quantity::setInvalid(void)
{
_Value = DOUBLE_MIN ;
}
// === Parser & Scanner stuff ===============================================
// include the Scanner and the Parser for the Quantitys