]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/unicode/measunit.h
2 **********************************************************************
3 * Copyright (c) 2004-2016, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
7 * Created: April 26, 2004
9 **********************************************************************
11 #ifndef __MEASUREUNIT_H__
12 #define __MEASUREUNIT_H__
14 #include "unicode/utypes.h"
16 #if !UCONFIG_NO_FORMATTING
18 #include "unicode/unistr.h"
22 * \brief C++ API: A unit for measuring a quantity.
27 class StringEnumeration
;
30 * A unit such as length, mass, volume, currency, etc. A unit is
31 * coupled with a numeric amount to produce a Measure.
36 class U_I18N_API MeasureUnit
: public UObject
{
40 * Default constructor.
43 MeasureUnit() : fTypeId(0), fSubTypeId(0) {
51 MeasureUnit(const MeasureUnit
&other
);
54 * Assignment operator.
57 MeasureUnit
&operator=(const MeasureUnit
&other
);
60 * Returns a polymorphic clone of this object. The result will
61 * have the same class as returned by getDynamicClassID().
64 virtual UObject
* clone() const;
70 virtual ~MeasureUnit();
73 * Equality operator. Return true if this object is equal
74 * to the given object.
77 virtual UBool
operator==(const UObject
& other
) const;
80 * Inequality operator. Return true if this object is not equal
81 * to the given object.
84 UBool
operator!=(const UObject
& other
) const {
85 return !(*this == other
);
92 const char *getType() const;
98 const char *getSubtype() const;
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.
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.
111 static int32_t getAvailable(
112 MeasureUnit
*destArray
,
113 int32_t destCapacity
,
114 UErrorCode
&errorCode
);
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.
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.
128 static int32_t getAvailable(
130 MeasureUnit
*destArray
,
131 int32_t destCapacity
,
132 UErrorCode
&errorCode
);
135 * getAvailableTypes gets all of the available types. Caller owns the
136 * returned StringEnumeration and must delete it when finished using it.
138 * @param errorCode ICU error code.
142 static StringEnumeration
* getAvailableTypes(UErrorCode
&errorCode
);
145 * Return the class ID for this class. This is useful only for comparing to
146 * a return value from getDynamicClassID(). For example:
148 * . Base* polymorphic_pointer = createPolymorphicObject();
149 * . if (polymorphic_pointer->getDynamicClassID() ==
150 * . erived::getStaticClassID()) ...
152 * @return The class ID for all objects of this class.
155 static UClassID U_EXPORT2
getStaticClassID(void);
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.
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.
168 virtual UClassID
getDynamicClassID(void) const;
170 #ifndef U_HIDE_INTERNAL_API
173 * Returns associated array index for this measure unit. Only valid for
174 * non-currency measure units.
177 int32_t getIndex() const;
181 * Returns maximum value from getIndex plus 1.
184 static int32_t getIndexCount();
188 * @return the unit.getIndex() of the unit which has this unit.getType() and unit.getSubtype(),
189 * or a negative value if there is no such unit
192 static int32_t internalGetIndexForTypeAndSubtype(const char *type
, const char *subtype
);
198 static MeasureUnit
*resolveUnitPerUnit(
199 const MeasureUnit
&unit
, const MeasureUnit
&perUnit
);
200 #endif /* U_HIDE_INTERNAL_API */
202 // All code between the "Start generated createXXX methods" comment and
203 // the "End generated createXXX methods" comment is auto generated code
204 // and must not be edited manually. For instructions on how to correctly
205 // update this code, refer to:
206 // http://site.icu-project.org/design/formatting/measureformat/updating-measure-unit
208 // Start generated createXXX methods
211 * Returns unit of acceleration: g-force.
212 * Caller owns returned value and must free it.
213 * @param status ICU error code.
216 static MeasureUnit
*createGForce(UErrorCode
&status
);
219 * Returns unit of acceleration: meter-per-second-squared.
220 * Caller owns returned value and must free it.
221 * @param status ICU error code.
224 static MeasureUnit
*createMeterPerSecondSquared(UErrorCode
&status
);
227 * Returns unit of angle: arc-minute.
228 * Caller owns returned value and must free it.
229 * @param status ICU error code.
232 static MeasureUnit
*createArcMinute(UErrorCode
&status
);
235 * Returns unit of angle: arc-second.
236 * Caller owns returned value and must free it.
237 * @param status ICU error code.
240 static MeasureUnit
*createArcSecond(UErrorCode
&status
);
243 * Returns unit of angle: degree.
244 * Caller owns returned value and must free it.
245 * @param status ICU error code.
248 static MeasureUnit
*createDegree(UErrorCode
&status
);
251 * Returns unit of angle: radian.
252 * Caller owns returned value and must free it.
253 * @param status ICU error code.
256 static MeasureUnit
*createRadian(UErrorCode
&status
);
258 #ifndef U_HIDE_DRAFT_API
260 * Returns unit of angle: revolution.
261 * Caller owns returned value and must free it.
262 * @param status ICU error code.
265 static MeasureUnit
*createRevolutionAngle(UErrorCode
&status
);
266 #endif /* U_HIDE_DRAFT_API */
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 */
378 #ifndef U_HIDE_DRAFT_API
380 * Returns unit of consumption: liter-per-100kilometers.
381 * Caller owns returned value and must free it.
382 * @param status ICU error code.
385 static MeasureUnit
*createLiterPer100Kilometers(UErrorCode
&status
);
386 #endif /* U_HIDE_DRAFT_API */
389 * Returns unit of consumption: liter-per-kilometer.
390 * Caller owns returned value and must free it.
391 * @param status ICU error code.
394 static MeasureUnit
*createLiterPerKilometer(UErrorCode
&status
);
397 * Returns unit of consumption: mile-per-gallon.
398 * Caller owns returned value and must free it.
399 * @param status ICU error code.
402 static MeasureUnit
*createMilePerGallon(UErrorCode
&status
);
404 #ifndef U_HIDE_DRAFT_API
406 * Returns unit of consumption: mile-per-gallon-imperial.
407 * Caller owns returned value and must free it.
408 * @param status ICU error code.
411 static MeasureUnit
*createMilePerGallonImperial(UErrorCode
&status
);
412 #endif /* U_HIDE_DRAFT_API */
415 * Returns unit of digital: bit.
416 * Caller owns returned value and must free it.
417 * @param status ICU error code.
420 static MeasureUnit
*createBit(UErrorCode
&status
);
423 * Returns unit of digital: byte.
424 * Caller owns returned value and must free it.
425 * @param status ICU error code.
428 static MeasureUnit
*createByte(UErrorCode
&status
);
431 * Returns unit of digital: gigabit.
432 * Caller owns returned value and must free it.
433 * @param status ICU error code.
436 static MeasureUnit
*createGigabit(UErrorCode
&status
);
439 * Returns unit of digital: gigabyte.
440 * Caller owns returned value and must free it.
441 * @param status ICU error code.
444 static MeasureUnit
*createGigabyte(UErrorCode
&status
);
447 * Returns unit of digital: kilobit.
448 * Caller owns returned value and must free it.
449 * @param status ICU error code.
452 static MeasureUnit
*createKilobit(UErrorCode
&status
);
455 * Returns unit of digital: kilobyte.
456 * Caller owns returned value and must free it.
457 * @param status ICU error code.
460 static MeasureUnit
*createKilobyte(UErrorCode
&status
);
463 * Returns unit of digital: megabit.
464 * Caller owns returned value and must free it.
465 * @param status ICU error code.
468 static MeasureUnit
*createMegabit(UErrorCode
&status
);
471 * Returns unit of digital: megabyte.
472 * Caller owns returned value and must free it.
473 * @param status ICU error code.
476 static MeasureUnit
*createMegabyte(UErrorCode
&status
);
479 * Returns unit of digital: terabit.
480 * Caller owns returned value and must free it.
481 * @param status ICU error code.
484 static MeasureUnit
*createTerabit(UErrorCode
&status
);
487 * Returns unit of digital: terabyte.
488 * Caller owns returned value and must free it.
489 * @param status ICU error code.
492 static MeasureUnit
*createTerabyte(UErrorCode
&status
);
494 #ifndef U_HIDE_DRAFT_API
496 * Returns unit of duration: century.
497 * Caller owns returned value and must free it.
498 * @param status ICU error code.
501 static MeasureUnit
*createCentury(UErrorCode
&status
);
502 #endif /* U_HIDE_DRAFT_API */
505 * Returns unit of duration: day.
506 * Caller owns returned value and must free it.
507 * @param status ICU error code.
510 static MeasureUnit
*createDay(UErrorCode
&status
);
513 * Returns unit of duration: hour.
514 * Caller owns returned value and must free it.
515 * @param status ICU error code.
518 static MeasureUnit
*createHour(UErrorCode
&status
);
521 * Returns unit of duration: microsecond.
522 * Caller owns returned value and must free it.
523 * @param status ICU error code.
526 static MeasureUnit
*createMicrosecond(UErrorCode
&status
);
529 * Returns unit of duration: millisecond.
530 * Caller owns returned value and must free it.
531 * @param status ICU error code.
534 static MeasureUnit
*createMillisecond(UErrorCode
&status
);
537 * Returns unit of duration: minute.
538 * Caller owns returned value and must free it.
539 * @param status ICU error code.
542 static MeasureUnit
*createMinute(UErrorCode
&status
);
545 * Returns unit of duration: month.
546 * Caller owns returned value and must free it.
547 * @param status ICU error code.
550 static MeasureUnit
*createMonth(UErrorCode
&status
);
553 * Returns unit of duration: nanosecond.
554 * Caller owns returned value and must free it.
555 * @param status ICU error code.
558 static MeasureUnit
*createNanosecond(UErrorCode
&status
);
561 * Returns unit of duration: second.
562 * Caller owns returned value and must free it.
563 * @param status ICU error code.
566 static MeasureUnit
*createSecond(UErrorCode
&status
);
569 * Returns unit of duration: week.
570 * Caller owns returned value and must free it.
571 * @param status ICU error code.
574 static MeasureUnit
*createWeek(UErrorCode
&status
);
577 * Returns unit of duration: year.
578 * Caller owns returned value and must free it.
579 * @param status ICU error code.
582 static MeasureUnit
*createYear(UErrorCode
&status
);
585 * Returns unit of electric: ampere.
586 * Caller owns returned value and must free it.
587 * @param status ICU error code.
590 static MeasureUnit
*createAmpere(UErrorCode
&status
);
593 * Returns unit of electric: milliampere.
594 * Caller owns returned value and must free it.
595 * @param status ICU error code.
598 static MeasureUnit
*createMilliampere(UErrorCode
&status
);
601 * Returns unit of electric: ohm.
602 * Caller owns returned value and must free it.
603 * @param status ICU error code.
606 static MeasureUnit
*createOhm(UErrorCode
&status
);
609 * Returns unit of electric: volt.
610 * Caller owns returned value and must free it.
611 * @param status ICU error code.
614 static MeasureUnit
*createVolt(UErrorCode
&status
);
617 * Returns unit of energy: calorie.
618 * Caller owns returned value and must free it.
619 * @param status ICU error code.
622 static MeasureUnit
*createCalorie(UErrorCode
&status
);
625 * Returns unit of energy: foodcalorie.
626 * Caller owns returned value and must free it.
627 * @param status ICU error code.
630 static MeasureUnit
*createFoodcalorie(UErrorCode
&status
);
633 * Returns unit of energy: joule.
634 * Caller owns returned value and must free it.
635 * @param status ICU error code.
638 static MeasureUnit
*createJoule(UErrorCode
&status
);
641 * Returns unit of energy: kilocalorie.
642 * Caller owns returned value and must free it.
643 * @param status ICU error code.
646 static MeasureUnit
*createKilocalorie(UErrorCode
&status
);
649 * Returns unit of energy: kilojoule.
650 * Caller owns returned value and must free it.
651 * @param status ICU error code.
654 static MeasureUnit
*createKilojoule(UErrorCode
&status
);
657 * Returns unit of energy: kilowatt-hour.
658 * Caller owns returned value and must free it.
659 * @param status ICU error code.
662 static MeasureUnit
*createKilowattHour(UErrorCode
&status
);
665 * Returns unit of frequency: gigahertz.
666 * Caller owns returned value and must free it.
667 * @param status ICU error code.
670 static MeasureUnit
*createGigahertz(UErrorCode
&status
);
673 * Returns unit of frequency: hertz.
674 * Caller owns returned value and must free it.
675 * @param status ICU error code.
678 static MeasureUnit
*createHertz(UErrorCode
&status
);
681 * Returns unit of frequency: kilohertz.
682 * Caller owns returned value and must free it.
683 * @param status ICU error code.
686 static MeasureUnit
*createKilohertz(UErrorCode
&status
);
689 * Returns unit of frequency: megahertz.
690 * Caller owns returned value and must free it.
691 * @param status ICU error code.
694 static MeasureUnit
*createMegahertz(UErrorCode
&status
);
697 * Returns unit of length: astronomical-unit.
698 * Caller owns returned value and must free it.
699 * @param status ICU error code.
702 static MeasureUnit
*createAstronomicalUnit(UErrorCode
&status
);
705 * Returns unit of length: centimeter.
706 * Caller owns returned value and must free it.
707 * @param status ICU error code.
710 static MeasureUnit
*createCentimeter(UErrorCode
&status
);
713 * Returns unit of length: decimeter.
714 * Caller owns returned value and must free it.
715 * @param status ICU error code.
718 static MeasureUnit
*createDecimeter(UErrorCode
&status
);
721 * Returns unit of length: fathom.
722 * Caller owns returned value and must free it.
723 * @param status ICU error code.
726 static MeasureUnit
*createFathom(UErrorCode
&status
);
729 * Returns unit of length: foot.
730 * Caller owns returned value and must free it.
731 * @param status ICU error code.
734 static MeasureUnit
*createFoot(UErrorCode
&status
);
737 * Returns unit of length: furlong.
738 * Caller owns returned value and must free it.
739 * @param status ICU error code.
742 static MeasureUnit
*createFurlong(UErrorCode
&status
);
745 * Returns unit of length: inch.
746 * Caller owns returned value and must free it.
747 * @param status ICU error code.
750 static MeasureUnit
*createInch(UErrorCode
&status
);
753 * Returns unit of length: kilometer.
754 * Caller owns returned value and must free it.
755 * @param status ICU error code.
758 static MeasureUnit
*createKilometer(UErrorCode
&status
);
761 * Returns unit of length: light-year.
762 * Caller owns returned value and must free it.
763 * @param status ICU error code.
766 static MeasureUnit
*createLightYear(UErrorCode
&status
);
769 * Returns unit of length: meter.
770 * Caller owns returned value and must free it.
771 * @param status ICU error code.
774 static MeasureUnit
*createMeter(UErrorCode
&status
);
777 * Returns unit of length: micrometer.
778 * Caller owns returned value and must free it.
779 * @param status ICU error code.
782 static MeasureUnit
*createMicrometer(UErrorCode
&status
);
785 * Returns unit of length: mile.
786 * Caller owns returned value and must free it.
787 * @param status ICU error code.
790 static MeasureUnit
*createMile(UErrorCode
&status
);
792 #ifndef U_HIDE_DRAFT_API
794 * Returns unit of length: mile-scandinavian.
795 * Caller owns returned value and must free it.
796 * @param status ICU error code.
799 static MeasureUnit
*createMileScandinavian(UErrorCode
&status
);
800 #endif /* U_HIDE_DRAFT_API */
803 * Returns unit of length: millimeter.
804 * Caller owns returned value and must free it.
805 * @param status ICU error code.
808 static MeasureUnit
*createMillimeter(UErrorCode
&status
);
811 * Returns unit of length: nanometer.
812 * Caller owns returned value and must free it.
813 * @param status ICU error code.
816 static MeasureUnit
*createNanometer(UErrorCode
&status
);
819 * Returns unit of length: nautical-mile.
820 * Caller owns returned value and must free it.
821 * @param status ICU error code.
824 static MeasureUnit
*createNauticalMile(UErrorCode
&status
);
827 * Returns unit of length: parsec.
828 * Caller owns returned value and must free it.
829 * @param status ICU error code.
832 static MeasureUnit
*createParsec(UErrorCode
&status
);
835 * Returns unit of length: picometer.
836 * Caller owns returned value and must free it.
837 * @param status ICU error code.
840 static MeasureUnit
*createPicometer(UErrorCode
&status
);
843 * Returns unit of length: yard.
844 * Caller owns returned value and must free it.
845 * @param status ICU error code.
848 static MeasureUnit
*createYard(UErrorCode
&status
);
851 * Returns unit of light: lux.
852 * Caller owns returned value and must free it.
853 * @param status ICU error code.
856 static MeasureUnit
*createLux(UErrorCode
&status
);
859 * Returns unit of mass: carat.
860 * Caller owns returned value and must free it.
861 * @param status ICU error code.
864 static MeasureUnit
*createCarat(UErrorCode
&status
);
867 * Returns unit of mass: gram.
868 * Caller owns returned value and must free it.
869 * @param status ICU error code.
872 static MeasureUnit
*createGram(UErrorCode
&status
);
875 * Returns unit of mass: kilogram.
876 * Caller owns returned value and must free it.
877 * @param status ICU error code.
880 static MeasureUnit
*createKilogram(UErrorCode
&status
);
883 * Returns unit of mass: metric-ton.
884 * Caller owns returned value and must free it.
885 * @param status ICU error code.
888 static MeasureUnit
*createMetricTon(UErrorCode
&status
);
891 * Returns unit of mass: microgram.
892 * Caller owns returned value and must free it.
893 * @param status ICU error code.
896 static MeasureUnit
*createMicrogram(UErrorCode
&status
);
899 * Returns unit of mass: milligram.
900 * Caller owns returned value and must free it.
901 * @param status ICU error code.
904 static MeasureUnit
*createMilligram(UErrorCode
&status
);
907 * Returns unit of mass: ounce.
908 * Caller owns returned value and must free it.
909 * @param status ICU error code.
912 static MeasureUnit
*createOunce(UErrorCode
&status
);
915 * Returns unit of mass: ounce-troy.
916 * Caller owns returned value and must free it.
917 * @param status ICU error code.
920 static MeasureUnit
*createOunceTroy(UErrorCode
&status
);
923 * Returns unit of mass: pound.
924 * Caller owns returned value and must free it.
925 * @param status ICU error code.
928 static MeasureUnit
*createPound(UErrorCode
&status
);
931 * Returns unit of mass: stone.
932 * Caller owns returned value and must free it.
933 * @param status ICU error code.
936 static MeasureUnit
*createStone(UErrorCode
&status
);
939 * Returns unit of mass: ton.
940 * Caller owns returned value and must free it.
941 * @param status ICU error code.
944 static MeasureUnit
*createTon(UErrorCode
&status
);
947 * Returns unit of power: gigawatt.
948 * Caller owns returned value and must free it.
949 * @param status ICU error code.
952 static MeasureUnit
*createGigawatt(UErrorCode
&status
);
955 * Returns unit of power: horsepower.
956 * Caller owns returned value and must free it.
957 * @param status ICU error code.
960 static MeasureUnit
*createHorsepower(UErrorCode
&status
);
963 * Returns unit of power: kilowatt.
964 * Caller owns returned value and must free it.
965 * @param status ICU error code.
968 static MeasureUnit
*createKilowatt(UErrorCode
&status
);
971 * Returns unit of power: megawatt.
972 * Caller owns returned value and must free it.
973 * @param status ICU error code.
976 static MeasureUnit
*createMegawatt(UErrorCode
&status
);
979 * Returns unit of power: milliwatt.
980 * Caller owns returned value and must free it.
981 * @param status ICU error code.
984 static MeasureUnit
*createMilliwatt(UErrorCode
&status
);
987 * Returns unit of power: watt.
988 * Caller owns returned value and must free it.
989 * @param status ICU error code.
992 static MeasureUnit
*createWatt(UErrorCode
&status
);
995 * Returns unit of pressure: hectopascal.
996 * Caller owns returned value and must free it.
997 * @param status ICU error code.
1000 static MeasureUnit
*createHectopascal(UErrorCode
&status
);
1003 * Returns unit of pressure: inch-hg.
1004 * Caller owns returned value and must free it.
1005 * @param status ICU error code.
1008 static MeasureUnit
*createInchHg(UErrorCode
&status
);
1011 * Returns unit of pressure: millibar.
1012 * Caller owns returned value and must free it.
1013 * @param status ICU error code.
1016 static MeasureUnit
*createMillibar(UErrorCode
&status
);
1019 * Returns unit of pressure: millimeter-of-mercury.
1020 * Caller owns returned value and must free it.
1021 * @param status ICU error code.
1024 static MeasureUnit
*createMillimeterOfMercury(UErrorCode
&status
);
1027 * Returns unit of pressure: pound-per-square-inch.
1028 * Caller owns returned value and must free it.
1029 * @param status ICU error code.
1032 static MeasureUnit
*createPoundPerSquareInch(UErrorCode
&status
);
1035 * Returns unit of speed: kilometer-per-hour.
1036 * Caller owns returned value and must free it.
1037 * @param status ICU error code.
1040 static MeasureUnit
*createKilometerPerHour(UErrorCode
&status
);
1042 #ifndef U_HIDE_DRAFT_API
1044 * Returns unit of speed: knot.
1045 * Caller owns returned value and must free it.
1046 * @param status ICU error code.
1049 static MeasureUnit
*createKnot(UErrorCode
&status
);
1050 #endif /* U_HIDE_DRAFT_API */
1053 * Returns unit of speed: meter-per-second.
1054 * Caller owns returned value and must free it.
1055 * @param status ICU error code.
1058 static MeasureUnit
*createMeterPerSecond(UErrorCode
&status
);
1061 * Returns unit of speed: mile-per-hour.
1062 * Caller owns returned value and must free it.
1063 * @param status ICU error code.
1066 static MeasureUnit
*createMilePerHour(UErrorCode
&status
);
1069 * Returns unit of temperature: celsius.
1070 * Caller owns returned value and must free it.
1071 * @param status ICU error code.
1074 static MeasureUnit
*createCelsius(UErrorCode
&status
);
1077 * Returns unit of temperature: fahrenheit.
1078 * Caller owns returned value and must free it.
1079 * @param status ICU error code.
1082 static MeasureUnit
*createFahrenheit(UErrorCode
&status
);
1084 #ifndef U_HIDE_DRAFT_API
1086 * Returns unit of temperature: generic.
1087 * Caller owns returned value and must free it.
1088 * @param status ICU error code.
1091 static MeasureUnit
*createGenericTemperature(UErrorCode
&status
);
1092 #endif /* U_HIDE_DRAFT_API */
1095 * Returns unit of temperature: kelvin.
1096 * Caller owns returned value and must free it.
1097 * @param status ICU error code.
1100 static MeasureUnit
*createKelvin(UErrorCode
&status
);
1103 * Returns unit of volume: acre-foot.
1104 * Caller owns returned value and must free it.
1105 * @param status ICU error code.
1108 static MeasureUnit
*createAcreFoot(UErrorCode
&status
);
1111 * Returns unit of volume: bushel.
1112 * Caller owns returned value and must free it.
1113 * @param status ICU error code.
1116 static MeasureUnit
*createBushel(UErrorCode
&status
);
1119 * Returns unit of volume: centiliter.
1120 * Caller owns returned value and must free it.
1121 * @param status ICU error code.
1124 static MeasureUnit
*createCentiliter(UErrorCode
&status
);
1127 * Returns unit of volume: cubic-centimeter.
1128 * Caller owns returned value and must free it.
1129 * @param status ICU error code.
1132 static MeasureUnit
*createCubicCentimeter(UErrorCode
&status
);
1135 * Returns unit of volume: cubic-foot.
1136 * Caller owns returned value and must free it.
1137 * @param status ICU error code.
1140 static MeasureUnit
*createCubicFoot(UErrorCode
&status
);
1143 * Returns unit of volume: cubic-inch.
1144 * Caller owns returned value and must free it.
1145 * @param status ICU error code.
1148 static MeasureUnit
*createCubicInch(UErrorCode
&status
);
1151 * Returns unit of volume: cubic-kilometer.
1152 * Caller owns returned value and must free it.
1153 * @param status ICU error code.
1156 static MeasureUnit
*createCubicKilometer(UErrorCode
&status
);
1159 * Returns unit of volume: cubic-meter.
1160 * Caller owns returned value and must free it.
1161 * @param status ICU error code.
1164 static MeasureUnit
*createCubicMeter(UErrorCode
&status
);
1167 * Returns unit of volume: cubic-mile.
1168 * Caller owns returned value and must free it.
1169 * @param status ICU error code.
1172 static MeasureUnit
*createCubicMile(UErrorCode
&status
);
1175 * Returns unit of volume: cubic-yard.
1176 * Caller owns returned value and must free it.
1177 * @param status ICU error code.
1180 static MeasureUnit
*createCubicYard(UErrorCode
&status
);
1183 * Returns unit of volume: cup.
1184 * Caller owns returned value and must free it.
1185 * @param status ICU error code.
1188 static MeasureUnit
*createCup(UErrorCode
&status
);
1190 #ifndef U_HIDE_DRAFT_API
1192 * Returns unit of volume: cup-metric.
1193 * Caller owns returned value and must free it.
1194 * @param status ICU error code.
1197 static MeasureUnit
*createCupMetric(UErrorCode
&status
);
1198 #endif /* U_HIDE_DRAFT_API */
1201 * Returns unit of volume: deciliter.
1202 * Caller owns returned value and must free it.
1203 * @param status ICU error code.
1206 static MeasureUnit
*createDeciliter(UErrorCode
&status
);
1209 * Returns unit of volume: fluid-ounce.
1210 * Caller owns returned value and must free it.
1211 * @param status ICU error code.
1214 static MeasureUnit
*createFluidOunce(UErrorCode
&status
);
1217 * Returns unit of volume: gallon.
1218 * Caller owns returned value and must free it.
1219 * @param status ICU error code.
1222 static MeasureUnit
*createGallon(UErrorCode
&status
);
1224 #ifndef U_HIDE_DRAFT_API
1226 * Returns unit of volume: gallon-imperial.
1227 * Caller owns returned value and must free it.
1228 * @param status ICU error code.
1231 static MeasureUnit
*createGallonImperial(UErrorCode
&status
);
1232 #endif /* U_HIDE_DRAFT_API */
1235 * Returns unit of volume: hectoliter.
1236 * Caller owns returned value and must free it.
1237 * @param status ICU error code.
1240 static MeasureUnit
*createHectoliter(UErrorCode
&status
);
1243 * Returns unit of volume: liter.
1244 * Caller owns returned value and must free it.
1245 * @param status ICU error code.
1248 static MeasureUnit
*createLiter(UErrorCode
&status
);
1251 * Returns unit of volume: megaliter.
1252 * Caller owns returned value and must free it.
1253 * @param status ICU error code.
1256 static MeasureUnit
*createMegaliter(UErrorCode
&status
);
1259 * Returns unit of volume: milliliter.
1260 * Caller owns returned value and must free it.
1261 * @param status ICU error code.
1264 static MeasureUnit
*createMilliliter(UErrorCode
&status
);
1267 * Returns unit of volume: pint.
1268 * Caller owns returned value and must free it.
1269 * @param status ICU error code.
1272 static MeasureUnit
*createPint(UErrorCode
&status
);
1274 #ifndef U_HIDE_DRAFT_API
1276 * Returns unit of volume: pint-metric.
1277 * Caller owns returned value and must free it.
1278 * @param status ICU error code.
1281 static MeasureUnit
*createPintMetric(UErrorCode
&status
);
1282 #endif /* U_HIDE_DRAFT_API */
1285 * Returns unit of volume: quart.
1286 * Caller owns returned value and must free it.
1287 * @param status ICU error code.
1290 static MeasureUnit
*createQuart(UErrorCode
&status
);
1293 * Returns unit of volume: tablespoon.
1294 * Caller owns returned value and must free it.
1295 * @param status ICU error code.
1298 static MeasureUnit
*createTablespoon(UErrorCode
&status
);
1301 * Returns unit of volume: teaspoon.
1302 * Caller owns returned value and must free it.
1303 * @param status ICU error code.
1306 static MeasureUnit
*createTeaspoon(UErrorCode
&status
);
1309 // End generated createXXX methods
1313 #ifndef U_HIDE_INTERNAL_API
1318 void initTime(const char *timeId
);
1324 void initCurrency(const char *isoCurrency
);
1326 #endif /* U_HIDE_INTERNAL_API */
1333 MeasureUnit(int32_t typeId
, int32_t subTypeId
) : fTypeId(typeId
), fSubTypeId(subTypeId
) {
1336 void setTo(int32_t typeId
, int32_t subTypeId
);
1337 int32_t getOffset() const;
1338 static MeasureUnit
*create(int typeId
, int subTypeId
, UErrorCode
&status
);
1343 #endif // !UNCONFIG_NO_FORMATTING
1344 #endif // __MEASUREUNIT_H__