Move Math constants into class (to be consistent with other constants), tested against minGW / gcc 4.7.2 and fixed various issues (mainly initializer lists, unused variables). BlackMisc compiles now in MinGW, but still issues (especially with qDebug() friend methods)

This commit is contained in:
Klaus Basan
2013-04-29 16:00:41 +02:00
parent 7c7ca2dfae
commit c6426a0759
48 changed files with 1034 additions and 920 deletions

View File

@@ -20,14 +20,13 @@ namespace PhysicalQuantities
{
/*!
* \brief A physical quantity such as "5m", "20s", "1500ft/s"
* \author KWB
*/
template <class MU, class PQ> class CPhysicalQuantity : public BlackMisc::CBaseStreamStringifier<PQ>
{
private:
qint32 m_unitValueI; //!< value backed by integer, allows sole integer arithmetic
double m_unitValueD; //!< value backed by double
qint32 m_unitValueI; //!< value backed by integer, allows sole integer arithmetic
double m_convertedSiUnitValueD; //!< SI unit value
bool m_isIntegerBaseValue; //!< flag integer? / double?
@@ -383,6 +382,33 @@ public:
*/
PQ operator -(const PQ &otherQuantity) const;
/*!
* \brief Quantity value <= epsilon
* \return
*/
bool isZeroEpsilon() const
{
if (this->m_isIntegerBaseValue) return this->m_unitValueI == 0;
return this->m_unit.isEpsilon(this->m_unitValueD);
}
/*!
* \brief Value >= 0 epsilon considered
* \return
*/
bool isGreaterOrEqualZeroEpsilon() const
{
return this->isZeroEpsilon() || this->m_unitValueD > 0;
}
/*!
* \brief Value <= 0 epsilon considered
* \return
*/
bool isLessOrEqualZeroEpsilon() const
{
return this->isZeroEpsilon() || this->m_unitValueD < 0;
}
};
} // namespace