swift
Loading...
Searching...
No Matches
swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ > Class Template Reference

A physical quantity such as "5m", "20s", "1500ft/s". More...

#include <physicalquantity.h>

Inheritance diagram for swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >:
[legend]

Public Types

enum  ColumnIndex {
  IndexUnit = CPropertyIndexRef::GlobalIndexCPhysicalQuantity , IndexValue , IndexValueRounded0DigitsWithUnit , IndexValueRounded1DigitsWithUnit ,
  IndexValueRounded2DigitsWithUnit , IndexValueRounded3DigitsWithUnit , IndexValueRounded6DigitsWithUnit
}
 Index. More...
Public Types inherited from swift::misc::mixin::Index< PQ >
enum  ColumnIndex
 Base class enums. More...

Public Member Functions

const MU & getUnit () const
 Unit.
void setUnit (const MU &unit)
 Simply set unit, do no calclulate conversion.
void setUnitBySymbol (const QString &unitName)
 Set unit by string.
QString getUnitSymbol () const
 Unit.
PQ & switchUnit (const MU &newUnit)
 Change unit, and convert value to maintain the same quantity.
PQ switchedUnit (const MU &newUnit) const
 Return copy with switched unit.
bool isNull () const
 Is quantity null?
void setNull ()
 Set null.
double value (MU unit) const
 Value in given unit.
double value () const
 Value in current unit.
void setCurrentUnitValue (double value)
 Set value in current unit.
int valueInteger (MU unit) const
 As integer value.
QString valueIntegerAsString (MU unit) const
 As integer value.
int valueInteger () const
 As integer value in current unit.
QString valueIntegerAsString () const
 As integer value in current unit.
bool isInteger () const
 Is value an integer.
double valueRounded (MU unit, int digits=-1) const
 Rounded value in given unit.
double valueRounded (int digits=-1) const
 Rounded value in current unit.
QString valueRoundedAsString (MU unit, int digits=-1) const
 Rounded value in given unit.
QString valueRoundedWithUnit (const MU &unit, int digits=-1, bool withGroupSeparator=false, bool i18n=false) const
 Value to QString with the given unit, e.g. "5.00m".
QString valueRoundedWithUnit (int digits=-1, bool withGroupSeparator=false, bool i18n=false) const
 Value to QString with the current unit, e.g. "5.00m".
void roundToEpsilon ()
 Round current value in current unit to epsilon.
void setValueSameUnit (double value)
 Change value without changing unit.
void addValueSameUnit (double value)
 Add to the value in the current unit.
void substractValueSameUnit (double value)
 Substract from the value in the current unit.
CPhysicalQuantity & operator*= (double multiply)
 Multiply operator *=.
CPhysicalQuantity & operator/= (double divide)
 Divide operator /=.
PQ operator* (double multiply) const
 Operator *.
PQ operator/ (double divide) const
 Operator /.
PQ operator- () const
 Unary operator -.
CPhysicalQuantity & operator+= (const CPhysicalQuantity &other)
 Plus operator +=.
CPhysicalQuantity & operator-= (const CPhysicalQuantity &other)
 Minus operator-=.
bool isZeroEpsilonConsidered () const
 Quantity value <= epsilon.
bool isPositiveWithEpsilonConsidered () const
 Value >= 0 epsilon considered.
bool isNegativeWithEpsilonConsidered () const
 Value <= 0 epsilon considered.
const PQ & makePositive ()
 Make value always positive.
const PQ & makeNegative ()
 Make value always negative.
PQ abs () const
 Absolute value (always >=0).
void marshallToDbus (QDBusArgument &argument) const
 Marshall without begin/endStructure, for when composed within another object.
void unmarshallFromDbus (const QDBusArgument &argument)
 Unmarshall without begin/endStructure, for when composed within another object.
void marshallToDbus (QDBusArgument &argument, LosslessTag) const
 Marshal to DBus, preserving the measurement unit.
void unmarshallFromDbus (const QDBusArgument &argument, LosslessTag)
 Unmarshal from DBus, with preserved measurement unit.
void marshalToDataStream (QDataStream &stream) const
 Marshal a value to a QDataStream.
