6#ifndef SWIFT_MISC_PQ_UNITS_H
7#define SWIFT_MISC_PQ_UNITS_H
9#pragma push_macro("min")
15#include <QDBusArgument>
29#define SWIFT_TEMPLATE_UNIT_MIXINS(MU, Extern, Export) \
30 namespace swift::misc::physical_quantities \
34 namespace swift::misc::private_ns \
36 Extern template struct Export CValueObjectMetaInfo<physical_quantities::MU>; \
37 Extern template struct Export MetaTypeHelper<physical_quantities::MU>; \
39 namespace swift::misc::mixin \
41 Extern template class Export MetaType<physical_quantities::MU>; \
42 Extern template class Export DBusOperators<physical_quantities::MU>; \
43 Extern template class Export DataStreamOperators<physical_quantities::MU>; \
44 Extern template class Export Index<physical_quantities::MU>; \
58#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
59# define SWIFT_DECLARE_UNIT_MIXINS(MU)
60# define SWIFT_DEFINE_UNIT_MIXINS(MU)
61#elif defined(Q_OS_WIN) && defined(Q_CC_CLANG)
62# define SWIFT_DECLARE_UNIT_MIXINS(MU) SWIFT_TEMPLATE_UNIT_MIXINS(MU, extern, )
63# define SWIFT_DEFINE_UNIT_MIXINS(MU) SWIFT_TEMPLATE_UNIT_MIXINS(MU, , SWIFT_MISC_EXPORT)
65# define SWIFT_DECLARE_UNIT_MIXINS(MU) SWIFT_TEMPLATE_UNIT_MIXINS(MU, extern, )
66# define SWIFT_DEFINE_UNIT_MIXINS(MU) SWIFT_TEMPLATE_UNIT_MIXINS(MU, , )
86namespace swift::misc::physical_quantities
90 public CMeasurementUnit,
99 struct NauticalMilesToMeters
101 static double factor() {
return 1852.0; }
105 static double factor() {
return 0.3048; }
109 static double factor() {
return 1609.344; }
111 struct StatuteMilesToMeters
113 static double factor() {
return 1609.3472; }
115 using MetersToMeters =
One;
211 argument >> unitName;
226 public CMeasurementUnit,
227 public mixin::MetaType<CAngleUnit>,
228 public mixin::DBusOperators<CAngleUnit>,
229 public mixin::DataStreamOperators<CAngleUnit>,
230 public mixin::Index<CAngleUnit>
233 using CMeasurementUnit::CMeasurementUnit;
235 struct RadiansToDegrees
237 static double factor() {
return 180.0 / M_PI; }
239 using DegreesToDegrees =
One;
264 QString makeRoundedQStringWithUnit(
double value,
int digits = -1,
bool withGroupSeparator =
false,
265 bool i18n =
false)
const override;
279 constQLatin1(QT_TRANSLATE_NOOP(
"CMeasurementUnit",
"deg")),
314 argument >> unitName;
329 public CMeasurementUnit,
330 public mixin::MetaType<CFrequencyUnit>,
331 public mixin::DBusOperators<CFrequencyUnit>,
332 public mixin::DataStreamOperators<CFrequencyUnit>,
333 public mixin::Index<CFrequencyUnit>
336 using CMeasurementUnit::CMeasurementUnit;
338 using HertzToHertz =
One;
409 argument >> unitName;
424 public CMeasurementUnit,
434 struct PoundsToKilograms
436 static double factor() {
return 0.45359237; }
514 argument >> unitName;
529 public CMeasurementUnit,
539 struct PsiToHectopascals
541 static double factor() {
return 68.948; }
543 struct InchesToHectopascals
545 static double factor() {
return 33.86389; }
547 struct MillimetersToHectopascals
549 static double factor() {
return 860.142806; }
649 argument >> unitName;
664 public CMeasurementUnit,
673 struct KelvinToCentigrade
675 static double factor() {
return 1.0; }
676 static double offset() {
return 273.15; }
678 struct FahrenheitToCentigrade
680 static double factor() {
return 5.0 / 9.0; }
681 static double offset() {
return 32.0; }
718 constQLatin1(QT_TRANSLATE_NOOP(
"CMeasurementUnit",
"C")),
727 constQLatin1(QT_TRANSLATE_NOOP(
"CMeasurementUnit",
"F")),
744 argument >> unitName;
759 public CMeasurementUnit,
770 static double factor() {
return 1852.0 / 3600.0; }
774 static double factor() {
return 1.0 / 3.6; }
778 static double factor() {
return 0.3048; }
782 static double factor() {
return 0.3048 / 60.0; }
873 argument >> unitName;
888 public CMeasurementUnit,
897 using SecondsToSeconds =
One;
900 static double factor() {
return 60.0 * 60.0 * 24.0; }
902 struct HoursToSeconds
904 static double factor() {
return 60.0 * 60.0; }
906 struct MinutesToSeconds
908 static double factor() {
return 60.0; }
934 QString makeRoundedQStringWithUnit(
double value,
int digits = -1,
bool withGroupSeparator =
false,
935 bool i18n =
false)
const override;
1019 argument >> unitName;
1034 public CMeasurementUnit,
1045 static double factor() {
return 0.3048; }
1074 constQLatin1(QT_TRANSLATE_NOOP(
"CMeasurementUnit",
"meter per second per second")),
1083 constQLatin1(QT_TRANSLATE_NOOP(
"CMeasurementUnit",
"foot per second per second")),
1100 argument >> unitName;
1125#pragma pop_macro("min")
Specialized class for angles (degrees, radian).
static CAngleUnit sexagesimalDegMin()
Sexagesimal degree (degrees, minutes, decimal minutes).
static CAngleUnit rad()
Radians.
static CAngleUnit nullUnit()
Null unit.
static CAngleUnit deg()
Degrees.
static CAngleUnit sexagesimalDeg()
Sexagesimal degree (degrees, minutes, seconds, decimal seconds).
CAngleUnit()
Default constructor, required for Qt Metasystem.
Specialized class for frequency (hertz, mega hertz, kilo hertz).
static CFrequencyUnit Hz()
Hertz.
static CFrequencyUnit nullUnit()
Null unit.
static CFrequencyUnit MHz()
Megahertz.
CFrequencyUnit()
Default constructor, required for Qt Metasystem.
static CFrequencyUnit kHz()
Kilohertz.
static CFrequencyUnit GHz()
Gigahertz.
CRTP class template which will generate marshalling operators for a derived class with its own marsha...
CRTP class template to generate non-member QDataStream streaming operators.
CRTP class template from which a derived class can inherit property indexing functions.
Specialized class for acceleration units (m/s2, ft/s2).
static CAccelerationUnit defaultUnit()
Default unit.
static CAccelerationUnit ft_s2()
Feet/second^2.
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.
CAccelerationUnit()
Default constructor, required for Qt Metasystem.
static CAccelerationUnit nullUnit()
Null unit.
CMeasurementUnit base_type
Base type.
CAccelerationUnit(std::nullptr_t)
Null constructor.
static const QList< CAccelerationUnit > & allUnits()
All units.
static CAccelerationUnit m_s2()
Meter/second^2 (m/s^2).
Specialized class for angles (degrees, radian).
CMeasurementUnit base_type
Base type.
static CAngleUnit sexagesimalDegMin()
Sexagesimal degree (degrees, minutes, decimal minutes).
void unmarshallFromDbus(const QDBusArgument &argument)
Unmarshall without begin/endStructure, for when composed within another object.
static CAngleUnit rad()
Radians.
static CAngleUnit nullUnit()
Null unit.
static CAngleUnit deg()
Degrees.
static const QList< CAngleUnit > & allUnits()
All units.
static CAngleUnit sexagesimalDeg()
Sexagesimal degree (degrees, minutes, seconds, decimal seconds).
static CAngleUnit defaultUnit()
Default unit.
CAngleUnit(std::nullptr_t)
Null constructor.
void unmarshalFromDataStream(QDataStream &stream)
Unmarshal a value from a QDataStream.
CAngleUnit()
Default constructor, required for Qt Metasystem.
Specialized class for frequency (hertz, mega hertz, kilo hertz).
static CFrequencyUnit Hz()
Hertz.
static CFrequencyUnit nullUnit()
Null unit.
static const QList< CFrequencyUnit > & allUnits()
All units.
void unmarshallFromDbus(const QDBusArgument &argument)
Unmarshall without begin/endStructure, for when composed within another object.
static CFrequencyUnit MHz()
Megahertz.
CFrequencyUnit()
Default constructor, required for Qt Metasystem.
CFrequencyUnit(std::nullptr_t)
Null constructor.
static CFrequencyUnit defaultUnit()
Default unit.
static CFrequencyUnit kHz()
Kilohertz.
CMeasurementUnit base_type
Base type.
static CFrequencyUnit GHz()
Gigahertz.
void unmarshalFromDataStream(QDataStream &stream)
Unmarshal a value from a QDataStream.
Specialized class for distance units (meter, foot, nautical miles).
void unmarshalFromDataStream(QDataStream &stream)
Unmarshal a value from a QDataStream.
static const QList< CLengthUnit > & allUnits()
All units.
CLengthUnit()
Default constructor, required for Qt Metasystem.
static CLengthUnit km()
Kilometer km.
static CLengthUnit nullUnit()
Null unit.
static CLengthUnit m()
Meter m.
static CLengthUnit SM()
Statute mile.
CMeasurementUnit base_type
Base type.
static CLengthUnit NM()
Nautical miles NM.
static CLengthUnit ft()
Foot ft.
CLengthUnit(std::nullptr_t)
Null constructor.
static CLengthUnit mi()
International mile.
static CLengthUnit defaultUnit()
Default unit.
static CLengthUnit cm()
Centimeter cm.
void unmarshallFromDbus(const QDBusArgument &argument)
Unmarshall without begin/endStructure, for when composed within another object.
Specialized class for mass units (kg, lbs).
CMassUnit(std::nullptr_t)
Null constructor.
static CMassUnit tonne()
Tonne, aka metric ton (1000kg).
static CMassUnit defaultUnit()
Default unit.
static CMassUnit shortTon()
Short ton (2000lb) used in the United States.
CMeasurementUnit base_type
Base type.
static CMassUnit g()
Gram, SI unit.
void unmarshalFromDataStream(QDataStream &stream)
Unmarshal a value from a QDataStream.
void unmarshallFromDbus(const QDBusArgument &argument)
Unmarshall without begin/endStructure, for when composed within another object.
static CMassUnit nullUnit()
Null unit.
static CMassUnit lb()
Pound, aka mass pound.
static CMassUnit kg()
Kilogram, SI base unit.
static const QList< CMassUnit > & allUnits()
All units.
CMassUnit()
Default constructor, required for Qt Metasystem.
CMeasurementUnit(const Data &data)
Constructor.
static constexpr QLatin1String constQLatin1(const char(&str)[N])
Constant-initialize QLatin1String without using strlen.
static U unitFromSymbol(const QString &symbol, bool strict=true)
Unit from symbol.
Specialized class for pressure (psi, hPa, bar).
static CPressureUnit nullUnit()
Null unit.
static CPressureUnit bar()
Bar.
CPressureUnit(std::nullptr_t)
Null constructor.
static CPressureUnit mbar()
Millibar, actually the same as hPa.
static CPressureUnit mmHg()
Millimeter of mercury.
static CPressureUnit Pa()
Pascal.
CMeasurementUnit base_type
Base type.
static const QList< CPressureUnit > & allUnits()
All units.
static CPressureUnit inHg()
Inch of mercury at 0°C.
static CPressureUnit psi()
Pounds per square inch.
static CPressureUnit defaultUnit()
Default unit.
void unmarshalFromDataStream(QDataStream &stream)
Unmarshal a value from a QDataStream.
CPressureUnit()
Default constructor, required for Qt Metasystem.
static CPressureUnit hPa()
Hectopascal.
void unmarshallFromDbus(const QDBusArgument &argument)
Unmarshall without begin/endStructure, for when composed within another object.
Specialized class for speed units (m/s, ft/s, NM/h).
void unmarshallFromDbus(const QDBusArgument &argument)
Unmarshall without begin/endStructure, for when composed within another object.
CMeasurementUnit base_type
Base type.
static CSpeedUnit NM_h()
Nautical miles per hour NM/h (same as kts).
static CSpeedUnit ft_s()
Feet/second ft/s.
static const QList< CSpeedUnit > & allUnits()
All units.
CSpeedUnit()
Default constructor, required for Qt Metasystem.
static CSpeedUnit ft_min()
Feet/min ft/min.
void unmarshalFromDataStream(QDataStream &stream)
Unmarshal a value from a QDataStream.
static CSpeedUnit km_h()
Kilometer/hour km/h.
CSpeedUnit(std::nullptr_t)
Null constructor.
static CSpeedUnit m_s()
Meter/second m/s.
static CSpeedUnit kts()
Knots.
static CSpeedUnit defaultUnit()
Default unit.
static CSpeedUnit nullUnit()
Null unit.
Specialized class for temperatur units (kelvin, centidegree).
CMeasurementUnit base_type
Base type.
static CTemperatureUnit defaultUnit()
Default unit.
void unmarshallFromDbus(const QDBusArgument &argument)
Unmarshall without begin/endStructure, for when composed within another object.
static CTemperatureUnit nullUnit()
Null unit.
CTemperatureUnit()
Default constructor, required for Qt Metasystem.
static CTemperatureUnit C()
Centigrade C.
static CTemperatureUnit K()
Kelvin.
static const QList< CTemperatureUnit > & allUnits()
All units.
CTemperatureUnit(std::nullptr_t)
Null constructor.
static CTemperatureUnit F()
Fahrenheit F.
void unmarshalFromDataStream(QDataStream &stream)
Unmarshal a value from a QDataStream.
Specialized class for time units (ms, hour, min).
CTimeUnit()
Default constructor, required for Qt Metasystem.
static CTimeUnit min()
Minute.
void unmarshalFromDataStream(QDataStream &stream)
Unmarshal a value from a QDataStream.
static CTimeUnit nullUnit()
Null unit.
static CTimeUnit defaultUnit()
Default unit.
static CTimeUnit hrmin()
Hours, minutes.
static const QList< CTimeUnit > & allUnits()
All units.
CTimeUnit(std::nullptr_t)
Null constructor.
void unmarshallFromDbus(const QDBusArgument &argument)
Unmarshall without begin/endStructure, for when composed within another object.
static CTimeUnit hms()
Hours, minutes, seconds.
static CTimeUnit s()
Second s.
static CTimeUnit minsec()
Minutes, seconds.
CMeasurementUnit base_type
Base type.
static CTimeUnit ms()
Millisecond ms.
static CTimeUnit h()
Hour.
Concrete strategy pattern for converting unit with offset linear conversion.
Metapolicy that can be used to modify template parameters of converters.
Metapolicy that can be used to modify template parameters of converters.
Concrete strategy pattern for converting unit that does nothing.
Metapolicy that can be used to modify template parameters of converters.
Metapolicy that can be used to modify template parameters of converters.
Concrete strategy pattern for converting unit with linear conversion.
Metapolicy that can be used to modify template parameters of converters.
Metapolicy that can be used to modify template parameters of converters.
Metapolicy that can be used to modify template parameters of converters.
Concrete strategy pattern for converting unit with two subdivision conversions.
Concrete strategy pattern for converting unit with one subdivision conversion.
Metapolicy that can be used to modify template parameters of converters.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.
#define SWIFT_DECLARE_UNIT_MIXINS(MU)
Explicit template declaration of mixins for a CMeasurementUnit subclass to be placed near the top of ...