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