11#include <KLocalizedString>
15namespace KUnitConversion
17class BeaufortUnitPrivate :
public UnitPrivate
20 BeaufortUnitPrivate(CategoryId categoryId,
29 : UnitPrivate(categoryId, id, multiplier, symbol, description, matchString, symbolString, realString, integerString)
33 qreal toDefault(qreal value)
const override
35 return 0.836 * pow(value, 3.0 / 2.0);
38 qreal fromDefault(qreal value)
const override
40 return pow(value / 0.836, 2.0 / 3.0);
44UnitCategory Velocity::makeCategory()
46 auto c = UnitCategoryPrivate::makeCategory(VelocityCategory,
i18n(
"Speed"),
i18n(
"Speed"));
47 auto d = UnitCategoryPrivate::get(c);
50 d->addDefaultUnit(UnitPrivate::makeUnit(VelocityCategory,
53 i18nc(
"velocity unit symbol",
"m/s"),
54 i18nc(
"unit description in lists",
"meters per second"),
55 i18nc(
"unit synonyms for matching user input",
"meter per second;meters per second;m/s;ms"),
57 ki18nc(
"amount in units (real)",
"%1 meters per second"),
58 ki18ncp(
"amount in units (integer)",
"%1 meter per second",
"%1 meters per second")));
60 d->addCommonUnit(UnitPrivate::makeUnit(VelocityCategory,
63 i18nc(
"velocity unit symbol",
"km/h"),
64 i18nc(
"unit description in lists",
"kilometers per hour"),
65 i18nc(
"unit synonyms for matching user input",
"kilometer per hour;kilometers per hour;km/h;kmh;kph"),
67 ki18nc(
"amount in units (real)",
"%1 kilometers per hour"),
68 ki18ncp(
"amount in units (integer)",
"%1 kilometer per hour",
"%1 kilometers per hour")));
70 d->addCommonUnit(UnitPrivate::makeUnit(VelocityCategory,
73 i18nc(
"velocity unit symbol",
"mph"),
74 i18nc(
"unit description in lists",
"miles per hour"),
75 i18nc(
"unit synonyms for matching user input",
"mile per hour;miles per hour;mph"),
77 ki18nc(
"amount in units (real)",
"%1 miles per hour"),
78 ki18ncp(
"amount in units (integer)",
"%1 mile per hour",
"%1 miles per hour")));
80 d->addUnit(UnitPrivate::makeUnit(VelocityCategory,
83 i18nc(
"velocity unit symbol",
"ft/s"),
84 i18nc(
"unit description in lists",
"feet per second"),
85 i18nc(
"unit synonyms for matching user input",
"foot per second;feet per second;ft/s;ft/sec;fps"),
87 ki18nc(
"amount in units (real)",
"%1 feet per second"),
88 ki18ncp(
"amount in units (integer)",
"%1 foot per second",
"%1 feet per second")));
90 d->addUnit(UnitPrivate::makeUnit(VelocityCategory,
93 i18nc(
"velocity unit symbol",
"in/s"),
94 i18nc(
"unit description in lists",
"inches per second"),
95 i18nc(
"unit synonyms for matching user input",
"inch per second;inches per second;in/s;in/sec;ips"),
97 ki18nc(
"amount in units (real)",
"%1 inches per second"),
98 ki18ncp(
"amount in units (integer)",
"%1 inch per second",
"%1 inches per second")));
100 d->addCommonUnit(UnitPrivate::makeUnit(VelocityCategory,
103 i18nc(
"velocity unit symbol",
"kt"),
104 i18nc(
"unit description in lists",
"knots"),
105 i18nc(
"unit synonyms for matching user input",
"knot;knots;kt;nautical miles per hour"),
107 ki18nc(
"amount in units (real)",
"%1 knots"),
108 ki18ncp(
"amount in units (integer)",
"%1 knot",
"%1 knots")));
111 d->addCommonUnit(UnitPrivate::makeUnit(VelocityCategory,
114 i18nc(
"velocity unit symbol",
"Ma"),
115 i18nc(
"unit description in lists",
"Mach"),
116 i18nc(
"unit synonyms for matching user input",
"mach;machs;Ma;speed of sound"),
118 ki18nc(
"amount in units (real)",
"Mach %1"),
119 ki18ncp(
"amount in units (integer)",
"Mach %1",
"Mach %1")));
121 d->addUnit(UnitPrivate::makeUnit(VelocityCategory,
124 i18nc(
"velocity unit symbol",
"c"),
125 i18nc(
"unit description in lists",
"speed of light"),
126 i18nc(
"unit synonyms for matching user input",
"speed of light;c"),
128 ki18nc(
"amount in units (real)",
"%1 speed of light"),
129 ki18ncp(
"amount in units (integer)",
"%1 speed of light",
"%1 speed of light")));
132 d->addUnit(UnitPrivate::makeUnit(
new BeaufortUnitPrivate(VelocityCategory,
135 i18nc(
"velocity unit symbol",
"bft"),
136 i18nc(
"unit description in lists",
"Beaufort"),
137 i18nc(
"unit synonyms for matching user input",
"Beaufort;Bft"),
139 ki18nc(
"amount in units (real)",
"%1 on the Beaufort scale"),
140 ki18ncp(
"amount in units (integer)",
"%1 on the Beaufort scale",
"%1 on the Beaufort scale"))));
QString i18nc(const char *context, const char *text, const TYPE &arg...)
KLocalizedString KI18N_EXPORT ki18ncp(const char *context, const char *singular, const char *plural)
KLocalizedString KI18N_EXPORT ki18nc(const char *context, const char *text)
QString i18n(const char *text, const TYPE &arg...)