11#include <KLocalizedString>
14namespace KUnitConversion
16class DecibelUnitPrivate :
public UnitPrivate
19 DecibelUnitPrivate(CategoryId categoryId,
28 : UnitPrivate(categoryId, id, multiplier, symbol, description, matchString, symbolString, realString, integerString)
32 qreal toDefault(qreal value)
const override
35 return qPow(10, value / 10) * m_multiplier;
38 qreal fromDefault(qreal value)
const override
43 return 10 * qLn(value / m_multiplier) / M_LN10;
47UnitCategory Power::makeCategory()
49 auto c = UnitCategoryPrivate::makeCategory(PowerCategory,
i18n(
"Power"),
i18n(
"Power"));
50 auto d = UnitCategoryPrivate::get(c);
53 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
56 i18nc(
"power unit symbol",
"YW"),
57 i18nc(
"unit description in lists",
"yottawatts"),
58 i18nc(
"unit synonyms for matching user input",
"yottawatt;yottawatts;YW"),
60 ki18nc(
"amount in units (real)",
"%1 yottawatts"),
61 ki18ncp(
"amount in units (integer)",
"%1 yottawatt",
"%1 yottawatts")));
63 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
66 i18nc(
"power unit symbol",
"ZW"),
67 i18nc(
"unit description in lists",
"zettawatts"),
68 i18nc(
"unit synonyms for matching user input",
"zettawatt;zettawatts;ZW"),
70 ki18nc(
"amount in units (real)",
"%1 zettawatts"),
71 ki18ncp(
"amount in units (integer)",
"%1 zettawatt",
"%1 zettawatts")));
73 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
76 i18nc(
"power unit symbol",
"EW"),
77 i18nc(
"unit description in lists",
"exawatts"),
78 i18nc(
"unit synonyms for matching user input",
"exawatt;exawatts;EW"),
80 ki18nc(
"amount in units (real)",
"%1 exawatts"),
81 ki18ncp(
"amount in units (integer)",
"%1 exawatt",
"%1 exawatts")));
83 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
86 i18nc(
"power unit symbol",
"PW"),
87 i18nc(
"unit description in lists",
"petawatts"),
88 i18nc(
"unit synonyms for matching user input",
"petawatt;petawatts;PW"),
90 ki18nc(
"amount in units (real)",
"%1 petawatts"),
91 ki18ncp(
"amount in units (integer)",
"%1 petawatt",
"%1 petawatts")));
93 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
96 i18nc(
"power unit symbol",
"TW"),
97 i18nc(
"unit description in lists",
"terawatts"),
98 i18nc(
"unit synonyms for matching user input",
"terawatt;terawatts;TW"),
100 ki18nc(
"amount in units (real)",
"%1 terawatts"),
101 ki18ncp(
"amount in units (integer)",
"%1 terawatt",
"%1 terawatts")));
103 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
106 i18nc(
"power unit symbol",
"GW"),
107 i18nc(
"unit description in lists",
"gigawatts"),
108 i18nc(
"unit synonyms for matching user input",
"gigawatt;gigawatts;GW"),
110 ki18nc(
"amount in units (real)",
"%1 gigawatts"),
111 ki18ncp(
"amount in units (integer)",
"%1 gigawatt",
"%1 gigawatts")));
113 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
116 i18nc(
"power unit symbol",
"MW"),
117 i18nc(
"unit description in lists",
"megawatts"),
118 i18nc(
"unit synonyms for matching user input",
"megawatt;megawatts;MW"),
120 ki18nc(
"amount in units (real)",
"%1 megawatts"),
121 ki18ncp(
"amount in units (integer)",
"%1 megawatt",
"%1 megawatts")));
123 d->addCommonUnit(UnitPrivate::makeUnit(PowerCategory,
126 i18nc(
"power unit symbol",
"kW"),
127 i18nc(
"unit description in lists",
"kilowatts"),
128 i18nc(
"unit synonyms for matching user input",
"kilowatt;kilowatts;kW"),
130 ki18nc(
"amount in units (real)",
"%1 kilowatts"),
131 ki18ncp(
"amount in units (integer)",
"%1 kilowatt",
"%1 kilowatts")));
133 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
136 i18nc(
"power unit symbol",
"hW"),
137 i18nc(
"unit description in lists",
"hectowatts"),
138 i18nc(
"unit synonyms for matching user input",
"hectowatt;hectowatts;hW"),
140 ki18nc(
"amount in units (real)",
"%1 hectowatts"),
141 ki18ncp(
"amount in units (integer)",
"%1 hectowatt",
"%1 hectowatts")));
143 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
146 i18nc(
"power unit symbol",
"daW"),
147 i18nc(
"unit description in lists",
"decawatts"),
148 i18nc(
"unit synonyms for matching user input",
"decawatt;decawatts;daW"),
150 ki18nc(
"amount in units (real)",
"%1 decawatts"),
151 ki18ncp(
"amount in units (integer)",
"%1 decawatt",
"%1 decawatts")));
153 d->addDefaultUnit(UnitPrivate::makeUnit(PowerCategory,
156 i18nc(
"power unit symbol",
"W"),
157 i18nc(
"unit description in lists",
"watts"),
158 i18nc(
"unit synonyms for matching user input",
"watt;watts;W"),
160 ki18nc(
"amount in units (real)",
"%1 watts"),
161 ki18ncp(
"amount in units (integer)",
"%1 watt",
"%1 watts")));
163 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
166 i18nc(
"power unit symbol",
"dW"),
167 i18nc(
"unit description in lists",
"deciwatts"),
168 i18nc(
"unit synonyms for matching user input",
"deciwatt;deciwatts;dW"),
170 ki18nc(
"amount in units (real)",
"%1 deciwatts"),
171 ki18ncp(
"amount in units (integer)",
"%1 deciwatt",
"%1 deciwatts")));
173 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
176 i18nc(
"power unit symbol",
"cW"),
177 i18nc(
"unit description in lists",
"centiwatts"),
178 i18nc(
"unit synonyms for matching user input",
"centiwatt;centiwatts;cW"),
180 ki18nc(
"amount in units (real)",
"%1 centiwatts"),
181 ki18ncp(
"amount in units (integer)",
"%1 centiwatt",
"%1 centiwatts")));
183 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
186 i18nc(
"power unit symbol",
"mW"),
187 i18nc(
"unit description in lists",
"milliwatts"),
188 i18nc(
"unit synonyms for matching user input",
"milliwatt;milliwatts;mW"),
190 ki18nc(
"amount in units (real)",
"%1 milliwatts"),
191 ki18ncp(
"amount in units (integer)",
"%1 milliwatt",
"%1 milliwatts")));
193 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
196 i18nc(
"power unit symbol",
"µW"),
197 i18nc(
"unit description in lists",
"microwatts"),
198 i18nc(
"unit synonyms for matching user input",
"microwatt;microwatts;µW;uW"),
200 ki18nc(
"amount in units (real)",
"%1 microwatts"),
201 ki18ncp(
"amount in units (integer)",
"%1 microwatt",
"%1 microwatts")));
203 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
206 i18nc(
"power unit symbol",
"nW"),
207 i18nc(
"unit description in lists",
"nanowatts"),
208 i18nc(
"unit synonyms for matching user input",
"nanowatt;nanowatts;nW"),
210 ki18nc(
"amount in units (real)",
"%1 nanowatts"),
211 ki18ncp(
"amount in units (integer)",
"%1 nanowatt",
"%1 nanowatts")));
213 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
216 i18nc(
"power unit symbol",
"pW"),
217 i18nc(
"unit description in lists",
"picowatts"),
218 i18nc(
"unit synonyms for matching user input",
"picowatt;picowatts;pW"),
220 ki18nc(
"amount in units (real)",
"%1 picowatts"),
221 ki18ncp(
"amount in units (integer)",
"%1 picowatt",
"%1 picowatts")));
223 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
226 i18nc(
"power unit symbol",
"fW"),
227 i18nc(
"unit description in lists",
"femtowatts"),
228 i18nc(
"unit synonyms for matching user input",
"femtowatt;femtowatts;fW"),
230 ki18nc(
"amount in units (real)",
"%1 femtowatts"),
231 ki18ncp(
"amount in units (integer)",
"%1 femtowatt",
"%1 femtowatts")));
233 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
236 i18nc(
"power unit symbol",
"aW"),
237 i18nc(
"unit description in lists",
"attowatts"),
238 i18nc(
"unit synonyms for matching user input",
"attowatt;attowatts;aW"),
240 ki18nc(
"amount in units (real)",
"%1 attowatts"),
241 ki18ncp(
"amount in units (integer)",
"%1 attowatt",
"%1 attowatts")));
243 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
246 i18nc(
"power unit symbol",
"zW"),
247 i18nc(
"unit description in lists",
"zeptowatts"),
248 i18nc(
"unit synonyms for matching user input",
"zeptowatt;zeptowatts;zW"),
250 ki18nc(
"amount in units (real)",
"%1 zeptowatts"),
251 ki18ncp(
"amount in units (integer)",
"%1 zeptowatt",
"%1 zeptowatts")));
253 d->addUnit(UnitPrivate::makeUnit(PowerCategory,
256 i18nc(
"power unit symbol",
"yW"),
257 i18nc(
"unit description in lists",
"yoctowatts"),
258 i18nc(
"unit synonyms for matching user input",
"yoctowatt;yoctowatts;yW"),
260 ki18nc(
"amount in units (real)",
"%1 yoctowatts"),
261 ki18ncp(
"amount in units (integer)",
"%1 yoctowatt",
"%1 yoctowatts")));
263 d->addCommonUnit(UnitPrivate::makeUnit(PowerCategory,
266 i18nc(
"power unit symbol",
"hp"),
267 i18nc(
"unit description in lists",
"horsepowers"),
268 i18nc(
"unit synonyms for matching user input",
"horsepower;horsepowers;hp"),
270 ki18nc(
"amount in units (real)",
"%1 horsepowers"),
271 ki18ncp(
"amount in units (integer)",
"%1 horsepower",
"%1 horsepowers")));
275 d->addUnit(UnitPrivate::makeUnit(
new DecibelUnitPrivate(PowerCategory,
278 i18nc(
"power unit symbol",
"dBk"),
279 i18nc(
"unit description in lists",
"decibel kilowatts"),
280 i18nc(
"unit synonyms for matching user input",
"dBk;dBkW;dB(kW)"),
282 ki18nc(
"amount in units (real)",
"%1 decibel kilowatts"),
283 ki18ncp(
"amount in units (integer)",
"%1 decibel kilowatt",
"%1 decibel kilowatts"))));
285 d->addUnit(UnitPrivate::makeUnit(
new DecibelUnitPrivate(PowerCategory,
288 i18nc(
"power unit symbol",
"dBW"),
289 i18nc(
"unit description in lists",
"decibel watts"),
290 i18nc(
"unit synonyms for matching user input",
"dBW;dB(W)"),
292 ki18nc(
"amount in units (real)",
"%1 decibel watts"),
293 ki18ncp(
"amount in units (integer)",
"%1 decibel watt",
"%1 decibel watts"))));
295 d->addCommonUnit(UnitPrivate::makeUnit(
new DecibelUnitPrivate(PowerCategory,
298 i18nc(
"power unit symbol",
"dBm"),
299 i18nc(
"unit description in lists",
"decibel milliwatts"),
300 i18nc(
"unit synonyms for matching user input",
"dBm;dBmW;dB(mW)"),
302 ki18nc(
"amount in units (real)",
"%1 decibel milliwatts"),
303 ki18ncp(
"amount in units (integer)",
"%1 decibel milliwatt",
"%1 decibel milliwatts"))));
305 d->addUnit(UnitPrivate::makeUnit(
new DecibelUnitPrivate(PowerCategory,
308 i18nc(
"power unit symbol",
"dBµW"),
309 i18nc(
"unit description in lists",
"decibel microwatts"),
310 i18nc(
"unit synonyms for matching user input",
"dBuW;dBµW;dB(uW);dB(µW)"),
312 ki18nc(
"amount in units (real)",
"%1 decibel microwatts"),
313 ki18ncp(
"amount in units (integer)",
"%1 decibel microwatt",
"%1 decibel microwatts"))));
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...)