void unmarshalFromDataStream (QDataStream &stream)
 Unmarshal a value from a QDataStream.
size_t getValueHash () const
 qHash overload, needed for storing value in a QSet.
QJsonObject toJson () const
 Cast to JSON object.
void convertFromJson (const QJsonObject &json)
 Assign from JSON object.
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index.
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
int comparePropertyByIndex (CPropertyIndexRef index, const PQ &pq) const
 Compare for index.
QString convertToQString (bool i18n=false) const
 Cast as QString.
void parseFromString (const QString &value)
 Parse value from string.
void parseFromString (const QString &value, CPqString::SeparatorMode mode)
 Parse to string, with specified separator.
void parseFromString (const QString &value, CPqString::SeparatorMode mode, const MU &defaultUnitIfMissing)
 Parse to string, with specified separator.
int compare (const PQ &other) const
 Compare with other PQ.
Public Member Functions inherited from swift::misc::mixin::Index< PQ >
CPropertyIndexList apply (const CPropertyIndexVariantMap &indexMap, bool skipEqualValues=false)
 Update by variant map.
void setPropertyByIndex (CPropertyIndexRef index, const QVariant &variant)
 Set property by index.
QVariant propertyByIndex (CPropertyIndexRef index) const
 Property by index.
int comparePropertyByIndex (CPropertyIndexRef index, const PQ &compareValue) const
 Compare for index.
bool equalsPropertyByIndex (const QVariant &compareValue, CPropertyIndexRef index) const
 Is given variant equal to value of property index?
Public Member Functions inherited from swift::misc::mixin::MetaType< PQ >
int getMetaTypeId () const
 Returns the Qt meta type ID of this object.
QString getClassName () const
 Class name.
bool isA (int metaTypeId) const
 Returns true if this object is an instance of the class with the given meta type ID, or one of its subclasses.
Public Member Functions inherited from swift::misc::mixin::String< PQ >
QString toQString (bool i18n=false) const
 Cast as QString.
std::string toStdString (bool i18n=false) const
 To std string.
QString stringForStreaming () const
 String for streaming operators.
Public Member Functions inherited from swift::misc::mixin::Icon< CPhysicalQuantity< MU, PQ > >
CIcons::CIcons::StandardIconUnknown16 toIcon () const
 As icon, not implemented by all classes.

Static Public Member Functions

static const PQ & maxValue (const PQ &pq1, const PQ &pq2)
 Maximum of 2 quantities.
static const PQ & minValue (const PQ &pq1, const PQ &pq2)
 Minimum of 2 quantities.
static int compare (const PQ &a, const PQ &b)
 Implementation of compare.
static const PQ & null ()
 NULL PQ.
static PQ parsedFromString (const QString &value, CPqString::SeparatorMode mode=CPqString::SeparatorBestGuess)
 Parsed from given string.
static PQ parsedFromString (const QString &value, CPqString::SeparatorMode mode, const MU &defaultUnitIfMissing)
 Parsed from given string.
Static Public Member Functions inherited from swift::misc::mixin::MetaType< PQ >
static void registerMetadata ()
 Register metadata.

Protected Member Functions

 CPhysicalQuantity (double value, MU unit)
 Constructor with double.
 CPhysicalQuantity (const QString &unitString)
 Constructor by parsed string, e.g. 10m.

Friends

int compare (const PQ &a, const PQ &b)
 Return negative, zero, or positive if a is less than, equal to, or greater than b.
PQ operator* (double factor, const PQ &other)
 Operator to support commutative multiplication.
bool operator== (const CPhysicalQuantity &a, const CPhysicalQuantity &b)
 Equal operator ==.
bool operator!= (const CPhysicalQuantity &a, const CPhysicalQuantity &b)
 Not equal operator !=.
bool operator> (const CPhysicalQuantity &a, const CPhysicalQuantity &b)
 Greater operator >.
bool operator< (const CPhysicalQuantity &a, const CPhysicalQuantity &b)
 Less operator <.
bool operator<= (const CPhysicalQuantity &a, const CPhysicalQuantity &b)
 Less equal operator <=.
