Ref T424, PQ strings without (thousand) separators

* separator can cause issue when sending data (WebService, FSD)
* re-parsing (print and parse again) can cause to undesired results as the separator is mistaken as decimal separator with a different locale
* separator now a parameter so it can still be used
This commit is contained in:
Klaus Basan
2018-11-04 00:33:12 +01:00
parent 7b209685dd
commit ef21ec67f3
6 changed files with 36 additions and 27 deletions

View File

@@ -47,11 +47,11 @@ namespace BlackMisc
*/
template <class MU, class PQ> class CPhysicalQuantity :
public Mixin::DBusOperators<CPhysicalQuantity<MU, PQ>>,
public Mixin::JsonOperators<CPhysicalQuantity<MU, PQ>>,
public Mixin::Index<PQ>,
public Mixin::MetaType<PQ>,
public Mixin::String<PQ>,
public Mixin::Icon<CPhysicalQuantity<MU, PQ>>
public Mixin::JsonOperators<CPhysicalQuantity<MU, PQ>>,
public Mixin::Index<PQ>,
public Mixin::MetaType<PQ>,
public Mixin::String<PQ>,
public Mixin::Icon<CPhysicalQuantity<MU, PQ>>
{
//! \copydoc CValueObject::compare
friend int compare(const PQ &a, const PQ &b) { return compareImpl(a, b); }
@@ -122,11 +122,11 @@ namespace BlackMisc
//! Value to QString with the given unit, e.g. "5.00m"
//! \note default digits is CMeasurementUnit::getDisplayDigits
QString valueRoundedWithUnit(const MU &unit, int digits = -1, bool i18n = false) const;
QString valueRoundedWithUnit(const MU &unit, int digits = -1, bool withGroupSeparator = false, bool i18n = false) const;
//! Value to QString with the current unit, e.g. "5.00m"
//! \note default digits is CMeasurementUnit::getDisplayDigits
QString valueRoundedWithUnit(int digits = -1, bool i18n = false) const;
QString valueRoundedWithUnit(int digits = -1, bool withGroupSeparator = false, bool i18n = false) const;
//! Round current value in current unit to epsilon
//! \sa CMeasurementUnit::roundToEpsilon