1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 **********************************************************************
5 * Copyright (c) 2004-2016, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
9 * Created: April 26, 2004
11 **********************************************************************
13 #ifndef __MEASUREUNIT_H__
14 #define __MEASUREUNIT_H__
16 #include "unicode/utypes.h"
18 #if !UCONFIG_NO_FORMATTING
20 #include "unicode/unistr.h"
24 * \brief C++ API: A unit for measuring a quantity.
29 class StringEnumeration;
32 * A unit such as length, mass, volume, currency, etc. A unit is
33 * coupled with a numeric amount to produce a Measure.
38 class U_I18N_API MeasureUnit: public UObject {
42 * Default constructor.
45 MeasureUnit() : fTypeId(0), fSubTypeId(0) {
53 MeasureUnit(const MeasureUnit &other);
56 * Assignment operator.
59 MeasureUnit &operator=(const MeasureUnit &other);
62 * Returns a polymorphic clone of this object. The result will
63 * have the same class as returned by getDynamicClassID().
66 virtual UObject* clone() const;
72 virtual ~MeasureUnit();
75 * Equality operator. Return true if this object is equal
76 * to the given object.
79 virtual UBool operator==(const UObject& other) const;
82 * Inequality operator. Return true if this object is not equal
83 * to the given object.
86 UBool operator!=(const UObject& other) const {
87 return !(*this == other);
94 const char *getType() const;
100 const char *getSubtype() const;
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.
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.
113 static int32_t getAvailable(
114 MeasureUnit *destArray,
115 int32_t destCapacity,
116 UErrorCode &errorCode);
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.
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.
130 static int32_t getAvailable(
132 MeasureUnit *destArray,
133 int32_t destCapacity,
134 UErrorCode &errorCode);
137 * getAvailableTypes gets all of the available types. Caller owns the
138 * returned StringEnumeration and must delete it when finished using it.
140 * @param errorCode ICU error code.
144 static StringEnumeration* getAvailableTypes(UErrorCode &errorCode);
147 * Return the class ID for this class. This is useful only for comparing to
148 * a return value from getDynamicClassID(). For example:
150 * . Base* polymorphic_pointer = createPolymorphicObject();
151 * . if (polymorphic_pointer->getDynamicClassID() ==
152 * . erived::getStaticClassID()) ...
154 * @return The class ID for all objects of this class.
157 static UClassID U_EXPORT2 getStaticClassID(void);
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.
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.
170 virtual UClassID getDynamicClassID(void) const;
172 #ifndef U_HIDE_INTERNAL_API
175 * Returns associated array index for this measure unit. Only valid for
176 * non-currency measure units.
179 int32_t getIndex() const;
183 * Returns maximum value from getIndex plus 1.
186 static int32_t getIndexCount();
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
194 static int32_t internalGetIndexForTypeAndSubtype(const char *type, const char *subtype);
200 static MeasureUnit *resolveUnitPerUnit(
201 const MeasureUnit &unit, const MeasureUnit &perUnit);
202 #endif /* U_HIDE_INTERNAL_API */
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
210 // Start generated createXXX methods
213 * Returns unit of acceleration: g-force.
214 * Caller owns returned value and must free it.
215 * @param status ICU error code.
218 static MeasureUnit *createGForce(UErrorCode &status);
221 * Returns unit of acceleration: meter-per-second-squared.
222 * Caller owns returned value and must free it.
223 * @param status ICU error code.
226 static MeasureUnit *createMeterPerSecondSquared(UErrorCode &status);
229 * Returns unit of angle: arc-minute.
230 * Caller owns returned value and must free it.
231 * @param status ICU error code.
234 static MeasureUnit *createArcMinute(UErrorCode &status);
237 * Returns unit of angle: arc-second.
238 * Caller owns returned value and must free it.
239 * @param status ICU error code.
242 static MeasureUnit *createArcSecond(UErrorCode &status);
245 * Returns unit of angle: degree.
246 * Caller owns returned value and must free it.
247 * @param status ICU error code.
250 static MeasureUnit *createDegree(UErrorCode &status);
253 * Returns unit of angle: radian.
254 * Caller owns returned value and must free it.
255 * @param status ICU error code.
258 static MeasureUnit *createRadian(UErrorCode &status);
261 * Returns unit of angle: revolution.
262 * Caller owns returned value and must free it.
263 * @param status ICU error code.
266 static MeasureUnit *createRevolutionAngle(UErrorCode &status);
269 * Returns unit of area: acre.
270 * Caller owns returned value and must free it.
271 * @param status ICU error code.
274 static MeasureUnit *createAcre(UErrorCode &status);
277 * Returns unit of area: hectare.
278 * Caller owns returned value and must free it.
279 * @param status ICU error code.
282 static MeasureUnit *createHectare(UErrorCode &status);
285 * Returns unit of area: square-centimeter.
286 * Caller owns returned value and must free it.
287 * @param status ICU error code.
290 static MeasureUnit *createSquareCentimeter(UErrorCode &status);
293 * Returns unit of area: square-foot.
294 * Caller owns returned value and must free it.
295 * @param status ICU error code.
298 static MeasureUnit *createSquareFoot(UErrorCode &status);
301 * Returns unit of area: square-inch.
302 * Caller owns returned value and must free it.
303 * @param status ICU error code.
306 static MeasureUnit *createSquareInch(UErrorCode &status);
309 * Returns unit of area: square-kilometer.
310 * Caller owns returned value and must free it.
311 * @param status ICU error code.
314 static MeasureUnit *createSquareKilometer(UErrorCode &status);
317 * Returns unit of area: square-meter.
318 * Caller owns returned value and must free it.
319 * @param status ICU error code.
322 static MeasureUnit *createSquareMeter(UErrorCode &status);
325 * Returns unit of area: square-mile.
326 * Caller owns returned value and must free it.
327 * @param status ICU error code.
330 static MeasureUnit *createSquareMile(UErrorCode &status);
333 * Returns unit of area: square-yard.
334 * Caller owns returned value and must free it.
335 * @param status ICU error code.
338 static MeasureUnit *createSquareYard(UErrorCode &status);
341 * Returns unit of concentr: karat.
342 * Caller owns returned value and must free it.
343 * @param status ICU error code.
346 static MeasureUnit *createKarat(UErrorCode &status);
348 #ifndef U_HIDE_DRAFT_API
350 * Returns unit of concentr: milligram-per-deciliter.
351 * Caller owns returned value and must free it.
352 * @param status ICU error code.
355 static MeasureUnit *createMilligramPerDeciliter(UErrorCode &status);
356 #endif /* U_HIDE_DRAFT_API */
358 #ifndef U_HIDE_DRAFT_API
360 * Returns unit of concentr: millimole-per-liter.
361 * Caller owns returned value and must free it.
362 * @param status ICU error code.
365 static MeasureUnit *createMillimolePerLiter(UErrorCode &status);
366 #endif /* U_HIDE_DRAFT_API */
368 #ifndef U_HIDE_DRAFT_API
370 * Returns unit of concentr: part-per-million.
371 * Caller owns returned value and must free it.
372 * @param status ICU error code.
375 static MeasureUnit *createPartPerMillion(UErrorCode &status);
376 #endif /* U_HIDE_DRAFT_API */
379 * Returns unit of consumption: liter-per-100kilometers.
380 * Caller owns returned value and must free it.
381 * @param status ICU error code.
384 static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status);
387 * Returns unit of consumption: liter-per-kilometer.
388 * Caller owns returned value and must free it.
389 * @param status ICU error code.
392 static MeasureUnit *createLiterPerKilometer(UErrorCode &status);
395 * Returns unit of consumption: mile-per-gallon.
396 * Caller owns returned value and must free it.
397 * @param status ICU error code.
400 static MeasureUnit *createMilePerGallon(UErrorCode &status);
402 #ifndef U_HIDE_DRAFT_API
404 * Returns unit of consumption: mile-per-gallon-imperial.
405 * Caller owns returned value and must free it.
406 * @param status ICU error code.
409 static MeasureUnit *createMilePerGallonImperial(UErrorCode &status);
410 #endif /* U_HIDE_DRAFT_API */
412 #ifndef U_HIDE_DRAFT_API
414 * Returns unit of coordinate: east.
415 * Caller owns returned value and must free it.
416 * @param status ICU error code.
419 static MeasureUnit *createEast(UErrorCode &status);
420 #endif /* U_HIDE_DRAFT_API */
422 #ifndef U_HIDE_DRAFT_API
424 * Returns unit of coordinate: north.
425 * Caller owns returned value and must free it.
426 * @param status ICU error code.
429 static MeasureUnit *createNorth(UErrorCode &status);
430 #endif /* U_HIDE_DRAFT_API */
432 #ifndef U_HIDE_DRAFT_API
434 * Returns unit of coordinate: south.
435 * Caller owns returned value and must free it.
436 * @param status ICU error code.
439 static MeasureUnit *createSouth(UErrorCode &status);
440 #endif /* U_HIDE_DRAFT_API */
442 #ifndef U_HIDE_DRAFT_API
444 * Returns unit of coordinate: west.
445 * Caller owns returned value and must free it.
446 * @param status ICU error code.
449 static MeasureUnit *createWest(UErrorCode &status);
450 #endif /* U_HIDE_DRAFT_API */
453 * Returns unit of digital: bit.
454 * Caller owns returned value and must free it.
455 * @param status ICU error code.
458 static MeasureUnit *createBit(UErrorCode &status);
461 * Returns unit of digital: byte.
462 * Caller owns returned value and must free it.
463 * @param status ICU error code.
466 static MeasureUnit *createByte(UErrorCode &status);
469 * Returns unit of digital: gigabit.
470 * Caller owns returned value and must free it.
471 * @param status ICU error code.
474 static MeasureUnit *createGigabit(UErrorCode &status);
477 * Returns unit of digital: gigabyte.
478 * Caller owns returned value and must free it.
479 * @param status ICU error code.
482 static MeasureUnit *createGigabyte(UErrorCode &status);
485 * Returns unit of digital: kilobit.
486 * Caller owns returned value and must free it.
487 * @param status ICU error code.
490 static MeasureUnit *createKilobit(UErrorCode &status);
493 * Returns unit of digital: kilobyte.
494 * Caller owns returned value and must free it.
495 * @param status ICU error code.
498 static MeasureUnit *createKilobyte(UErrorCode &status);
501 * Returns unit of digital: megabit.
502 * Caller owns returned value and must free it.
503 * @param status ICU error code.
506 static MeasureUnit *createMegabit(UErrorCode &status);
509 * Returns unit of digital: megabyte.
510 * Caller owns returned value and must free it.
511 * @param status ICU error code.
514 static MeasureUnit *createMegabyte(UErrorCode &status);
517 * Returns unit of digital: terabit.
518 * Caller owns returned value and must free it.
519 * @param status ICU error code.
522 static MeasureUnit *createTerabit(UErrorCode &status);
525 * Returns unit of digital: terabyte.
526 * Caller owns returned value and must free it.
527 * @param status ICU error code.
530 static MeasureUnit *createTerabyte(UErrorCode &status);
533 * Returns unit of duration: century.
534 * Caller owns returned value and must free it.
535 * @param status ICU error code.
538 static MeasureUnit *createCentury(UErrorCode &status);
541 * Returns unit of duration: day.
542 * Caller owns returned value and must free it.
543 * @param status ICU error code.
546 static MeasureUnit *createDay(UErrorCode &status);
549 * Returns unit of duration: hour.
550 * Caller owns returned value and must free it.
551 * @param status ICU error code.
554 static MeasureUnit *createHour(UErrorCode &status);
557 * Returns unit of duration: microsecond.
558 * Caller owns returned value and must free it.
559 * @param status ICU error code.
562 static MeasureUnit *createMicrosecond(UErrorCode &status);
565 * Returns unit of duration: millisecond.
566 * Caller owns returned value and must free it.
567 * @param status ICU error code.
570 static MeasureUnit *createMillisecond(UErrorCode &status);
573 * Returns unit of duration: minute.
574 * Caller owns returned value and must free it.
575 * @param status ICU error code.
578 static MeasureUnit *createMinute(UErrorCode &status);
581 * Returns unit of duration: month.
582 * Caller owns returned value and must free it.
583 * @param status ICU error code.
586 static MeasureUnit *createMonth(UErrorCode &status);
589 * Returns unit of duration: nanosecond.
590 * Caller owns returned value and must free it.
591 * @param status ICU error code.
594 static MeasureUnit *createNanosecond(UErrorCode &status);
597 * Returns unit of duration: second.
598 * Caller owns returned value and must free it.
599 * @param status ICU error code.
602 static MeasureUnit *createSecond(UErrorCode &status);
605 * Returns unit of duration: week.
606 * Caller owns returned value and must free it.
607 * @param status ICU error code.
610 static MeasureUnit *createWeek(UErrorCode &status);
613 * Returns unit of duration: year.
614 * Caller owns returned value and must free it.
615 * @param status ICU error code.
618 static MeasureUnit *createYear(UErrorCode &status);
621 * Returns unit of electric: ampere.
622 * Caller owns returned value and must free it.
623 * @param status ICU error code.
626 static MeasureUnit *createAmpere(UErrorCode &status);
629 * Returns unit of electric: milliampere.
630 * Caller owns returned value and must free it.
631 * @param status ICU error code.
634 static MeasureUnit *createMilliampere(UErrorCode &status);
637 * Returns unit of electric: ohm.
638 * Caller owns returned value and must free it.
639 * @param status ICU error code.
642 static MeasureUnit *createOhm(UErrorCode &status);
645 * Returns unit of electric: volt.
646 * Caller owns returned value and must free it.
647 * @param status ICU error code.
650 static MeasureUnit *createVolt(UErrorCode &status);
653 * Returns unit of energy: calorie.
654 * Caller owns returned value and must free it.
655 * @param status ICU error code.
658 static MeasureUnit *createCalorie(UErrorCode &status);
661 * Returns unit of energy: foodcalorie.
662 * Caller owns returned value and must free it.
663 * @param status ICU error code.
666 static MeasureUnit *createFoodcalorie(UErrorCode &status);
669 * Returns unit of energy: joule.
670 * Caller owns returned value and must free it.
671 * @param status ICU error code.
674 static MeasureUnit *createJoule(UErrorCode &status);
677 * Returns unit of energy: kilocalorie.
678 * Caller owns returned value and must free it.
679 * @param status ICU error code.
682 static MeasureUnit *createKilocalorie(UErrorCode &status);
685 * Returns unit of energy: kilojoule.
686 * Caller owns returned value and must free it.
687 * @param status ICU error code.
690 static MeasureUnit *createKilojoule(UErrorCode &status);
693 * Returns unit of energy: kilowatt-hour.
694 * Caller owns returned value and must free it.
695 * @param status ICU error code.
698 static MeasureUnit *createKilowattHour(UErrorCode &status);
701 * Returns unit of frequency: gigahertz.
702 * Caller owns returned value and must free it.
703 * @param status ICU error code.
706 static MeasureUnit *createGigahertz(UErrorCode &status);
709 * Returns unit of frequency: hertz.
710 * Caller owns returned value and must free it.
711 * @param status ICU error code.
714 static MeasureUnit *createHertz(UErrorCode &status);
717 * Returns unit of frequency: kilohertz.
718 * Caller owns returned value and must free it.
719 * @param status ICU error code.
722 static MeasureUnit *createKilohertz(UErrorCode &status);
725 * Returns unit of frequency: megahertz.
726 * Caller owns returned value and must free it.
727 * @param status ICU error code.
730 static MeasureUnit *createMegahertz(UErrorCode &status);
733 * Returns unit of length: astronomical-unit.
734 * Caller owns returned value and must free it.
735 * @param status ICU error code.
738 static MeasureUnit *createAstronomicalUnit(UErrorCode &status);
741 * Returns unit of length: centimeter.
742 * Caller owns returned value and must free it.
743 * @param status ICU error code.
746 static MeasureUnit *createCentimeter(UErrorCode &status);
749 * Returns unit of length: decimeter.
750 * Caller owns returned value and must free it.
751 * @param status ICU error code.
754 static MeasureUnit *createDecimeter(UErrorCode &status);
757 * Returns unit of length: fathom.
758 * Caller owns returned value and must free it.
759 * @param status ICU error code.
762 static MeasureUnit *createFathom(UErrorCode &status);
765 * Returns unit of length: foot.
766 * Caller owns returned value and must free it.
767 * @param status ICU error code.
770 static MeasureUnit *createFoot(UErrorCode &status);
773 * Returns unit of length: furlong.
774 * Caller owns returned value and must free it.
775 * @param status ICU error code.
778 static MeasureUnit *createFurlong(UErrorCode &status);
781 * Returns unit of length: inch.
782 * Caller owns returned value and must free it.
783 * @param status ICU error code.
786 static MeasureUnit *createInch(UErrorCode &status);
789 * Returns unit of length: kilometer.
790 * Caller owns returned value and must free it.
791 * @param status ICU error code.
794 static MeasureUnit *createKilometer(UErrorCode &status);
797 * Returns unit of length: light-year.
798 * Caller owns returned value and must free it.
799 * @param status ICU error code.
802 static MeasureUnit *createLightYear(UErrorCode &status);
805 * Returns unit of length: meter.
806 * Caller owns returned value and must free it.
807 * @param status ICU error code.
810 static MeasureUnit *createMeter(UErrorCode &status);
813 * Returns unit of length: micrometer.
814 * Caller owns returned value and must free it.
815 * @param status ICU error code.
818 static MeasureUnit *createMicrometer(UErrorCode &status);
821 * Returns unit of length: mile.
822 * Caller owns returned value and must free it.
823 * @param status ICU error code.
826 static MeasureUnit *createMile(UErrorCode &status);
829 * Returns unit of length: mile-scandinavian.
830 * Caller owns returned value and must free it.
831 * @param status ICU error code.
834 static MeasureUnit *createMileScandinavian(UErrorCode &status);
837 * Returns unit of length: millimeter.
838 * Caller owns returned value and must free it.
839 * @param status ICU error code.
842 static MeasureUnit *createMillimeter(UErrorCode &status);
845 * Returns unit of length: nanometer.
846 * Caller owns returned value and must free it.
847 * @param status ICU error code.
850 static MeasureUnit *createNanometer(UErrorCode &status);
853 * Returns unit of length: nautical-mile.
854 * Caller owns returned value and must free it.
855 * @param status ICU error code.
858 static MeasureUnit *createNauticalMile(UErrorCode &status);
861 * Returns unit of length: parsec.
862 * Caller owns returned value and must free it.
863 * @param status ICU error code.
866 static MeasureUnit *createParsec(UErrorCode &status);
869 * Returns unit of length: picometer.
870 * Caller owns returned value and must free it.
871 * @param status ICU error code.
874 static MeasureUnit *createPicometer(UErrorCode &status);
877 * Returns unit of length: yard.
878 * Caller owns returned value and must free it.
879 * @param status ICU error code.
882 static MeasureUnit *createYard(UErrorCode &status);
885 * Returns unit of light: lux.
886 * Caller owns returned value and must free it.
887 * @param status ICU error code.
890 static MeasureUnit *createLux(UErrorCode &status);
893 * Returns unit of mass: carat.
894 * Caller owns returned value and must free it.
895 * @param status ICU error code.
898 static MeasureUnit *createCarat(UErrorCode &status);
901 * Returns unit of mass: gram.
902 * Caller owns returned value and must free it.
903 * @param status ICU error code.
906 static MeasureUnit *createGram(UErrorCode &status);
909 * Returns unit of mass: kilogram.
910 * Caller owns returned value and must free it.
911 * @param status ICU error code.
914 static MeasureUnit *createKilogram(UErrorCode &status);
917 * Returns unit of mass: metric-ton.
918 * Caller owns returned value and must free it.
919 * @param status ICU error code.
922 static MeasureUnit *createMetricTon(UErrorCode &status);
925 * Returns unit of mass: microgram.
926 * Caller owns returned value and must free it.
927 * @param status ICU error code.
930 static MeasureUnit *createMicrogram(UErrorCode &status);
933 * Returns unit of mass: milligram.
934 * Caller owns returned value and must free it.
935 * @param status ICU error code.
938 static MeasureUnit *createMilligram(UErrorCode &status);
941 * Returns unit of mass: ounce.
942 * Caller owns returned value and must free it.
943 * @param status ICU error code.
946 static MeasureUnit *createOunce(UErrorCode &status);
949 * Returns unit of mass: ounce-troy.
950 * Caller owns returned value and must free it.
951 * @param status ICU error code.
954 static MeasureUnit *createOunceTroy(UErrorCode &status);
957 * Returns unit of mass: pound.
958 * Caller owns returned value and must free it.
959 * @param status ICU error code.
962 static MeasureUnit *createPound(UErrorCode &status);
965 * Returns unit of mass: stone.
966 * Caller owns returned value and must free it.
967 * @param status ICU error code.
970 static MeasureUnit *createStone(UErrorCode &status);
973 * Returns unit of mass: ton.
974 * Caller owns returned value and must free it.
975 * @param status ICU error code.
978 static MeasureUnit *createTon(UErrorCode &status);
981 * Returns unit of power: gigawatt.
982 * Caller owns returned value and must free it.
983 * @param status ICU error code.
986 static MeasureUnit *createGigawatt(UErrorCode &status);
989 * Returns unit of power: horsepower.
990 * Caller owns returned value and must free it.
991 * @param status ICU error code.
994 static MeasureUnit *createHorsepower(UErrorCode &status);
997 * Returns unit of power: kilowatt.
998 * Caller owns returned value and must free it.
999 * @param status ICU error code.
1002 static MeasureUnit *createKilowatt(UErrorCode &status);
1005 * Returns unit of power: megawatt.
1006 * Caller owns returned value and must free it.
1007 * @param status ICU error code.
1010 static MeasureUnit *createMegawatt(UErrorCode &status);
1013 * Returns unit of power: milliwatt.
1014 * Caller owns returned value and must free it.
1015 * @param status ICU error code.
1018 static MeasureUnit *createMilliwatt(UErrorCode &status);
1021 * Returns unit of power: watt.
1022 * Caller owns returned value and must free it.
1023 * @param status ICU error code.
1026 static MeasureUnit *createWatt(UErrorCode &status);
1029 * Returns unit of pressure: hectopascal.
1030 * Caller owns returned value and must free it.
1031 * @param status ICU error code.
1034 static MeasureUnit *createHectopascal(UErrorCode &status);
1037 * Returns unit of pressure: inch-hg.
1038 * Caller owns returned value and must free it.
1039 * @param status ICU error code.
1042 static MeasureUnit *createInchHg(UErrorCode &status);
1045 * Returns unit of pressure: millibar.
1046 * Caller owns returned value and must free it.
1047 * @param status ICU error code.
1050 static MeasureUnit *createMillibar(UErrorCode &status);
1053 * Returns unit of pressure: millimeter-of-mercury.
1054 * Caller owns returned value and must free it.
1055 * @param status ICU error code.
1058 static MeasureUnit *createMillimeterOfMercury(UErrorCode &status);
1061 * Returns unit of pressure: pound-per-square-inch.
1062 * Caller owns returned value and must free it.
1063 * @param status ICU error code.
1066 static MeasureUnit *createPoundPerSquareInch(UErrorCode &status);
1069 * Returns unit of speed: kilometer-per-hour.
1070 * Caller owns returned value and must free it.
1071 * @param status ICU error code.
1074 static MeasureUnit *createKilometerPerHour(UErrorCode &status);
1077 * Returns unit of speed: knot.
1078 * Caller owns returned value and must free it.
1079 * @param status ICU error code.
1082 static MeasureUnit *createKnot(UErrorCode &status);
1085 * Returns unit of speed: meter-per-second.
1086 * Caller owns returned value and must free it.
1087 * @param status ICU error code.
1090 static MeasureUnit *createMeterPerSecond(UErrorCode &status);
1093 * Returns unit of speed: mile-per-hour.
1094 * Caller owns returned value and must free it.
1095 * @param status ICU error code.
1098 static MeasureUnit *createMilePerHour(UErrorCode &status);
1101 * Returns unit of temperature: celsius.
1102 * Caller owns returned value and must free it.
1103 * @param status ICU error code.
1106 static MeasureUnit *createCelsius(UErrorCode &status);
1109 * Returns unit of temperature: fahrenheit.
1110 * Caller owns returned value and must free it.
1111 * @param status ICU error code.
1114 static MeasureUnit *createFahrenheit(UErrorCode &status);
1117 * Returns unit of temperature: generic.
1118 * Caller owns returned value and must free it.
1119 * @param status ICU error code.
1122 static MeasureUnit *createGenericTemperature(UErrorCode &status);
1125 * Returns unit of temperature: kelvin.
1126 * Caller owns returned value and must free it.
1127 * @param status ICU error code.
1130 static MeasureUnit *createKelvin(UErrorCode &status);
1133 * Returns unit of volume: acre-foot.
1134 * Caller owns returned value and must free it.
1135 * @param status ICU error code.
1138 static MeasureUnit *createAcreFoot(UErrorCode &status);
1141 * Returns unit of volume: bushel.
1142 * Caller owns returned value and must free it.
1143 * @param status ICU error code.
1146 static MeasureUnit *createBushel(UErrorCode &status);
1149 * Returns unit of volume: centiliter.
1150 * Caller owns returned value and must free it.
1151 * @param status ICU error code.
1154 static MeasureUnit *createCentiliter(UErrorCode &status);
1157 * Returns unit of volume: cubic-centimeter.
1158 * Caller owns returned value and must free it.
1159 * @param status ICU error code.
1162 static MeasureUnit *createCubicCentimeter(UErrorCode &status);
1165 * Returns unit of volume: cubic-foot.
1166 * Caller owns returned value and must free it.
1167 * @param status ICU error code.
1170 static MeasureUnit *createCubicFoot(UErrorCode &status);
1173 * Returns unit of volume: cubic-inch.
1174 * Caller owns returned value and must free it.
1175 * @param status ICU error code.
1178 static MeasureUnit *createCubicInch(UErrorCode &status);
1181 * Returns unit of volume: cubic-kilometer.
1182 * Caller owns returned value and must free it.
1183 * @param status ICU error code.
1186 static MeasureUnit *createCubicKilometer(UErrorCode &status);
1189 * Returns unit of volume: cubic-meter.
1190 * Caller owns returned value and must free it.
1191 * @param status ICU error code.
1194 static MeasureUnit *createCubicMeter(UErrorCode &status);
1197 * Returns unit of volume: cubic-mile.
1198 * Caller owns returned value and must free it.
1199 * @param status ICU error code.
1202 static MeasureUnit *createCubicMile(UErrorCode &status);
1205 * Returns unit of volume: cubic-yard.
1206 * Caller owns returned value and must free it.
1207 * @param status ICU error code.
1210 static MeasureUnit *createCubicYard(UErrorCode &status);
1213 * Returns unit of volume: cup.
1214 * Caller owns returned value and must free it.
1215 * @param status ICU error code.
1218 static MeasureUnit *createCup(UErrorCode &status);
1221 * Returns unit of volume: cup-metric.
1222 * Caller owns returned value and must free it.
1223 * @param status ICU error code.
1226 static MeasureUnit *createCupMetric(UErrorCode &status);
1229 * Returns unit of volume: deciliter.
1230 * Caller owns returned value and must free it.
1231 * @param status ICU error code.
1234 static MeasureUnit *createDeciliter(UErrorCode &status);
1237 * Returns unit of volume: fluid-ounce.
1238 * Caller owns returned value and must free it.
1239 * @param status ICU error code.
1242 static MeasureUnit *createFluidOunce(UErrorCode &status);
1245 * Returns unit of volume: gallon.
1246 * Caller owns returned value and must free it.
1247 * @param status ICU error code.
1250 static MeasureUnit *createGallon(UErrorCode &status);
1252 #ifndef U_HIDE_DRAFT_API
1254 * Returns unit of volume: gallon-imperial.
1255 * Caller owns returned value and must free it.
1256 * @param status ICU error code.
1259 static MeasureUnit *createGallonImperial(UErrorCode &status);
1260 #endif /* U_HIDE_DRAFT_API */
1263 * Returns unit of volume: hectoliter.
1264 * Caller owns returned value and must free it.
1265 * @param status ICU error code.
1268 static MeasureUnit *createHectoliter(UErrorCode &status);
1271 * Returns unit of volume: liter.
1272 * Caller owns returned value and must free it.
1273 * @param status ICU error code.
1276 static MeasureUnit *createLiter(UErrorCode &status);
1279 * Returns unit of volume: megaliter.
1280 * Caller owns returned value and must free it.
1281 * @param status ICU error code.
1284 static MeasureUnit *createMegaliter(UErrorCode &status);
1287 * Returns unit of volume: milliliter.
1288 * Caller owns returned value and must free it.
1289 * @param status ICU error code.
1292 static MeasureUnit *createMilliliter(UErrorCode &status);
1295 * Returns unit of volume: pint.
1296 * Caller owns returned value and must free it.
1297 * @param status ICU error code.
1300 static MeasureUnit *createPint(UErrorCode &status);
1303 * Returns unit of volume: pint-metric.
1304 * Caller owns returned value and must free it.
1305 * @param status ICU error code.
1308 static MeasureUnit *createPintMetric(UErrorCode &status);
1311 * Returns unit of volume: quart.
1312 * Caller owns returned value and must free it.
1313 * @param status ICU error code.
1316 static MeasureUnit *createQuart(UErrorCode &status);
1319 * Returns unit of volume: tablespoon.
1320 * Caller owns returned value and must free it.
1321 * @param status ICU error code.
1324 static MeasureUnit *createTablespoon(UErrorCode &status);
1327 * Returns unit of volume: teaspoon.
1328 * Caller owns returned value and must free it.
1329 * @param status ICU error code.
1332 static MeasureUnit *createTeaspoon(UErrorCode &status);
1335 // End generated createXXX methods
1339 #ifndef U_HIDE_INTERNAL_API
1344 void initTime(const char *timeId);
1350 void initCurrency(const char *isoCurrency);
1352 #endif /* U_HIDE_INTERNAL_API */
1359 MeasureUnit(int32_t typeId, int32_t subTypeId) : fTypeId(typeId), fSubTypeId(subTypeId) {
1362 void setTo(int32_t typeId, int32_t subTypeId);
1363 int32_t getOffset() const;
1364 static MeasureUnit *create(int typeId, int subTypeId, UErrorCode &status);
1369 #endif // !UNCONFIG_NO_FORMATTING
1370 #endif // __MEASUREUNIT_H__