bool operator>= (const CPhysicalQuantity &a, const CPhysicalQuantity &b)
 Greater equal operator >=.
PQ operator+ (const PQ &a, const PQ &b)
 Plus operator +.
PQ operator- (const PQ &a, const PQ &b)
 Minus operator -.
size_t qHash (const PQ &pq)
 qHash overload, needed for storing value in a QSet.

Detailed Description

template<class MU, class PQ>
class swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >

A physical quantity such as "5m", "20s", "1500ft/s".

Definition at line 106 of file physicalquantity.h.

Member Enumeration Documentation

◆ ColumnIndex

Index.

Definition at line 120 of file physicalquantity.h.

Constructor & Destructor Documentation

◆ CPhysicalQuantity() [1/2]

template<class MU, class PQ>
swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::CPhysicalQuantity ( double value,
MU unit )
protected

Constructor with double.

Definition at line 70 of file physicalquantity.cpp.

◆ CPhysicalQuantity() [2/2]

template<class MU, class PQ>
swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::CPhysicalQuantity ( const QString & unitString)
protected

Constructor by parsed string, e.g. 10m.

Definition at line 78 of file physicalquantity.cpp.

Member Function Documentation

◆ abs()

template<class MU, class PQ>
PQ swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::abs ( ) const

Absolute value (always >=0).

Definition at line 168 of file physicalquantity.cpp.

◆ addValueSameUnit()

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::addValueSameUnit ( double value)

Add to the value in the current unit.

Definition at line 103 of file physicalquantity.cpp.

◆ compare() [1/2]

template<class MU, class PQ>
int swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::compare ( const PQ & a,
const PQ & b )
inlinestatic

Implementation of compare.

Definition at line 351 of file physicalquantity.h.

◆ compare() [2/2]

template<class MU, class PQ>
int swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::compare ( const PQ & other) const
inline

Compare with other PQ.

Definition at line 342 of file physicalquantity.h.

◆ comparePropertyByIndex()

template<class MU, class PQ>
int swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::comparePropertyByIndex ( CPropertyIndexRef index,
const PQ & pq ) const

Compare for index.

Definition at line 625 of file physicalquantity.cpp.

◆ convertFromJson()

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::convertFromJson ( const QJsonObject & json)

Assign from JSON object.

Definition at line 513 of file physicalquantity.cpp.

◆ convertToQString()

template<class MU, class PQ>
QString swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::convertToQString ( bool i18n = false) const

Cast as QString.

Definition at line 451 of file physicalquantity.cpp.

◆ getUnit()

template<class MU, class PQ>
const MU & swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::getUnit ( ) const

Unit.

Definition at line 46 of file physicalquantity.cpp.

◆ getUnitSymbol()

template<class MU, class PQ>
QString swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::getUnitSymbol ( ) const

Unit.

Definition at line 64 of file physicalquantity.cpp.

◆ getValueHash()

template<class MU, class PQ>
size_t swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::getValueHash ( ) const

qHash overload, needed for storing value in a QSet.

Definition at line 496 of file physicalquantity.cpp.

◆ isInteger()

template<class MU, class PQ>
bool swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::isInteger ( ) const

Is value an integer.

Definition at line 415 of file physicalquantity.cpp.

◆ isNegativeWithEpsilonConsidered()

template<class MU, class PQ>
bool swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::isNegativeWithEpsilonConsidered ( ) const

Value <= 0 epsilon considered.

Definition at line 134 of file physicalquantity.cpp.

◆ isNull()

template<class MU, class PQ>
bool swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::isNull ( ) const

Is quantity null?

Definition at line 324 of file physicalquantity.cpp.

◆ isPositiveWithEpsilonConsidered()

template<class MU, class PQ>
bool swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::isPositiveWithEpsilonConsidered ( ) const

Value >= 0 epsilon considered.

Definition at line 128 of file physicalquantity.cpp.

◆ isZeroEpsilonConsidered()

template<class MU, class PQ>
bool swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::isZeroEpsilonConsidered ( ) const

Quantity value <= epsilon.

Definition at line 122 of file physicalquantity.cpp.

◆ makeNegative()

