]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
374ca955 A |
3 | /* |
4 | ********************************************************************** | |
2ca993e8 | 5 | * Copyright (c) 2004-2016, International Business Machines |
374ca955 A |
6 | * Corporation and others. All Rights Reserved. |
7 | ********************************************************************** | |
8 | * Author: Alan Liu | |
9 | * Created: April 26, 2004 | |
10 | * Since: ICU 3.0 | |
11 | ********************************************************************** | |
12 | */ | |
13 | #ifndef __MEASUREUNIT_H__ | |
14 | #define __MEASUREUNIT_H__ | |
15 | ||
16 | #include "unicode/utypes.h" | |
17 | ||
18 | #if !UCONFIG_NO_FORMATTING | |
19 | ||
57a6839d | 20 | #include "unicode/unistr.h" |
374ca955 | 21 | |
73c04bcf A |
22 | /** |
23 | * \file | |
24 | * \brief C++ API: A unit for measuring a quantity. | |
25 | */ | |
26 | ||
f3c0d7a5 | 27 | #if U_SHOW_CPLUSPLUS_API |
374ca955 A |
28 | U_NAMESPACE_BEGIN |
29 | ||
57a6839d A |
30 | class StringEnumeration; |
31 | ||
374ca955 A |
32 | /** |
33 | * A unit such as length, mass, volume, currency, etc. A unit is | |
34 | * coupled with a numeric amount to produce a Measure. | |
35 | * | |
374ca955 | 36 | * @author Alan Liu |
73c04bcf | 37 | * @stable ICU 3.0 |
374ca955 A |
38 | */ |
39 | class U_I18N_API MeasureUnit: public UObject { | |
40 | public: | |
57a6839d A |
41 | |
42 | /** | |
43 | * Default constructor. | |
0f5d89e8 | 44 | * Populates the instance with the base dimensionless unit. |
57a6839d A |
45 | * @stable ICU 3.0 |
46 | */ | |
0f5d89e8 | 47 | MeasureUnit(); |
57a6839d A |
48 | |
49 | /** | |
50 | * Copy constructor. | |
b331163b | 51 | * @stable ICU 3.0 |
57a6839d A |
52 | */ |
53 | MeasureUnit(const MeasureUnit &other); | |
54 | ||
55 | /** | |
56 | * Assignment operator. | |
b331163b | 57 | * @stable ICU 3.0 |
57a6839d A |
58 | */ |
59 | MeasureUnit &operator=(const MeasureUnit &other); | |
60 | ||
374ca955 | 61 | /** |
57a6839d | 62 | * Returns a polymorphic clone of this object. The result will |
374ca955 | 63 | * have the same class as returned by getDynamicClassID(). |
73c04bcf | 64 | * @stable ICU 3.0 |
374ca955 | 65 | */ |
57a6839d | 66 | virtual UObject* clone() const; |
374ca955 A |
67 | |
68 | /** | |
69 | * Destructor | |
73c04bcf | 70 | * @stable ICU 3.0 |
374ca955 A |
71 | */ |
72 | virtual ~MeasureUnit(); | |
57a6839d | 73 | |
374ca955 A |
74 | /** |
75 | * Equality operator. Return true if this object is equal | |
76 | * to the given object. | |
73c04bcf | 77 | * @stable ICU 3.0 |
374ca955 | 78 | */ |
57a6839d A |
79 | virtual UBool operator==(const UObject& other) const; |
80 | ||
57a6839d A |
81 | /** |
82 | * Inequality operator. Return true if this object is not equal | |
83 | * to the given object. | |
b331163b | 84 | * @stable ICU 53 |
57a6839d A |
85 | */ |
86 | UBool operator!=(const UObject& other) const { | |
87 | return !(*this == other); | |
88 | } | |
89 | ||
90 | /** | |
91 | * Get the type. | |
b331163b | 92 | * @stable ICU 53 |
57a6839d A |
93 | */ |
94 | const char *getType() const; | |
95 | ||
96 | /** | |
97 | * Get the sub type. | |
b331163b | 98 | * @stable ICU 53 |
57a6839d A |
99 | */ |
100 | const char *getSubtype() const; | |
101 | ||
102 | /** | |
103 | * getAvailable gets all of the available units. | |
104 | * If there are too many units to fit into destCapacity then the | |
105 | * error code is set to U_BUFFER_OVERFLOW_ERROR. | |
106 | * | |
107 | * @param destArray destination buffer. | |
108 | * @param destCapacity number of MeasureUnit instances available at dest. | |
109 | * @param errorCode ICU error code. | |
110 | * @return number of available units. | |
b331163b | 111 | * @stable ICU 53 |
57a6839d A |
112 | */ |
113 | static int32_t getAvailable( | |
114 | MeasureUnit *destArray, | |
115 | int32_t destCapacity, | |
116 | UErrorCode &errorCode); | |
117 | ||
118 | /** | |
119 | * getAvailable gets all of the available units for a specific type. | |
120 | * If there are too many units to fit into destCapacity then the | |
121 | * error code is set to U_BUFFER_OVERFLOW_ERROR. | |
122 | * | |
123 | * @param type the type | |
124 | * @param destArray destination buffer. | |
125 | * @param destCapacity number of MeasureUnit instances available at dest. | |
126 | * @param errorCode ICU error code. | |
127 | * @return number of available units for type. | |
b331163b | 128 | * @stable ICU 53 |
57a6839d A |
129 | */ |
130 | static int32_t getAvailable( | |
131 | const char *type, | |
132 | MeasureUnit *destArray, | |
133 | int32_t destCapacity, | |
134 | UErrorCode &errorCode); | |
135 | ||
136 | /** | |
137 | * getAvailableTypes gets all of the available types. Caller owns the | |
138 | * returned StringEnumeration and must delete it when finished using it. | |
139 | * | |
140 | * @param errorCode ICU error code. | |
141 | * @return the types. | |
b331163b | 142 | * @stable ICU 53 |
57a6839d A |
143 | */ |
144 | static StringEnumeration* getAvailableTypes(UErrorCode &errorCode); | |
57a6839d A |
145 | |
146 | /** | |
147 | * Return the class ID for this class. This is useful only for comparing to | |
148 | * a return value from getDynamicClassID(). For example: | |
149 | * <pre> | |
150 | * . Base* polymorphic_pointer = createPolymorphicObject(); | |
151 | * . if (polymorphic_pointer->getDynamicClassID() == | |
0f5d89e8 | 152 | * . Derived::getStaticClassID()) ... |
57a6839d A |
153 | * </pre> |
154 | * @return The class ID for all objects of this class. | |
b331163b | 155 | * @stable ICU 53 |
57a6839d A |
156 | */ |
157 | static UClassID U_EXPORT2 getStaticClassID(void); | |
158 | ||
159 | /** | |
160 | * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This | |
161 | * method is to implement a simple version of RTTI, since not all C++ | |
162 | * compilers support genuine RTTI. Polymorphic operator==() and clone() | |
163 | * methods call this method. | |
164 | * | |
165 | * @return The class ID for this object. All objects of a | |
166 | * given class have the same class ID. Objects of | |
167 | * other classes have different class IDs. | |
b331163b | 168 | * @stable ICU 53 |
57a6839d A |
169 | */ |
170 | virtual UClassID getDynamicClassID(void) const; | |
171 | ||
172 | #ifndef U_HIDE_INTERNAL_API | |
173 | /** | |
174 | * ICU use only. | |
175 | * Returns associated array index for this measure unit. Only valid for | |
176 | * non-currency measure units. | |
177 | * @internal | |
178 | */ | |
179 | int32_t getIndex() const; | |
180 | ||
181 | /** | |
182 | * ICU use only. | |
183 | * Returns maximum value from getIndex plus 1. | |
184 | * @internal | |
185 | */ | |
186 | static int32_t getIndexCount(); | |
b331163b | 187 | |
2ca993e8 A |
188 | /** |
189 | * ICU use only. | |
190 | * @return the unit.getIndex() of the unit which has this unit.getType() and unit.getSubtype(), | |
191 | * or a negative value if there is no such unit | |
192 | * @internal | |
193 | */ | |
194 | static int32_t internalGetIndexForTypeAndSubtype(const char *type, const char *subtype); | |
195 | ||
b331163b A |
196 | /** |
197 | * ICU use only. | |
198 | * @internal | |
199 | */ | |
0f5d89e8 A |
200 | static MeasureUnit resolveUnitPerUnit( |
201 | const MeasureUnit &unit, const MeasureUnit &perUnit, bool* isResolved); | |
57a6839d A |
202 | #endif /* U_HIDE_INTERNAL_API */ |
203 | ||
b331163b A |
204 | // All code between the "Start generated createXXX methods" comment and |
205 | // the "End generated createXXX methods" comment is auto generated code | |
206 | // and must not be edited manually. For instructions on how to correctly | |
207 | // update this code, refer to: | |
208 | // http://site.icu-project.org/design/formatting/measureformat/updating-measure-unit | |
209 | // | |
57a6839d A |
210 | // Start generated createXXX methods |
211 | ||
57a6839d | 212 | /** |
b331163b | 213 | * Returns unit of acceleration: g-force. |
57a6839d A |
214 | * Caller owns returned value and must free it. |
215 | * @param status ICU error code. | |
b331163b | 216 | * @stable ICU 53 |
57a6839d A |
217 | */ |
218 | static MeasureUnit *createGForce(UErrorCode &status); | |
219 | ||
b331163b A |
220 | /** |
221 | * Returns unit of acceleration: meter-per-second-squared. | |
222 | * Caller owns returned value and must free it. | |
223 | * @param status ICU error code. | |
2ca993e8 | 224 | * @stable ICU 54 |
b331163b A |
225 | */ |
226 | static MeasureUnit *createMeterPerSecondSquared(UErrorCode &status); | |
227 | ||
57a6839d | 228 | /** |
b331163b | 229 | * Returns unit of angle: arc-minute. |
57a6839d A |
230 | * Caller owns returned value and must free it. |
231 | * @param status ICU error code. | |
b331163b | 232 | * @stable ICU 53 |
57a6839d A |
233 | */ |
234 | static MeasureUnit *createArcMinute(UErrorCode &status); | |
235 | ||
236 | /** | |
b331163b | 237 | * Returns unit of angle: arc-second. |
57a6839d A |
238 | * Caller owns returned value and must free it. |
239 | * @param status ICU error code. | |
b331163b | 240 | * @stable ICU 53 |
57a6839d A |
241 | */ |
242 | static MeasureUnit *createArcSecond(UErrorCode &status); | |
243 | ||
244 | /** | |
b331163b | 245 | * Returns unit of angle: degree. |
57a6839d A |
246 | * Caller owns returned value and must free it. |
247 | * @param status ICU error code. | |
b331163b | 248 | * @stable ICU 53 |
57a6839d A |
249 | */ |
250 | static MeasureUnit *createDegree(UErrorCode &status); | |
251 | ||
b331163b A |
252 | /** |
253 | * Returns unit of angle: radian. | |
254 | * Caller owns returned value and must free it. | |
255 | * @param status ICU error code. | |
2ca993e8 | 256 | * @stable ICU 54 |
b331163b A |
257 | */ |
258 | static MeasureUnit *createRadian(UErrorCode &status); | |
259 | ||
2ca993e8 A |
260 | /** |
261 | * Returns unit of angle: revolution. | |
262 | * Caller owns returned value and must free it. | |
263 | * @param status ICU error code. | |
f3c0d7a5 | 264 | * @stable ICU 56 |
2ca993e8 A |
265 | */ |
266 | static MeasureUnit *createRevolutionAngle(UErrorCode &status); | |
2ca993e8 | 267 | |
57a6839d | 268 | /** |
b331163b | 269 | * Returns unit of area: acre. |
57a6839d A |
270 | * Caller owns returned value and must free it. |
271 | * @param status ICU error code. | |
b331163b | 272 | * @stable ICU 53 |
57a6839d A |
273 | */ |
274 | static MeasureUnit *createAcre(UErrorCode &status); | |
275 | ||
276 | /** | |
b331163b | 277 | * Returns unit of area: hectare. |
57a6839d A |
278 | * Caller owns returned value and must free it. |
279 | * @param status ICU error code. | |
b331163b | 280 | * @stable ICU 53 |
57a6839d A |
281 | */ |
282 | static MeasureUnit *createHectare(UErrorCode &status); | |
283 | ||
b331163b A |
284 | /** |
285 | * Returns unit of area: square-centimeter. | |
286 | * Caller owns returned value and must free it. | |
287 | * @param status ICU error code. | |
2ca993e8 | 288 | * @stable ICU 54 |
b331163b A |
289 | */ |
290 | static MeasureUnit *createSquareCentimeter(UErrorCode &status); | |
291 | ||
57a6839d | 292 | /** |
b331163b | 293 | * Returns unit of area: square-foot. |
57a6839d A |
294 | * Caller owns returned value and must free it. |
295 | * @param status ICU error code. | |
b331163b | 296 | * @stable ICU 53 |
57a6839d A |
297 | */ |
298 | static MeasureUnit *createSquareFoot(UErrorCode &status); | |
299 | ||
b331163b A |
300 | /** |
301 | * Returns unit of area: square-inch. | |
302 | * Caller owns returned value and must free it. | |
303 | * @param status ICU error code. | |
2ca993e8 | 304 | * @stable ICU 54 |
b331163b A |
305 | */ |
306 | static MeasureUnit *createSquareInch(UErrorCode &status); | |
307 | ||
57a6839d | 308 | /** |
b331163b | 309 | * Returns unit of area: square-kilometer. |
57a6839d A |
310 | * Caller owns returned value and must free it. |
311 | * @param status ICU error code. | |
b331163b | 312 | * @stable ICU 53 |
57a6839d A |
313 | */ |
314 | static MeasureUnit *createSquareKilometer(UErrorCode &status); | |
315 | ||
316 | /** | |
b331163b | 317 | * Returns unit of area: square-meter. |
57a6839d A |
318 | * Caller owns returned value and must free it. |
319 | * @param status ICU error code. | |
b331163b | 320 | * @stable ICU 53 |
57a6839d A |
321 | */ |
322 | static MeasureUnit *createSquareMeter(UErrorCode &status); | |
323 | ||
324 | /** | |
b331163b | 325 | * Returns unit of area: square-mile. |
57a6839d A |
326 | * Caller owns returned value and must free it. |
327 | * @param status ICU error code. | |
b331163b | 328 | * @stable ICU 53 |
57a6839d A |
329 | */ |
330 | static MeasureUnit *createSquareMile(UErrorCode &status); | |
331 | ||
b331163b A |
332 | /** |
333 | * Returns unit of area: square-yard. | |
334 | * Caller owns returned value and must free it. | |
335 | * @param status ICU error code. | |
2ca993e8 | 336 | * @stable ICU 54 |
b331163b A |
337 | */ |
338 | static MeasureUnit *createSquareYard(UErrorCode &status); | |
339 | ||
2ca993e8 A |
340 | /** |
341 | * Returns unit of concentr: karat. | |
342 | * Caller owns returned value and must free it. | |
343 | * @param status ICU error code. | |
344 | * @stable ICU 54 | |
345 | */ | |
346 | static MeasureUnit *createKarat(UErrorCode &status); | |
347 | ||
2ca993e8 A |
348 | /** |
349 | * Returns unit of concentr: milligram-per-deciliter. | |
350 | * Caller owns returned value and must free it. | |
351 | * @param status ICU error code. | |
f3c0d7a5 | 352 | * @stable ICU 57 |
2ca993e8 A |
353 | */ |
354 | static MeasureUnit *createMilligramPerDeciliter(UErrorCode &status); | |
2ca993e8 | 355 | |
2ca993e8 A |
356 | /** |
357 | * Returns unit of concentr: millimole-per-liter. | |
358 | * Caller owns returned value and must free it. | |
359 | * @param status ICU error code. | |
f3c0d7a5 | 360 | * @stable ICU 57 |
2ca993e8 A |
361 | */ |
362 | static MeasureUnit *createMillimolePerLiter(UErrorCode &status); | |
2ca993e8 | 363 | |
2ca993e8 A |
364 | /** |
365 | * Returns unit of concentr: part-per-million. | |
366 | * Caller owns returned value and must free it. | |
367 | * @param status ICU error code. | |
f3c0d7a5 | 368 | * @stable ICU 57 |
2ca993e8 A |
369 | */ |
370 | static MeasureUnit *createPartPerMillion(UErrorCode &status); | |
2ca993e8 | 371 | |
2ca993e8 A |
372 | /** |
373 | * Returns unit of consumption: liter-per-100kilometers. | |
374 | * Caller owns returned value and must free it. | |
375 | * @param status ICU error code. | |
f3c0d7a5 | 376 | * @stable ICU 56 |
2ca993e8 A |
377 | */ |
378 | static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status); | |
2ca993e8 | 379 | |
b331163b A |
380 | /** |
381 | * Returns unit of consumption: liter-per-kilometer. | |
382 | * Caller owns returned value and must free it. | |
383 | * @param status ICU error code. | |
2ca993e8 | 384 | * @stable ICU 54 |
b331163b A |
385 | */ |
386 | static MeasureUnit *createLiterPerKilometer(UErrorCode &status); | |
387 | ||
b331163b A |
388 | /** |
389 | * Returns unit of consumption: mile-per-gallon. | |
390 | * Caller owns returned value and must free it. | |
391 | * @param status ICU error code. | |
2ca993e8 | 392 | * @stable ICU 54 |
b331163b A |
393 | */ |
394 | static MeasureUnit *createMilePerGallon(UErrorCode &status); | |
395 | ||
2ca993e8 A |
396 | /** |
397 | * Returns unit of consumption: mile-per-gallon-imperial. | |
398 | * Caller owns returned value and must free it. | |
399 | * @param status ICU error code. | |
f3c0d7a5 | 400 | * @stable ICU 57 |
2ca993e8 A |
401 | */ |
402 | static MeasureUnit *createMilePerGallonImperial(UErrorCode &status); | |
f3c0d7a5 | 403 | |
b331163b A |
404 | /** |
405 | * Returns unit of digital: bit. | |
406 | * Caller owns returned value and must free it. | |
407 | * @param status ICU error code. | |
2ca993e8 | 408 | * @stable ICU 54 |
b331163b A |
409 | */ |
410 | static MeasureUnit *createBit(UErrorCode &status); | |
411 | ||
b331163b A |
412 | /** |
413 | * Returns unit of digital: byte. | |
414 | * Caller owns returned value and must free it. | |
415 | * @param status ICU error code. | |
2ca993e8 | 416 | * @stable ICU 54 |
b331163b A |
417 | */ |
418 | static MeasureUnit *createByte(UErrorCode &status); | |
419 | ||
b331163b A |
420 | /** |
421 | * Returns unit of digital: gigabit. | |
422 | * Caller owns returned value and must free it. | |
423 | * @param status ICU error code. | |
2ca993e8 | 424 | * @stable ICU 54 |
b331163b A |
425 | */ |
426 | static MeasureUnit *createGigabit(UErrorCode &status); | |
427 | ||
b331163b A |
428 | /** |
429 | * Returns unit of digital: gigabyte. | |
430 | * Caller owns returned value and must free it. | |
431 | * @param status ICU error code. | |
2ca993e8 | 432 | * @stable ICU 54 |
b331163b A |
433 | */ |
434 | static MeasureUnit *createGigabyte(UErrorCode &status); | |
435 | ||
b331163b A |
436 | /** |
437 | * Returns unit of digital: kilobit. | |
438 | * Caller owns returned value and must free it. | |
439 | * @param status ICU error code. | |
2ca993e8 | 440 | * @stable ICU 54 |
b331163b A |
441 | */ |
442 | static MeasureUnit *createKilobit(UErrorCode &status); | |
443 | ||
b331163b A |
444 | /** |
445 | * Returns unit of digital: kilobyte. | |
446 | * Caller owns returned value and must free it. | |
447 | * @param status ICU error code. | |
2ca993e8 | 448 | * @stable ICU 54 |
b331163b A |
449 | */ |
450 | static MeasureUnit *createKilobyte(UErrorCode &status); | |
451 | ||
b331163b A |
452 | /** |
453 | * Returns unit of digital: megabit. | |
454 | * Caller owns returned value and must free it. | |
455 | * @param status ICU error code. | |
2ca993e8 | 456 | * @stable ICU 54 |
b331163b A |
457 | */ |
458 | static MeasureUnit *createMegabit(UErrorCode &status); | |
459 | ||
b331163b A |
460 | /** |
461 | * Returns unit of digital: megabyte. | |
462 | * Caller owns returned value and must free it. | |
463 | * @param status ICU error code. | |
2ca993e8 | 464 | * @stable ICU 54 |
b331163b A |
465 | */ |
466 | static MeasureUnit *createMegabyte(UErrorCode &status); | |
467 | ||
b331163b A |
468 | /** |
469 | * Returns unit of digital: terabit. | |
470 | * Caller owns returned value and must free it. | |
471 | * @param status ICU error code. | |
2ca993e8 | 472 | * @stable ICU 54 |
b331163b A |
473 | */ |
474 | static MeasureUnit *createTerabit(UErrorCode &status); | |
475 | ||
b331163b A |
476 | /** |
477 | * Returns unit of digital: terabyte. | |
478 | * Caller owns returned value and must free it. | |
479 | * @param status ICU error code. | |
2ca993e8 | 480 | * @stable ICU 54 |
b331163b A |
481 | */ |
482 | static MeasureUnit *createTerabyte(UErrorCode &status); | |
483 | ||
2ca993e8 A |
484 | /** |
485 | * Returns unit of duration: century. | |
486 | * Caller owns returned value and must free it. | |
487 | * @param status ICU error code. | |
f3c0d7a5 | 488 | * @stable ICU 56 |
2ca993e8 A |
489 | */ |
490 | static MeasureUnit *createCentury(UErrorCode &status); | |
2ca993e8 | 491 | |
57a6839d | 492 | /** |
b331163b | 493 | * Returns unit of duration: day. |
57a6839d A |
494 | * Caller owns returned value and must free it. |
495 | * @param status ICU error code. | |
b331163b | 496 | * @stable ICU 53 |
57a6839d A |
497 | */ |
498 | static MeasureUnit *createDay(UErrorCode &status); | |
499 | ||
500 | /** | |
b331163b | 501 | * Returns unit of duration: hour. |
57a6839d A |
502 | * Caller owns returned value and must free it. |
503 | * @param status ICU error code. | |
b331163b | 504 | * @stable ICU 53 |
57a6839d A |
505 | */ |
506 | static MeasureUnit *createHour(UErrorCode &status); | |
507 | ||
b331163b A |
508 | /** |
509 | * Returns unit of duration: microsecond. | |
510 | * Caller owns returned value and must free it. | |
511 | * @param status ICU error code. | |
2ca993e8 | 512 | * @stable ICU 54 |
b331163b A |
513 | */ |
514 | static MeasureUnit *createMicrosecond(UErrorCode &status); | |
515 | ||
57a6839d | 516 | /** |
b331163b | 517 | * Returns unit of duration: millisecond. |
57a6839d A |
518 | * Caller owns returned value and must free it. |
519 | * @param status ICU error code. | |
b331163b | 520 | * @stable ICU 53 |
57a6839d A |
521 | */ |
522 | static MeasureUnit *createMillisecond(UErrorCode &status); | |
523 | ||
524 | /** | |
b331163b | 525 | * Returns unit of duration: minute. |
57a6839d A |
526 | * Caller owns returned value and must free it. |
527 | * @param status ICU error code. | |
b331163b | 528 | * @stable ICU 53 |
57a6839d A |
529 | */ |
530 | static MeasureUnit *createMinute(UErrorCode &status); | |
531 | ||
532 | /** | |
b331163b | 533 | * Returns unit of duration: month. |
57a6839d A |
534 | * Caller owns returned value and must free it. |
535 | * @param status ICU error code. | |
b331163b | 536 | * @stable ICU 53 |
57a6839d A |
537 | */ |
538 | static MeasureUnit *createMonth(UErrorCode &status); | |
539 | ||
b331163b A |
540 | /** |
541 | * Returns unit of duration: nanosecond. | |
542 | * Caller owns returned value and must free it. | |
543 | * @param status ICU error code. | |
2ca993e8 | 544 | * @stable ICU 54 |
b331163b A |
545 | */ |
546 | static MeasureUnit *createNanosecond(UErrorCode &status); | |
547 | ||
57a6839d | 548 | /** |
b331163b | 549 | * Returns unit of duration: second. |
57a6839d A |
550 | * Caller owns returned value and must free it. |
551 | * @param status ICU error code. | |
b331163b | 552 | * @stable ICU 53 |
57a6839d A |
553 | */ |
554 | static MeasureUnit *createSecond(UErrorCode &status); | |
555 | ||
556 | /** | |
b331163b | 557 | * Returns unit of duration: week. |
57a6839d A |
558 | * Caller owns returned value and must free it. |
559 | * @param status ICU error code. | |
b331163b | 560 | * @stable ICU 53 |
57a6839d A |
561 | */ |
562 | static MeasureUnit *createWeek(UErrorCode &status); | |
563 | ||
564 | /** | |
b331163b | 565 | * Returns unit of duration: year. |
57a6839d A |
566 | * Caller owns returned value and must free it. |
567 | * @param status ICU error code. | |
b331163b | 568 | * @stable ICU 53 |
57a6839d A |
569 | */ |
570 | static MeasureUnit *createYear(UErrorCode &status); | |
571 | ||
572 | /** | |
b331163b | 573 | * Returns unit of electric: ampere. |
57a6839d A |
574 | * Caller owns returned value and must free it. |
575 | * @param status ICU error code. | |
2ca993e8 | 576 | * @stable ICU 54 |
57a6839d | 577 | */ |
b331163b | 578 | static MeasureUnit *createAmpere(UErrorCode &status); |
57a6839d A |
579 | |
580 | /** | |
b331163b | 581 | * Returns unit of electric: milliampere. |
57a6839d A |
582 | * Caller owns returned value and must free it. |
583 | * @param status ICU error code. | |
2ca993e8 | 584 | * @stable ICU 54 |
57a6839d | 585 | */ |
b331163b | 586 | static MeasureUnit *createMilliampere(UErrorCode &status); |
57a6839d A |
587 | |
588 | /** | |
b331163b | 589 | * Returns unit of electric: ohm. |
57a6839d A |
590 | * Caller owns returned value and must free it. |
591 | * @param status ICU error code. | |
2ca993e8 | 592 | * @stable ICU 54 |
57a6839d | 593 | */ |
b331163b | 594 | static MeasureUnit *createOhm(UErrorCode &status); |
57a6839d A |
595 | |
596 | /** | |
b331163b | 597 | * Returns unit of electric: volt. |
57a6839d A |
598 | * Caller owns returned value and must free it. |
599 | * @param status ICU error code. | |
2ca993e8 | 600 | * @stable ICU 54 |
57a6839d | 601 | */ |
b331163b | 602 | static MeasureUnit *createVolt(UErrorCode &status); |
57a6839d A |
603 | |
604 | /** | |
b331163b | 605 | * Returns unit of energy: calorie. |
57a6839d A |
606 | * Caller owns returned value and must free it. |
607 | * @param status ICU error code. | |
2ca993e8 | 608 | * @stable ICU 54 |
57a6839d | 609 | */ |
b331163b | 610 | static MeasureUnit *createCalorie(UErrorCode &status); |
57a6839d A |
611 | |
612 | /** | |
b331163b | 613 | * Returns unit of energy: foodcalorie. |
57a6839d A |
614 | * Caller owns returned value and must free it. |
615 | * @param status ICU error code. | |
2ca993e8 | 616 | * @stable ICU 54 |
57a6839d | 617 | */ |
b331163b | 618 | static MeasureUnit *createFoodcalorie(UErrorCode &status); |
57a6839d A |
619 | |
620 | /** | |
b331163b | 621 | * Returns unit of energy: joule. |
57a6839d A |
622 | * Caller owns returned value and must free it. |
623 | * @param status ICU error code. | |
2ca993e8 | 624 | * @stable ICU 54 |
57a6839d | 625 | */ |
b331163b | 626 | static MeasureUnit *createJoule(UErrorCode &status); |
57a6839d A |
627 | |
628 | /** | |
b331163b | 629 | * Returns unit of energy: kilocalorie. |
57a6839d A |
630 | * Caller owns returned value and must free it. |
631 | * @param status ICU error code. | |
2ca993e8 | 632 | * @stable ICU 54 |
57a6839d | 633 | */ |
b331163b | 634 | static MeasureUnit *createKilocalorie(UErrorCode &status); |
57a6839d A |
635 | |
636 | /** | |
b331163b | 637 | * Returns unit of energy: kilojoule. |
57a6839d A |
638 | * Caller owns returned value and must free it. |
639 | * @param status ICU error code. | |
2ca993e8 | 640 | * @stable ICU 54 |
57a6839d | 641 | */ |
b331163b | 642 | static MeasureUnit *createKilojoule(UErrorCode &status); |
57a6839d A |
643 | |
644 | /** | |
b331163b | 645 | * Returns unit of energy: kilowatt-hour. |
57a6839d A |
646 | * Caller owns returned value and must free it. |
647 | * @param status ICU error code. | |
2ca993e8 | 648 | * @stable ICU 54 |
57a6839d | 649 | */ |
b331163b | 650 | static MeasureUnit *createKilowattHour(UErrorCode &status); |
57a6839d A |
651 | |
652 | /** | |
b331163b | 653 | * Returns unit of frequency: gigahertz. |
57a6839d A |
654 | * Caller owns returned value and must free it. |
655 | * @param status ICU error code. | |
2ca993e8 | 656 | * @stable ICU 54 |
57a6839d | 657 | */ |
b331163b | 658 | static MeasureUnit *createGigahertz(UErrorCode &status); |
57a6839d A |
659 | |
660 | /** | |
b331163b | 661 | * Returns unit of frequency: hertz. |
57a6839d A |
662 | * Caller owns returned value and must free it. |
663 | * @param status ICU error code. | |
2ca993e8 | 664 | * @stable ICU 54 |
57a6839d | 665 | */ |
b331163b | 666 | static MeasureUnit *createHertz(UErrorCode &status); |
57a6839d A |
667 | |
668 | /** | |
b331163b | 669 | * Returns unit of frequency: kilohertz. |
57a6839d A |
670 | * Caller owns returned value and must free it. |
671 | * @param status ICU error code. | |
2ca993e8 | 672 | * @stable ICU 54 |
57a6839d | 673 | */ |
b331163b | 674 | static MeasureUnit *createKilohertz(UErrorCode &status); |
57a6839d A |
675 | |
676 | /** | |
b331163b | 677 | * Returns unit of frequency: megahertz. |
57a6839d A |
678 | * Caller owns returned value and must free it. |
679 | * @param status ICU error code. | |
2ca993e8 | 680 | * @stable ICU 54 |
57a6839d | 681 | */ |
b331163b | 682 | static MeasureUnit *createMegahertz(UErrorCode &status); |
57a6839d A |
683 | |
684 | /** | |
b331163b | 685 | * Returns unit of length: astronomical-unit. |
57a6839d A |
686 | * Caller owns returned value and must free it. |
687 | * @param status ICU error code. | |
2ca993e8 | 688 | * @stable ICU 54 |
57a6839d | 689 | */ |
b331163b | 690 | static MeasureUnit *createAstronomicalUnit(UErrorCode &status); |
57a6839d A |
691 | |
692 | /** | |
b331163b | 693 | * Returns unit of length: centimeter. |
57a6839d A |
694 | * Caller owns returned value and must free it. |
695 | * @param status ICU error code. | |
b331163b | 696 | * @stable ICU 53 |
57a6839d | 697 | */ |
b331163b | 698 | static MeasureUnit *createCentimeter(UErrorCode &status); |
57a6839d A |
699 | |
700 | /** | |
b331163b | 701 | * Returns unit of length: decimeter. |
57a6839d A |
702 | * Caller owns returned value and must free it. |
703 | * @param status ICU error code. | |
2ca993e8 | 704 | * @stable ICU 54 |
57a6839d | 705 | */ |
b331163b | 706 | static MeasureUnit *createDecimeter(UErrorCode &status); |
57a6839d A |
707 | |
708 | /** | |
b331163b | 709 | * Returns unit of length: fathom. |
57a6839d A |
710 | * Caller owns returned value and must free it. |
711 | * @param status ICU error code. | |
2ca993e8 | 712 | * @stable ICU 54 |
57a6839d | 713 | */ |
b331163b | 714 | static MeasureUnit *createFathom(UErrorCode &status); |
57a6839d A |
715 | |
716 | /** | |
b331163b | 717 | * Returns unit of length: foot. |
57a6839d A |
718 | * Caller owns returned value and must free it. |
719 | * @param status ICU error code. | |
b331163b | 720 | * @stable ICU 53 |
57a6839d | 721 | */ |
b331163b | 722 | static MeasureUnit *createFoot(UErrorCode &status); |
57a6839d A |
723 | |
724 | /** | |
b331163b | 725 | * Returns unit of length: furlong. |
57a6839d A |
726 | * Caller owns returned value and must free it. |
727 | * @param status ICU error code. | |
2ca993e8 | 728 | * @stable ICU 54 |
57a6839d | 729 | */ |
b331163b | 730 | static MeasureUnit *createFurlong(UErrorCode &status); |
57a6839d A |
731 | |
732 | /** | |
b331163b | 733 | * Returns unit of length: inch. |
57a6839d A |
734 | * Caller owns returned value and must free it. |
735 | * @param status ICU error code. | |
b331163b | 736 | * @stable ICU 53 |
57a6839d | 737 | */ |
b331163b | 738 | static MeasureUnit *createInch(UErrorCode &status); |
57a6839d A |
739 | |
740 | /** | |
b331163b | 741 | * Returns unit of length: kilometer. |
57a6839d A |
742 | * Caller owns returned value and must free it. |
743 | * @param status ICU error code. | |
b331163b | 744 | * @stable ICU 53 |
57a6839d | 745 | */ |
b331163b | 746 | static MeasureUnit *createKilometer(UErrorCode &status); |
57a6839d A |
747 | |
748 | /** | |
b331163b | 749 | * Returns unit of length: light-year. |
57a6839d A |
750 | * Caller owns returned value and must free it. |
751 | * @param status ICU error code. | |
b331163b | 752 | * @stable ICU 53 |
57a6839d | 753 | */ |
b331163b | 754 | static MeasureUnit *createLightYear(UErrorCode &status); |
57a6839d A |
755 | |
756 | /** | |
b331163b | 757 | * Returns unit of length: meter. |
57a6839d A |
758 | * Caller owns returned value and must free it. |
759 | * @param status ICU error code. | |
b331163b | 760 | * @stable ICU 53 |
57a6839d | 761 | */ |
b331163b | 762 | static MeasureUnit *createMeter(UErrorCode &status); |
57a6839d A |
763 | |
764 | /** | |
b331163b | 765 | * Returns unit of length: micrometer. |
57a6839d A |
766 | * Caller owns returned value and must free it. |
767 | * @param status ICU error code. | |
2ca993e8 | 768 | * @stable ICU 54 |
57a6839d | 769 | */ |
b331163b | 770 | static MeasureUnit *createMicrometer(UErrorCode &status); |
57a6839d A |
771 | |
772 | /** | |
b331163b | 773 | * Returns unit of length: mile. |
57a6839d A |
774 | * Caller owns returned value and must free it. |
775 | * @param status ICU error code. | |
b331163b | 776 | * @stable ICU 53 |
57a6839d | 777 | */ |
b331163b | 778 | static MeasureUnit *createMile(UErrorCode &status); |
57a6839d | 779 | |
2ca993e8 A |
780 | /** |
781 | * Returns unit of length: mile-scandinavian. | |
782 | * Caller owns returned value and must free it. | |
783 | * @param status ICU error code. | |
f3c0d7a5 | 784 | * @stable ICU 56 |
2ca993e8 A |
785 | */ |
786 | static MeasureUnit *createMileScandinavian(UErrorCode &status); | |
2ca993e8 | 787 | |
57a6839d | 788 | /** |
b331163b | 789 | * Returns unit of length: millimeter. |
57a6839d A |
790 | * Caller owns returned value and must free it. |
791 | * @param status ICU error code. | |
b331163b | 792 | * @stable ICU 53 |
57a6839d | 793 | */ |
b331163b | 794 | static MeasureUnit *createMillimeter(UErrorCode &status); |
57a6839d A |
795 | |
796 | /** | |
b331163b | 797 | * Returns unit of length: nanometer. |
57a6839d A |
798 | * Caller owns returned value and must free it. |
799 | * @param status ICU error code. | |
2ca993e8 | 800 | * @stable ICU 54 |
57a6839d | 801 | */ |
b331163b | 802 | static MeasureUnit *createNanometer(UErrorCode &status); |
57a6839d A |
803 | |
804 | /** | |
b331163b | 805 | * Returns unit of length: nautical-mile. |
57a6839d A |
806 | * Caller owns returned value and must free it. |
807 | * @param status ICU error code. | |
2ca993e8 | 808 | * @stable ICU 54 |
57a6839d | 809 | */ |
b331163b | 810 | static MeasureUnit *createNauticalMile(UErrorCode &status); |
57a6839d A |
811 | |
812 | /** | |
b331163b | 813 | * Returns unit of length: parsec. |
57a6839d A |
814 | * Caller owns returned value and must free it. |
815 | * @param status ICU error code. | |
2ca993e8 | 816 | * @stable ICU 54 |
57a6839d | 817 | */ |
b331163b A |
818 | static MeasureUnit *createParsec(UErrorCode &status); |
819 | ||
b331163b A |
820 | /** |
821 | * Returns unit of length: picometer. | |
822 | * Caller owns returned value and must free it. | |
823 | * @param status ICU error code. | |
824 | * @stable ICU 53 | |
825 | */ | |
826 | static MeasureUnit *createPicometer(UErrorCode &status); | |
827 | ||
f3c0d7a5 A |
828 | /** |
829 | * Returns unit of length: point. | |
830 | * Caller owns returned value and must free it. | |
831 | * @param status ICU error code. | |
0f5d89e8 | 832 | * @stable ICU 59 |
f3c0d7a5 A |
833 | */ |
834 | static MeasureUnit *createPoint(UErrorCode &status); | |
f3c0d7a5 | 835 | |
b331163b A |
836 | /** |
837 | * Returns unit of length: yard. | |
838 | * Caller owns returned value and must free it. | |
839 | * @param status ICU error code. | |
840 | * @stable ICU 53 | |
841 | */ | |
842 | static MeasureUnit *createYard(UErrorCode &status); | |
843 | ||
b331163b A |
844 | /** |
845 | * Returns unit of light: lux. | |
846 | * Caller owns returned value and must free it. | |
847 | * @param status ICU error code. | |
2ca993e8 | 848 | * @stable ICU 54 |
b331163b A |
849 | */ |
850 | static MeasureUnit *createLux(UErrorCode &status); | |
57a6839d | 851 | |
b331163b A |
852 | /** |
853 | * Returns unit of mass: carat. | |
854 | * Caller owns returned value and must free it. | |
855 | * @param status ICU error code. | |
2ca993e8 | 856 | * @stable ICU 54 |
b331163b A |
857 | */ |
858 | static MeasureUnit *createCarat(UErrorCode &status); | |
859 | ||
b331163b A |
860 | /** |
861 | * Returns unit of mass: gram. | |
862 | * Caller owns returned value and must free it. | |
863 | * @param status ICU error code. | |
864 | * @stable ICU 53 | |
865 | */ | |
866 | static MeasureUnit *createGram(UErrorCode &status); | |
867 | ||
868 | /** | |
869 | * Returns unit of mass: kilogram. | |
870 | * Caller owns returned value and must free it. | |
871 | * @param status ICU error code. | |
872 | * @stable ICU 53 | |
873 | */ | |
874 | static MeasureUnit *createKilogram(UErrorCode &status); | |
875 | ||
b331163b A |
876 | /** |
877 | * Returns unit of mass: metric-ton. | |
878 | * Caller owns returned value and must free it. | |
879 | * @param status ICU error code. | |
2ca993e8 | 880 | * @stable ICU 54 |
b331163b A |
881 | */ |
882 | static MeasureUnit *createMetricTon(UErrorCode &status); | |
883 | ||
b331163b A |
884 | /** |
885 | * Returns unit of mass: microgram. | |
886 | * Caller owns returned value and must free it. | |
887 | * @param status ICU error code. | |
2ca993e8 | 888 | * @stable ICU 54 |
b331163b A |
889 | */ |
890 | static MeasureUnit *createMicrogram(UErrorCode &status); | |
891 | ||
b331163b A |
892 | /** |
893 | * Returns unit of mass: milligram. | |
894 | * Caller owns returned value and must free it. | |
895 | * @param status ICU error code. | |
2ca993e8 | 896 | * @stable ICU 54 |
b331163b A |
897 | */ |
898 | static MeasureUnit *createMilligram(UErrorCode &status); | |
899 | ||
b331163b A |
900 | /** |
901 | * Returns unit of mass: ounce. | |
902 | * Caller owns returned value and must free it. | |
903 | * @param status ICU error code. | |
904 | * @stable ICU 53 | |
905 | */ | |
906 | static MeasureUnit *createOunce(UErrorCode &status); | |
907 | ||
b331163b A |
908 | /** |
909 | * Returns unit of mass: ounce-troy. | |
910 | * Caller owns returned value and must free it. | |
911 | * @param status ICU error code. | |
2ca993e8 | 912 | * @stable ICU 54 |
b331163b A |
913 | */ |
914 | static MeasureUnit *createOunceTroy(UErrorCode &status); | |
915 | ||
b331163b A |
916 | /** |
917 | * Returns unit of mass: pound. | |
918 | * Caller owns returned value and must free it. | |
919 | * @param status ICU error code. | |
920 | * @stable ICU 53 | |
921 | */ | |
922 | static MeasureUnit *createPound(UErrorCode &status); | |
923 | ||
b331163b A |
924 | /** |
925 | * Returns unit of mass: stone. | |
926 | * Caller owns returned value and must free it. | |
927 | * @param status ICU error code. | |
2ca993e8 | 928 | * @stable ICU 54 |
b331163b A |
929 | */ |
930 | static MeasureUnit *createStone(UErrorCode &status); | |
931 | ||
b331163b A |
932 | /** |
933 | * Returns unit of mass: ton. | |
934 | * Caller owns returned value and must free it. | |
935 | * @param status ICU error code. | |
2ca993e8 | 936 | * @stable ICU 54 |
b331163b A |
937 | */ |
938 | static MeasureUnit *createTon(UErrorCode &status); | |
939 | ||
b331163b A |
940 | /** |
941 | * Returns unit of power: gigawatt. | |
942 | * Caller owns returned value and must free it. | |
943 | * @param status ICU error code. | |
2ca993e8 | 944 | * @stable ICU 54 |
b331163b A |
945 | */ |
946 | static MeasureUnit *createGigawatt(UErrorCode &status); | |
947 | ||
b331163b A |
948 | /** |
949 | * Returns unit of power: horsepower. | |
950 | * Caller owns returned value and must free it. | |
951 | * @param status ICU error code. | |
952 | * @stable ICU 53 | |
953 | */ | |
954 | static MeasureUnit *createHorsepower(UErrorCode &status); | |
955 | ||
956 | /** | |
957 | * Returns unit of power: kilowatt. | |
958 | * Caller owns returned value and must free it. | |
959 | * @param status ICU error code. | |
960 | * @stable ICU 53 | |
961 | */ | |
962 | static MeasureUnit *createKilowatt(UErrorCode &status); | |
963 | ||
b331163b A |
964 | /** |
965 | * Returns unit of power: megawatt. | |
966 | * Caller owns returned value and must free it. | |
967 | * @param status ICU error code. | |
2ca993e8 | 968 | * @stable ICU 54 |
b331163b A |
969 | */ |
970 | static MeasureUnit *createMegawatt(UErrorCode &status); | |
971 | ||
b331163b A |
972 | /** |
973 | * Returns unit of power: milliwatt. | |
974 | * Caller owns returned value and must free it. | |
975 | * @param status ICU error code. | |
2ca993e8 | 976 | * @stable ICU 54 |
b331163b A |
977 | */ |
978 | static MeasureUnit *createMilliwatt(UErrorCode &status); | |
979 | ||
b331163b A |
980 | /** |
981 | * Returns unit of power: watt. | |
982 | * Caller owns returned value and must free it. | |
983 | * @param status ICU error code. | |
984 | * @stable ICU 53 | |
985 | */ | |
986 | static MeasureUnit *createWatt(UErrorCode &status); | |
987 | ||
988 | /** | |
989 | * Returns unit of pressure: hectopascal. | |
990 | * Caller owns returned value and must free it. | |
991 | * @param status ICU error code. | |
992 | * @stable ICU 53 | |
993 | */ | |
994 | static MeasureUnit *createHectopascal(UErrorCode &status); | |
995 | ||
996 | /** | |
997 | * Returns unit of pressure: inch-hg. | |
998 | * Caller owns returned value and must free it. | |
999 | * @param status ICU error code. | |
1000 | * @stable ICU 53 | |
1001 | */ | |
1002 | static MeasureUnit *createInchHg(UErrorCode &status); | |
1003 | ||
1004 | /** | |
1005 | * Returns unit of pressure: millibar. | |
1006 | * Caller owns returned value and must free it. | |
1007 | * @param status ICU error code. | |
1008 | * @stable ICU 53 | |
1009 | */ | |
1010 | static MeasureUnit *createMillibar(UErrorCode &status); | |
1011 | ||
b331163b A |
1012 | /** |
1013 | * Returns unit of pressure: millimeter-of-mercury. | |
1014 | * Caller owns returned value and must free it. | |
1015 | * @param status ICU error code. | |
2ca993e8 | 1016 | * @stable ICU 54 |
b331163b A |
1017 | */ |
1018 | static MeasureUnit *createMillimeterOfMercury(UErrorCode &status); | |
1019 | ||
b331163b A |
1020 | /** |
1021 | * Returns unit of pressure: pound-per-square-inch. | |
1022 | * Caller owns returned value and must free it. | |
1023 | * @param status ICU error code. | |
2ca993e8 | 1024 | * @stable ICU 54 |
b331163b A |
1025 | */ |
1026 | static MeasureUnit *createPoundPerSquareInch(UErrorCode &status); | |
1027 | ||
b331163b | 1028 | /** |
2ca993e8 | 1029 | * Returns unit of speed: kilometer-per-hour. |
b331163b A |
1030 | * Caller owns returned value and must free it. |
1031 | * @param status ICU error code. | |
2ca993e8 | 1032 | * @stable ICU 53 |
b331163b | 1033 | */ |
2ca993e8 | 1034 | static MeasureUnit *createKilometerPerHour(UErrorCode &status); |
b331163b | 1035 | |
b331163b | 1036 | /** |
2ca993e8 | 1037 | * Returns unit of speed: knot. |
b331163b A |
1038 | * Caller owns returned value and must free it. |
1039 | * @param status ICU error code. | |
f3c0d7a5 | 1040 | * @stable ICU 56 |
b331163b | 1041 | */ |
2ca993e8 | 1042 | static MeasureUnit *createKnot(UErrorCode &status); |
b331163b A |
1043 | |
1044 | /** | |
1045 | * Returns unit of speed: meter-per-second. | |
1046 | * Caller owns returned value and must free it. | |
1047 | * @param status ICU error code. | |
1048 | * @stable ICU 53 | |
1049 | */ | |
1050 | static MeasureUnit *createMeterPerSecond(UErrorCode &status); | |
1051 | ||
1052 | /** | |
1053 | * Returns unit of speed: mile-per-hour. | |
1054 | * Caller owns returned value and must free it. | |
1055 | * @param status ICU error code. | |
1056 | * @stable ICU 53 | |
1057 | */ | |
1058 | static MeasureUnit *createMilePerHour(UErrorCode &status); | |
1059 | ||
1060 | /** | |
1061 | * Returns unit of temperature: celsius. | |
1062 | * Caller owns returned value and must free it. | |
1063 | * @param status ICU error code. | |
1064 | * @stable ICU 53 | |
1065 | */ | |
1066 | static MeasureUnit *createCelsius(UErrorCode &status); | |
1067 | ||
1068 | /** | |
1069 | * Returns unit of temperature: fahrenheit. | |
1070 | * Caller owns returned value and must free it. | |
1071 | * @param status ICU error code. | |
1072 | * @stable ICU 53 | |
1073 | */ | |
1074 | static MeasureUnit *createFahrenheit(UErrorCode &status); | |
1075 | ||
b331163b | 1076 | /** |
2ca993e8 | 1077 | * Returns unit of temperature: generic. |
b331163b A |
1078 | * Caller owns returned value and must free it. |
1079 | * @param status ICU error code. | |
f3c0d7a5 | 1080 | * @stable ICU 56 |
b331163b | 1081 | */ |
2ca993e8 | 1082 | static MeasureUnit *createGenericTemperature(UErrorCode &status); |
b331163b | 1083 | |
b331163b | 1084 | /** |
2ca993e8 | 1085 | * Returns unit of temperature: kelvin. |
b331163b A |
1086 | * Caller owns returned value and must free it. |
1087 | * @param status ICU error code. | |
2ca993e8 | 1088 | * @stable ICU 54 |
b331163b | 1089 | */ |
2ca993e8 | 1090 | static MeasureUnit *createKelvin(UErrorCode &status); |
b331163b | 1091 | |
b331163b A |
1092 | /** |
1093 | * Returns unit of volume: acre-foot. | |
1094 | * Caller owns returned value and must free it. | |
1095 | * @param status ICU error code. | |
2ca993e8 | 1096 | * @stable ICU 54 |
b331163b A |
1097 | */ |
1098 | static MeasureUnit *createAcreFoot(UErrorCode &status); | |
1099 | ||
b331163b A |
1100 | /** |
1101 | * Returns unit of volume: bushel. | |
1102 | * Caller owns returned value and must free it. | |
1103 | * @param status ICU error code. | |
2ca993e8 | 1104 | * @stable ICU 54 |
b331163b A |
1105 | */ |
1106 | static MeasureUnit *createBushel(UErrorCode &status); | |
1107 | ||
b331163b A |
1108 | /** |
1109 | * Returns unit of volume: centiliter. | |
1110 | * Caller owns returned value and must free it. | |
1111 | * @param status ICU error code. | |
2ca993e8 | 1112 | * @stable ICU 54 |
b331163b A |
1113 | */ |
1114 | static MeasureUnit *createCentiliter(UErrorCode &status); | |
1115 | ||
b331163b A |
1116 | /** |
1117 | * Returns unit of volume: cubic-centimeter. | |
1118 | * Caller owns returned value and must free it. | |
1119 | * @param status ICU error code. | |
2ca993e8 | 1120 | * @stable ICU 54 |
b331163b A |
1121 | */ |
1122 | static MeasureUnit *createCubicCentimeter(UErrorCode &status); | |
1123 | ||
b331163b A |
1124 | /** |
1125 | * Returns unit of volume: cubic-foot. | |
1126 | * Caller owns returned value and must free it. | |
1127 | * @param status ICU error code. | |
2ca993e8 | 1128 | * @stable ICU 54 |
b331163b A |
1129 | */ |
1130 | static MeasureUnit *createCubicFoot(UErrorCode &status); | |
1131 | ||
b331163b A |
1132 | /** |
1133 | * Returns unit of volume: cubic-inch. | |
1134 | * Caller owns returned value and must free it. | |
1135 | * @param status ICU error code. | |
2ca993e8 | 1136 | * @stable ICU 54 |
b331163b A |
1137 | */ |
1138 | static MeasureUnit *createCubicInch(UErrorCode &status); | |
1139 | ||
b331163b A |
1140 | /** |
1141 | * Returns unit of volume: cubic-kilometer. | |
1142 | * Caller owns returned value and must free it. | |
1143 | * @param status ICU error code. | |
1144 | * @stable ICU 53 | |
1145 | */ | |
1146 | static MeasureUnit *createCubicKilometer(UErrorCode &status); | |
1147 | ||
b331163b A |
1148 | /** |
1149 | * Returns unit of volume: cubic-meter. | |
1150 | * Caller owns returned value and must free it. | |
1151 | * @param status ICU error code. | |
2ca993e8 | 1152 | * @stable ICU 54 |
b331163b A |
1153 | */ |
1154 | static MeasureUnit *createCubicMeter(UErrorCode &status); | |
1155 | ||
b331163b A |
1156 | /** |
1157 | * Returns unit of volume: cubic-mile. | |
1158 | * Caller owns returned value and must free it. | |
1159 | * @param status ICU error code. | |
1160 | * @stable ICU 53 | |
1161 | */ | |
1162 | static MeasureUnit *createCubicMile(UErrorCode &status); | |
1163 | ||
b331163b A |
1164 | /** |
1165 | * Returns unit of volume: cubic-yard. | |
1166 | * Caller owns returned value and must free it. | |
1167 | * @param status ICU error code. | |
2ca993e8 | 1168 | * @stable ICU 54 |
b331163b A |
1169 | */ |
1170 | static MeasureUnit *createCubicYard(UErrorCode &status); | |
1171 | ||
b331163b A |
1172 | /** |
1173 | * Returns unit of volume: cup. | |
1174 | * Caller owns returned value and must free it. | |
1175 | * @param status ICU error code. | |
2ca993e8 | 1176 | * @stable ICU 54 |
b331163b A |
1177 | */ |
1178 | static MeasureUnit *createCup(UErrorCode &status); | |
1179 | ||
2ca993e8 A |
1180 | /** |
1181 | * Returns unit of volume: cup-metric. | |
1182 | * Caller owns returned value and must free it. | |
1183 | * @param status ICU error code. | |
f3c0d7a5 | 1184 | * @stable ICU 56 |
2ca993e8 A |
1185 | */ |
1186 | static MeasureUnit *createCupMetric(UErrorCode &status); | |
2ca993e8 | 1187 | |
b331163b A |
1188 | /** |
1189 | * Returns unit of volume: deciliter. | |
1190 | * Caller owns returned value and must free it. | |
1191 | * @param status ICU error code. | |
2ca993e8 | 1192 | * @stable ICU 54 |
b331163b A |
1193 | */ |
1194 | static MeasureUnit *createDeciliter(UErrorCode &status); | |
1195 | ||
b331163b A |
1196 | /** |
1197 | * Returns unit of volume: fluid-ounce. | |
1198 | * Caller owns returned value and must free it. | |
1199 | * @param status ICU error code. | |
2ca993e8 | 1200 | * @stable ICU 54 |
b331163b A |
1201 | */ |
1202 | static MeasureUnit *createFluidOunce(UErrorCode &status); | |
1203 | ||
b331163b A |
1204 | /** |
1205 | * Returns unit of volume: gallon. | |
1206 | * Caller owns returned value and must free it. | |
1207 | * @param status ICU error code. | |
2ca993e8 | 1208 | * @stable ICU 54 |
b331163b A |
1209 | */ |
1210 | static MeasureUnit *createGallon(UErrorCode &status); | |
1211 | ||
2ca993e8 A |
1212 | /** |
1213 | * Returns unit of volume: gallon-imperial. | |
1214 | * Caller owns returned value and must free it. | |
1215 | * @param status ICU error code. | |
f3c0d7a5 | 1216 | * @stable ICU 57 |
2ca993e8 A |
1217 | */ |
1218 | static MeasureUnit *createGallonImperial(UErrorCode &status); | |
2ca993e8 | 1219 | |
b331163b A |
1220 | /** |
1221 | * Returns unit of volume: hectoliter. | |
1222 | * Caller owns returned value and must free it. | |
1223 | * @param status ICU error code. | |
2ca993e8 | 1224 | * @stable ICU 54 |
b331163b A |
1225 | */ |
1226 | static MeasureUnit *createHectoliter(UErrorCode &status); | |
1227 | ||
b331163b A |
1228 | /** |
1229 | * Returns unit of volume: liter. | |
1230 | * Caller owns returned value and must free it. | |
1231 | * @param status ICU error code. | |
1232 | * @stable ICU 53 | |
1233 | */ | |
1234 | static MeasureUnit *createLiter(UErrorCode &status); | |
1235 | ||
b331163b A |
1236 | /** |
1237 | * Returns unit of volume: megaliter. | |
1238 | * Caller owns returned value and must free it. | |
1239 | * @param status ICU error code. | |
2ca993e8 | 1240 | * @stable ICU 54 |
b331163b A |
1241 | */ |
1242 | static MeasureUnit *createMegaliter(UErrorCode &status); | |
1243 | ||
b331163b A |
1244 | /** |
1245 | * Returns unit of volume: milliliter. | |
1246 | * Caller owns returned value and must free it. | |
1247 | * @param status ICU error code. | |
2ca993e8 | 1248 | * @stable ICU 54 |
b331163b A |
1249 | */ |
1250 | static MeasureUnit *createMilliliter(UErrorCode &status); | |
1251 | ||
b331163b A |
1252 | /** |
1253 | * Returns unit of volume: pint. | |
1254 | * Caller owns returned value and must free it. | |
1255 | * @param status ICU error code. | |
2ca993e8 | 1256 | * @stable ICU 54 |
b331163b A |
1257 | */ |
1258 | static MeasureUnit *createPint(UErrorCode &status); | |
1259 | ||
2ca993e8 A |
1260 | /** |
1261 | * Returns unit of volume: pint-metric. | |
1262 | * Caller owns returned value and must free it. | |
1263 | * @param status ICU error code. | |
f3c0d7a5 | 1264 | * @stable ICU 56 |
2ca993e8 A |
1265 | */ |
1266 | static MeasureUnit *createPintMetric(UErrorCode &status); | |
2ca993e8 | 1267 | |
b331163b A |
1268 | /** |
1269 | * Returns unit of volume: quart. | |
1270 | * Caller owns returned value and must free it. | |
1271 | * @param status ICU error code. | |
2ca993e8 | 1272 | * @stable ICU 54 |
b331163b A |
1273 | */ |
1274 | static MeasureUnit *createQuart(UErrorCode &status); | |
1275 | ||
b331163b A |
1276 | /** |
1277 | * Returns unit of volume: tablespoon. | |
1278 | * Caller owns returned value and must free it. | |
1279 | * @param status ICU error code. | |
2ca993e8 | 1280 | * @stable ICU 54 |
b331163b A |
1281 | */ |
1282 | static MeasureUnit *createTablespoon(UErrorCode &status); | |
1283 | ||
b331163b A |
1284 | /** |
1285 | * Returns unit of volume: teaspoon. | |
1286 | * Caller owns returned value and must free it. | |
1287 | * @param status ICU error code. | |
2ca993e8 | 1288 | * @stable ICU 54 |
b331163b A |
1289 | */ |
1290 | static MeasureUnit *createTeaspoon(UErrorCode &status); | |
1291 | ||
b331163b A |
1292 | |
1293 | // End generated createXXX methods | |
374ca955 A |
1294 | |
1295 | protected: | |
57a6839d A |
1296 | |
1297 | #ifndef U_HIDE_INTERNAL_API | |
374ca955 | 1298 | /** |
57a6839d A |
1299 | * For ICU use only. |
1300 | * @internal | |
1301 | */ | |
1302 | void initTime(const char *timeId); | |
1303 | ||
1304 | /** | |
1305 | * For ICU use only. | |
1306 | * @internal | |
374ca955 | 1307 | */ |
57a6839d A |
1308 | void initCurrency(const char *isoCurrency); |
1309 | ||
0f5d89e8 A |
1310 | /** |
1311 | * For ICU use only. | |
1312 | * @internal | |
1313 | */ | |
1314 | void initNoUnit(const char *subtype); | |
1315 | ||
b331163b | 1316 | #endif /* U_HIDE_INTERNAL_API */ |
57a6839d A |
1317 | |
1318 | private: | |
1319 | int32_t fTypeId; | |
1320 | int32_t fSubTypeId; | |
1321 | char fCurrency[4]; | |
1322 | ||
1323 | MeasureUnit(int32_t typeId, int32_t subTypeId) : fTypeId(typeId), fSubTypeId(subTypeId) { | |
1324 | fCurrency[0] = 0; | |
1325 | } | |
1326 | void setTo(int32_t typeId, int32_t subTypeId); | |
1327 | int32_t getOffset() const; | |
1328 | static MeasureUnit *create(int typeId, int subTypeId, UErrorCode &status); | |
374ca955 A |
1329 | }; |
1330 | ||
1331 | U_NAMESPACE_END | |
f3c0d7a5 | 1332 | #endif // U_SHOW_CPLUSPLUS_API |
374ca955 | 1333 | |
57a6839d | 1334 | #endif // !UNCONFIG_NO_FORMATTING |
374ca955 | 1335 | #endif // __MEASUREUNIT_H__ |