fixes #0002460: Use keyword 'explicit' for Quantity constructor
This commit is contained in:
@@ -92,16 +92,42 @@ bool Quantity::operator >(const Quantity& that) const
|
||||
return (this->_Value > that._Value) ;
|
||||
}
|
||||
|
||||
bool Quantity::operator <=(const Quantity& that) const
|
||||
{
|
||||
if (this->_Unit != that._Unit)
|
||||
throw Base::Exception("Quantity::operator <=(): quantities need to have same unit to compare");
|
||||
|
||||
return (this->_Value <= that._Value) ;
|
||||
}
|
||||
|
||||
bool Quantity::operator >=(const Quantity& that) const
|
||||
{
|
||||
if (this->_Unit != that._Unit)
|
||||
throw Base::Exception("Quantity::operator >=(): quantities need to have same unit to compare");
|
||||
|
||||
return (this->_Value >= that._Value) ;
|
||||
}
|
||||
|
||||
Quantity Quantity::operator *(const Quantity &p) const
|
||||
{
|
||||
return Quantity(this->_Value * p._Value,this->_Unit * p._Unit);
|
||||
}
|
||||
|
||||
Quantity Quantity::operator *(double p) const
|
||||
{
|
||||
return Quantity(this->_Value * p,this->_Unit);
|
||||
}
|
||||
|
||||
Quantity Quantity::operator /(const Quantity &p) const
|
||||
{
|
||||
return Quantity(this->_Value / p._Value,this->_Unit / p._Unit);
|
||||
}
|
||||
|
||||
Quantity Quantity::operator /(double p) const
|
||||
{
|
||||
return Quantity(this->_Value / p,this->_Unit);
|
||||
}
|
||||
|
||||
Quantity Quantity::pow(const Quantity &p) const
|
||||
{
|
||||
if (!p._Unit.isEmpty())
|
||||
@@ -112,6 +138,13 @@ Quantity Quantity::pow(const Quantity &p) const
|
||||
);
|
||||
}
|
||||
|
||||
Quantity Quantity::pow(double p) const
|
||||
{
|
||||
return Quantity(
|
||||
std::pow(this->_Value, p), this->_Unit
|
||||
);
|
||||
}
|
||||
|
||||
Quantity Quantity::operator +(const Quantity &p) const
|
||||
{
|
||||
if (this->_Unit != p._Unit)
|
||||
@@ -329,7 +362,6 @@ int QuantityLexer(void);
|
||||
|
||||
Quantity Quantity::parse(const QString &string)
|
||||
{
|
||||
|
||||
// parse from buffer
|
||||
QuantityParser::YY_BUFFER_STATE my_string_buffer = QuantityParser::yy_scan_string (string.toUtf8().data());
|
||||
// set the global return variables
|
||||
|
||||
Reference in New Issue
Block a user