template<class MU, class PQ>
const PQ & swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::makeNegative ( )

Make value always negative.

Definition at line 154 of file physicalquantity.cpp.

◆ makePositive()

template<class MU, class PQ>
const PQ & swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::makePositive ( )

Make value always positive.

Definition at line 140 of file physicalquantity.cpp.

◆ marshallToDbus() [1/2]

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::marshallToDbus ( QDBusArgument & argument) const

Marshall without begin/endStructure, for when composed within another object.

Definition at line 183 of file physicalquantity.cpp.

◆ marshallToDbus() [2/2]

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::marshallToDbus ( QDBusArgument & argument,
LosslessTag  ) const

Marshal to DBus, preserving the measurement unit.

Definition at line 201 of file physicalquantity.cpp.

◆ marshalToDataStream()

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::marshalToDataStream ( QDataStream & stream) const

Marshal a value to a QDataStream.

Definition at line 215 of file physicalquantity.cpp.

◆ maxValue()

template<class MU, class PQ>
const PQ & swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::maxValue ( const PQ & pq1,
const PQ & pq2 )
static

Maximum of 2 quantities.

Definition at line 461 of file physicalquantity.cpp.

◆ minValue()

template<class MU, class PQ>
const PQ & swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::minValue ( const PQ & pq1,
const PQ & pq2 )
static

Minimum of 2 quantities.

Definition at line 475 of file physicalquantity.cpp.

◆ null()

template<class MU, class PQ>
const PQ & swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::null ( )
static

NULL PQ.

Definition at line 489 of file physicalquantity.cpp.

◆ operator*()

template<class MU, class PQ>
PQ swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::operator* ( double multiply) const

Operator *.

Definition at line 240 of file physicalquantity.cpp.

◆ operator*=()

template<class MU, class PQ>
CPhysicalQuantity< MU, PQ > & swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::operator*= ( double multiply)

Multiply operator *=.

Definition at line 233 of file physicalquantity.cpp.

◆ operator+=()

template<class MU, class PQ>
CPhysicalQuantity< MU, PQ > & swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::operator+= ( const CPhysicalQuantity< MU, PQ > & other)

Plus operator +=.

Definition at line 96 of file physicalquantity.cpp.

◆ operator-()

template<class MU, class PQ>
PQ swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::operator- ( ) const

Unary operator -.

Definition at line 263 of file physicalquantity.cpp.

◆ operator-=()

template<class MU, class PQ>
CPhysicalQuantity< MU, PQ > & swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::operator-= ( const CPhysicalQuantity< MU, PQ > & other)

Minus operator-=.

Definition at line 115 of file physicalquantity.cpp.

◆ operator/()

template<class MU, class PQ>
PQ swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::operator/ ( double divide) const

Operator /.

Definition at line 255 of file physicalquantity.cpp.

◆ operator/=()

template<class MU, class PQ>
CPhysicalQuantity< MU, PQ > & swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::operator/= ( double divide)

Divide operator /=.

Definition at line 248 of file physicalquantity.cpp.

◆ parsedFromString() [1/2]

template<class MU, class PQ>
PQ swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::parsedFromString ( const QString & value,
CPqString::SeparatorMode mode,
const MU & defaultUnitIfMissing )
static

Parsed from given string.

Definition at line 558 of file physicalquantity.cpp.

◆ parsedFromString() [2/2]

template<class MU, class PQ>
PQ swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::parsedFromString ( const QString & value,
CPqString::SeparatorMode mode = CPqString::SeparatorBestGuess )
static

Parsed from given string.

Definition at line 574 of file physicalquantity.cpp.

◆ parseFromString() [1/3]

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::parseFromString ( const QString & value)

Parse value from string.

Definition at line 552 of file physicalquantity.cpp.

◆ parseFromString() [2/3]

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::parseFromString ( const QString & value,
CPqString::SeparatorMode mode )

Parse to string, with specified separator.

Definition at line 531 of file physicalquantity.cpp.

◆ parseFromString() [3/3]

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::parseFromString ( const QString & value,
CPqString::SeparatorMode mode,
const MU & defaultUnitIfMissing )

