swift
Loading...
Searching...
No Matches
swift::misc::physical_quantities::CTimeUnit Class Referencefinal

Specialized class for time units (ms, hour, min). More...

#include <units.h>

Inheritance diagram for swift::misc::physical_quantities::CTimeUnit:
[legend]

Public Types

using base_type = CMeasurementUnit
 Base type.
Public Types inherited from swift::misc::mixin::Index< CTimeUnit >
enum  ColumnIndex
 Base class enums. More...

Public Member Functions

 CTimeUnit ()
 Default constructor, required for Qt Metasystem.
 CTimeUnit (std::nullptr_t)
 Null constructor.
QString makeRoundedQStringWithUnit (double value, int digits=-1, bool withGroupSeparator=false, bool i18n=false) const
 Value rounded with unit, e.g. "5.00m", "30kHz".
void unmarshallFromDbus (const QDBusArgument &argument)
 Unmarshall without begin/endStructure, for when composed within another object.
void unmarshalFromDataStream (QDataStream &stream)
 Unmarshal a value from a QDataStream.
Public Member Functions inherited from swift::misc::physical_quantities::CMeasurementUnit
 CMeasurementUnit (const Data &&)=delete
 Constructor saves the address of its argument, so forbid rvalues.
QString convertToQString (bool i18n=false) const
 Cast as QString.
void marshallToDbus (QDBusArgument &argument) const
 Marshall without begin/endStructure, for when composed within another object.
void unmarshallFromDbus (const QDBusArgument &)
 Unmarshall without begin/endStructure, for when composed within another object.
void marshalToDataStream (QDataStream &stream) const
 Marshal a value to a QDataStream.
void unmarshalFromDataStream (QDataStream &)
 Unmarshal a value from a QDataStream.
QString getName (bool i18n=false) const
 Name such as "meter".
QString getSymbol (bool i18n=false) const
 Unit name such as "m".
bool endsStringWithNameOrSymbol (const QString &candidate, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
 Does a string end with name or symbol? E.g. 3meter, 3m, 3deg.
double roundValue (double value, int digits=-1) const
 Rounded value.
double roundToEpsilon (double value) const
 Rounded to the nearest CMeasurementUnit::getEpsilon.
virtual QString makeRoundedQString (double value, int digits=-1, bool withGroupSeparator=false, bool i18n=false) const
 Rounded string utility method, virtual so units can have specialized formatting.
double getEpsilon () const
 Threshold for comparions.
int getDisplayDigits () const
 Display digits.
double convertFrom (double value, const CMeasurementUnit &unit) const
 Convert from other unit to this unit.
bool isEpsilon (double value) const
 Is given value <= epsilon?
bool isNull () const
 Is unit null?
Public Member Functions inherited from swift::misc::mixin::String< CMeasurementUnit >
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< CMeasurementUnit >
CIcons::CIcons::StandardIconUnknown16 toIcon () const
 As icon, not implemented by all classes.
Public Member Functions inherited from swift::misc::mixin::MetaType< CTimeUnit >
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::Index< CTimeUnit >
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 CTimeUnit &compareValue) const
 Compare for index.
bool equalsPropertyByIndex (const QVariant &compareValue, CPropertyIndexRef index) const
 Is given variant equal to value of property index?

Static Public Member Functions

static CTimeUnit defaultUnit ()
 Default unit.
static CTimeUnit nullUnit ()
 Null unit.
static CTimeUnit s ()
 Second s.
static CTimeUnit ms ()
 Millisecond ms.
static CTimeUnit h ()
 Hour.
static CTimeUnit min ()
 Minute.
static CTimeUnit d ()
 Day.
static CTimeUnit hms ()
 Hours, minutes, seconds.
static CTimeUnit hrmin ()
 Hours, minutes.
static CTimeUnit minsec ()
 Minutes, seconds.
static const QList< CTimeUnit > & allUnits ()
 All units.
Static Public Member Functions inherited from swift::misc::physical_quantities::CMeasurementUnit
template<class U>
static U unitFromSymbol (const QString &symbol, bool strict=true)
 Unit from symbol.
template<class U>
static const QStringList & allSymbols ()
 All symbols.
template<class U>
static const QStringList & allSymbolsLowerCase ()
 All symbols case insensitive.
template<class U>
static bool hasCaseSensitiveSymbols ()
 Are symbols case sensitive?
template<class U>
static bool isValidUnitSymbol (const QString &symbol)
 Valid unit symbol?
template<class U>
static bool isValidUnitSymbol (const QString &symbol, Qt::CaseSensitivity caseSensitivity)
 Valid unit symbol?
template<class U>
static bool containsValidUnitSymbol (const QString &candidate, Qt::CaseSensitivity caseSensitivity=Qt::CaseSensitive)
 Contains valid unit symbol?