Parse to string, with specified separator.

Definition at line 537 of file physicalquantity.cpp.

◆ propertyByIndex()

template<class MU, class PQ>
QVariant swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::propertyByIndex ( CPropertyIndexRef index) const

Property by index.

Definition at line 582 of file physicalquantity.cpp.

◆ roundToEpsilon()

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::roundToEpsilon ( )

Round current value in current unit to epsilon.

See also
CMeasurementUnit::roundToEpsilon

Definition at line 384 of file physicalquantity.cpp.

◆ setCurrentUnitValue()

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::setCurrentUnitValue ( double value)

Set value in current unit.

Definition at line 347 of file physicalquantity.cpp.

◆ setNull()

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::setNull ( )

Set null.

Definition at line 330 of file physicalquantity.cpp.

◆ setPropertyByIndex()

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::setPropertyByIndex ( CPropertyIndexRef index,
const QVariant & variant )

Set property by index.

Definition at line 603 of file physicalquantity.cpp.

◆ setUnit()

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::setUnit ( const MU & unit)

Simply set unit, do no calclulate conversion.

See also
switchUnit

Definition at line 52 of file physicalquantity.cpp.

◆ setUnitBySymbol()

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::setUnitBySymbol ( const QString & unitName)

Set unit by string.

Definition at line 58 of file physicalquantity.cpp.

◆ setValueSameUnit()

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::setValueSameUnit ( double value)

Change value without changing unit.

Definition at line 356 of file physicalquantity.cpp.

◆ substractValueSameUnit()

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::substractValueSameUnit ( double value)

Substract from the value in the current unit.

Definition at line 109 of file physicalquantity.cpp.

◆ switchedUnit()

template<class MU, class PQ>
PQ swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::switchedUnit ( const MU & newUnit) const

Return copy with switched unit.

Definition at line 312 of file physicalquantity.cpp.

◆ switchUnit()

template<class MU, class PQ>
PQ & swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::switchUnit ( const MU & newUnit)

Change unit, and convert value to maintain the same quantity.

Definition at line 292 of file physicalquantity.cpp.

◆ toJson()

template<class MU, class PQ>
QJsonObject swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::toJson ( ) const

Cast to JSON object.

Definition at line 504 of file physicalquantity.cpp.

◆ unmarshalFromDataStream()

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::unmarshalFromDataStream ( QDataStream & stream)

Unmarshal a value from a QDataStream.

Definition at line 222 of file physicalquantity.cpp.

◆ unmarshallFromDbus() [1/2]

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::unmarshallFromDbus ( const QDBusArgument & argument)

Unmarshall without begin/endStructure, for when composed within another object.

Definition at line 190 of file physicalquantity.cpp.

◆ unmarshallFromDbus() [2/2]

template<class MU, class PQ>
void swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::unmarshallFromDbus ( const QDBusArgument & argument,
LosslessTag  )

Unmarshal from DBus, with preserved measurement unit.

Definition at line 208 of file physicalquantity.cpp.

◆ value() [1/2]

template<class MU, class PQ>
double swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::value ( ) const

Value in current unit.

Definition at line 337 of file physicalquantity.cpp.

◆ value() [2/2]

template<class MU, class PQ>
double swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::value ( MU unit) const

Value in given unit.

Definition at line 444 of file physicalquantity.cpp.

◆ valueInteger() [1/2]

template<class MU, class PQ>
int swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::valueInteger ( ) const

As integer value in current unit.

Definition at line 409 of file physicalquantity.cpp.

◆ valueInteger() [2/2]

template<class MU, class PQ>
int swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::valueInteger ( MU unit) const

As integer value.

Definition at line 401 of file physicalquantity.cpp.

◆ valueIntegerAsString() [1/2]

template<class MU, class PQ>
QString swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::valueIntegerAsString ( ) const
inline

As integer value in current unit.

Definition at line 175 of file physicalquantity.h.

◆ valueIntegerAsString() [2/2]

template<class MU, class PQ>
QString swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::valueIntegerAsString ( MU unit) const
inline

As integer value.

Definition at line 169 of file physicalquantity.h.