template<class U>
static bool endWithValidUnitSymbol (const QString &candidate, Qt::CaseSensitivity caseSensitivity=Qt::CaseSensitive)
 Ends with valid unit symbol?
static CMeasurementUnit None ()
 Dimensionless unit.
Static Public Member Functions inherited from swift::misc::mixin::MetaType< CTimeUnit >
static void registerMetadata ()
 Register metadata.

Additional Inherited Members

Protected Types inherited from swift::misc::physical_quantities::CMeasurementUnit
using ConverterFunction = double (*)(double)
 Pointer to function for converting between units.
Protected Member Functions inherited from swift::misc::physical_quantities::CMeasurementUnit
 CMeasurementUnit (const Data &data)
 Constructor.
 ~CMeasurementUnit ()=default
 Destructor.
 CMeasurementUnit (const CMeasurementUnit &)=default
 Copy constructor.
CMeasurementUnit & operator= (const CMeasurementUnit &)=default
 Copy assignment operator.
Static Protected Member Functions inherited from swift::misc::physical_quantities::CMeasurementUnit
template<int N>
static constexpr QLatin1String constQLatin1 (const char(&str)[N])
 Constant-initialize QLatin1String without using strlen.

Detailed Description

Specialized class for time units (ms, hour, min).

Definition at line 887 of file units.h.

Member Typedef Documentation

◆ base_type

Base type.

Definition at line 913 of file units.h.

Constructor & Destructor Documentation

◆ CTimeUnit() [1/2]

swift::misc::physical_quantities::CTimeUnit::CTimeUnit ( )
inline

Default constructor, required for Qt Metasystem.

Definition at line 918 of file units.h.

◆ CTimeUnit() [2/2]

swift::misc::physical_quantities::CTimeUnit::CTimeUnit ( std::nullptr_t )
inline

Null constructor.

Definition at line 921 of file units.h.

Member Function Documentation

◆ allUnits()

const QList< CTimeUnit > & swift::misc::physical_quantities::CTimeUnit::allUnits ( )
inlinestatic

All units.

Definition at line 1007 of file units.h.

◆ d()

CTimeUnit swift::misc::physical_quantities::CTimeUnit::d ( )
inlinestatic

Day.

Definition at line 972 of file units.h.

◆ defaultUnit()

CTimeUnit swift::misc::physical_quantities::CTimeUnit::defaultUnit ( )
inlinestatic

Default unit.

Definition at line 924 of file units.h.

◆ h()

CTimeUnit swift::misc::physical_quantities::CTimeUnit::h ( )
inlinestatic

Hour.

Definition at line 955 of file units.h.

◆ hms()

CTimeUnit swift::misc::physical_quantities::CTimeUnit::hms ( )
inlinestatic

Hours, minutes, seconds.

Definition at line 980 of file units.h.

◆ hrmin()

CTimeUnit swift::misc::physical_quantities::CTimeUnit::hrmin ( )
inlinestatic

Hours, minutes.

Definition at line 989 of file units.h.

◆ makeRoundedQStringWithUnit()

QString swift::misc::physical_quantities::CTimeUnit::makeRoundedQStringWithUnit ( double value,
int digits = -1,
bool withGroupSeparator = false,
bool i18n = false ) const
virtual

Value rounded with unit, e.g. "5.00m", "30kHz".

Note
default digits is CMeasurementUnit::getDisplayDigits

Reimplemented from swift::misc::physical_quantities::CMeasurementUnit.

Definition at line 59 of file units.cpp.

◆ min()

CTimeUnit swift::misc::physical_quantities::CTimeUnit::min ( )
inlinestatic

Minute.

Definition at line 963 of file units.h.

◆ minsec()

CTimeUnit swift::misc::physical_quantities::CTimeUnit::minsec ( )
inlinestatic

Minutes, seconds.

Definition at line 998 of file units.h.

◆ ms()

CTimeUnit swift::misc::physical_quantities::CTimeUnit::ms ( )
inlinestatic

Millisecond ms.

Definition at line 946 of file units.h.

◆ nullUnit()

CTimeUnit swift::misc::physical_quantities::CTimeUnit::nullUnit ( )
inlinestatic

Null unit.

Definition at line 927 of file units.h.

◆ s()

CTimeUnit swift::misc::physical_quantities::CTimeUnit::s ( )
inlinestatic

Second s.

Definition at line 938 of file units.h.

◆ unmarshalFromDataStream()

void swift::misc::physical_quantities::CTimeUnit::unmarshalFromDataStream ( QDataStream & stream)
inline

Unmarshal a value from a QDataStream.

Definition at line 1024 of file units.h.

◆ unmarshallFromDbus()

void swift::misc::physical_quantities::CTimeUnit::unmarshallFromDbus ( const QDBusArgument & argument)
inline

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

Definition at line 1016 of file units.h.


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