◆ valueRounded() [1/2]

template<class MU, class PQ>
double swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::valueRounded ( int digits = -1) const

Rounded value in current unit.

Note
default digits is CMeasurementUnit::getDisplayDigits

Definition at line 427 of file physicalquantity.cpp.

◆ valueRounded() [2/2]

template<class MU, class PQ>
double swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::valueRounded ( MU unit,
int digits = -1 ) const

Rounded value in given unit.

Note
default digits is CMeasurementUnit::getDisplayDigits

Definition at line 394 of file physicalquantity.cpp.

◆ valueRoundedAsString()

template<class MU, class PQ>
QString swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::valueRoundedAsString ( MU unit,
int digits = -1 ) const

Rounded value in given unit.

Note
default digits is CMeasurementUnit::getDisplayDigits

Definition at line 433 of file physicalquantity.cpp.

◆ valueRoundedWithUnit() [1/2]

template<class MU, class PQ>
QString swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::valueRoundedWithUnit ( const MU & unit,
int digits = -1,
bool withGroupSeparator = false,
bool i18n = false ) const

Value to QString with the given unit, e.g. "5.00m".

Note
default digits is CMeasurementUnit::getDisplayDigits

Definition at line 362 of file physicalquantity.cpp.

◆ valueRoundedWithUnit() [2/2]

template<class MU, class PQ>
QString swift::misc::physical_quantities::CPhysicalQuantity< MU, PQ >::valueRoundedWithUnit ( 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

Definition at line 374 of file physicalquantity.cpp.

◆ compare

template<class MU, class PQ>
int compare ( const PQ & a,
const PQ & b )
friend

Return negative, zero, or positive if a is less than, equal to, or greater than b.

Definition at line 116 of file physicalquantity.h.

◆ operator!=

template<class MU, class PQ>
bool operator!= ( const CPhysicalQuantity< MU, PQ > & a,
const CPhysicalQuantity< MU, PQ > & b )
friend

Not equal operator !=.

Definition at line 236 of file physicalquantity.h.

◆ operator*

template<class MU, class PQ>
PQ operator* ( double factor,
const PQ & other )
friend

Operator to support commutative multiplication.

Definition at line 224 of file physicalquantity.h.

◆ operator+

template<class MU, class PQ>
PQ operator+ ( const PQ & a,
const PQ & b )
friend

Plus operator +.

Definition at line 257 of file physicalquantity.h.

◆ operator-

template<class MU, class PQ>
PQ operator- ( const PQ & a,
const PQ & b )
friend

Minus operator -.

Definition at line 265 of file physicalquantity.h.

◆ operator<

template<class MU, class PQ>
bool operator< ( const CPhysicalQuantity< MU, PQ > & a,
const CPhysicalQuantity< MU, PQ > & b )
friend

Less operator <.

Definition at line 248 of file physicalquantity.h.

◆ operator<=

template<class MU, class PQ>
bool operator<= ( const CPhysicalQuantity< MU, PQ > & a,
const CPhysicalQuantity< MU, PQ > & b )
friend

Less equal operator <=.

Definition at line 251 of file physicalquantity.h.

◆ operator==

template<class MU, class PQ>
bool operator== ( const CPhysicalQuantity< MU, PQ > & a,
const CPhysicalQuantity< MU, PQ > & b )
friend

Equal operator ==.

Definition at line 233 of file physicalquantity.h.

◆ operator>

template<class MU, class PQ>
bool operator> ( const CPhysicalQuantity< MU, PQ > & a,
const CPhysicalQuantity< MU, PQ > & b )
friend

Greater operator >.

Definition at line 245 of file physicalquantity.h.

◆ operator>=

template<class MU, class PQ>
bool operator>= ( const CPhysicalQuantity< MU, PQ > & a,
const CPhysicalQuantity< MU, PQ > & b )
friend

Greater equal operator >=.

Definition at line 254 of file physicalquantity.h.

◆ qHash

template<class MU, class PQ>
size_t qHash ( const PQ & pq)
friend

qHash overload, needed for storing value in a QSet.

Definition at line 312 of file physicalquantity.h.


The documentation for this class was generated from the following files: