2 **********************************************************************
3 * Copyright (c) 2004-2015, 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();
190 static MeasureUnit
*resolveUnitPerUnit(
191 const MeasureUnit
&unit
, const MeasureUnit
&perUnit
);
192 #endif /* U_HIDE_INTERNAL_API */
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
200 // Start generated createXXX methods
203 * Returns unit of acceleration: g-force.
204 * Caller owns returned value and must free it.
205 * @param status ICU error code.
208 static MeasureUnit
*createGForce(UErrorCode
&status
);
210 #ifndef U_HIDE_DRAFT_API
212 * Returns unit of acceleration: meter-per-second-squared.
213 * Caller owns returned value and must free it.
214 * @param status ICU error code.
217 static MeasureUnit
*createMeterPerSecondSquared(UErrorCode
&status
);
219 #endif /* U_HIDE_DRAFT_API */
221 * Returns unit of angle: arc-minute.
222 * Caller owns returned value and must free it.
223 * @param status ICU error code.
226 static MeasureUnit
*createArcMinute(UErrorCode
&status
);
229 * Returns unit of angle: arc-second.
230 * Caller owns returned value and must free it.
231 * @param status ICU error code.
234 static MeasureUnit
*createArcSecond(UErrorCode
&status
);
237 * Returns unit of angle: degree.
238 * Caller owns returned value and must free it.
239 * @param status ICU error code.
242 static MeasureUnit
*createDegree(UErrorCode
&status
);
244 #ifndef U_HIDE_DRAFT_API
246 * Returns unit of angle: radian.
247 * Caller owns returned value and must free it.
248 * @param status ICU error code.
251 static MeasureUnit
*createRadian(UErrorCode
&status
);
253 #endif /* U_HIDE_DRAFT_API */
255 * Returns unit of area: acre.
256 * Caller owns returned value and must free it.
257 * @param status ICU error code.
260 static MeasureUnit
*createAcre(UErrorCode
&status
);
263 * Returns unit of area: hectare.
264 * Caller owns returned value and must free it.
265 * @param status ICU error code.
268 static MeasureUnit
*createHectare(UErrorCode
&status
);
270 #ifndef U_HIDE_DRAFT_API
272 * Returns unit of area: square-centimeter.
273 * Caller owns returned value and must free it.
274 * @param status ICU error code.
277 static MeasureUnit
*createSquareCentimeter(UErrorCode
&status
);
279 #endif /* U_HIDE_DRAFT_API */
281 * Returns unit of area: square-foot.
282 * Caller owns returned value and must free it.
283 * @param status ICU error code.
286 static MeasureUnit
*createSquareFoot(UErrorCode
&status
);
288 #ifndef U_HIDE_DRAFT_API
290 * Returns unit of area: square-inch.
291 * Caller owns returned value and must free it.
292 * @param status ICU error code.
295 static MeasureUnit
*createSquareInch(UErrorCode
&status
);
297 #endif /* U_HIDE_DRAFT_API */
299 * Returns unit of area: square-kilometer.
300 * Caller owns returned value and must free it.
301 * @param status ICU error code.
304 static MeasureUnit
*createSquareKilometer(UErrorCode
&status
);
307 * Returns unit of area: square-meter.
308 * Caller owns returned value and must free it.
309 * @param status ICU error code.
312 static MeasureUnit
*createSquareMeter(UErrorCode
&status
);
315 * Returns unit of area: square-mile.
316 * Caller owns returned value and must free it.
317 * @param status ICU error code.
320 static MeasureUnit
*createSquareMile(UErrorCode
&status
);
322 #ifndef U_HIDE_DRAFT_API
324 * Returns unit of area: square-yard.
325 * Caller owns returned value and must free it.
326 * @param status ICU error code.
329 static MeasureUnit
*createSquareYard(UErrorCode
&status
);
331 #endif /* U_HIDE_DRAFT_API */
332 #ifndef U_HIDE_DRAFT_API
334 * Returns unit of consumption: liter-per-kilometer.
335 * Caller owns returned value and must free it.
336 * @param status ICU error code.
339 static MeasureUnit
*createLiterPerKilometer(UErrorCode
&status
);
341 #endif /* U_HIDE_DRAFT_API */
342 #ifndef U_HIDE_DRAFT_API
344 * Returns unit of consumption: mile-per-gallon.
345 * Caller owns returned value and must free it.
346 * @param status ICU error code.
349 static MeasureUnit
*createMilePerGallon(UErrorCode
&status
);
351 #endif /* U_HIDE_DRAFT_API */
352 #ifndef U_HIDE_DRAFT_API
354 * Returns unit of digital: bit.
355 * Caller owns returned value and must free it.
356 * @param status ICU error code.
359 static MeasureUnit
*createBit(UErrorCode
&status
);
361 #endif /* U_HIDE_DRAFT_API */
362 #ifndef U_HIDE_DRAFT_API
364 * Returns unit of digital: byte.
365 * Caller owns returned value and must free it.
366 * @param status ICU error code.
369 static MeasureUnit
*createByte(UErrorCode
&status
);
371 #endif /* U_HIDE_DRAFT_API */
372 #ifndef U_HIDE_DRAFT_API
374 * Returns unit of digital: gigabit.
375 * Caller owns returned value and must free it.
376 * @param status ICU error code.
379 static MeasureUnit
*createGigabit(UErrorCode
&status
);
381 #endif /* U_HIDE_DRAFT_API */
382 #ifndef U_HIDE_DRAFT_API
384 * Returns unit of digital: gigabyte.
385 * Caller owns returned value and must free it.
386 * @param status ICU error code.
389 static MeasureUnit
*createGigabyte(UErrorCode
&status
);
391 #endif /* U_HIDE_DRAFT_API */
392 #ifndef U_HIDE_DRAFT_API
394 * Returns unit of digital: kilobit.
395 * Caller owns returned value and must free it.
396 * @param status ICU error code.
399 static MeasureUnit
*createKilobit(UErrorCode
&status
);
401 #endif /* U_HIDE_DRAFT_API */
402 #ifndef U_HIDE_DRAFT_API
404 * Returns unit of digital: kilobyte.
405 * Caller owns returned value and must free it.
406 * @param status ICU error code.
409 static MeasureUnit
*createKilobyte(UErrorCode
&status
);
411 #endif /* U_HIDE_DRAFT_API */
412 #ifndef U_HIDE_DRAFT_API
414 * Returns unit of digital: megabit.
415 * Caller owns returned value and must free it.
416 * @param status ICU error code.
419 static MeasureUnit
*createMegabit(UErrorCode
&status
);
421 #endif /* U_HIDE_DRAFT_API */
422 #ifndef U_HIDE_DRAFT_API
424 * Returns unit of digital: megabyte.
425 * Caller owns returned value and must free it.
426 * @param status ICU error code.
429 static MeasureUnit
*createMegabyte(UErrorCode
&status
);
431 #endif /* U_HIDE_DRAFT_API */
432 #ifndef U_HIDE_DRAFT_API
434 * Returns unit of digital: terabit.
435 * Caller owns returned value and must free it.
436 * @param status ICU error code.
439 static MeasureUnit
*createTerabit(UErrorCode
&status
);
441 #endif /* U_HIDE_DRAFT_API */
442 #ifndef U_HIDE_DRAFT_API
444 * Returns unit of digital: terabyte.
445 * Caller owns returned value and must free it.
446 * @param status ICU error code.
449 static MeasureUnit
*createTerabyte(UErrorCode
&status
);
451 #endif /* U_HIDE_DRAFT_API */
453 * Returns unit of duration: day.
454 * Caller owns returned value and must free it.
455 * @param status ICU error code.
458 static MeasureUnit
*createDay(UErrorCode
&status
);
461 * Returns unit of duration: hour.
462 * Caller owns returned value and must free it.
463 * @param status ICU error code.
466 static MeasureUnit
*createHour(UErrorCode
&status
);
468 #ifndef U_HIDE_DRAFT_API
470 * Returns unit of duration: microsecond.
471 * Caller owns returned value and must free it.
472 * @param status ICU error code.
475 static MeasureUnit
*createMicrosecond(UErrorCode
&status
);
477 #endif /* U_HIDE_DRAFT_API */
479 * Returns unit of duration: millisecond.
480 * Caller owns returned value and must free it.
481 * @param status ICU error code.
484 static MeasureUnit
*createMillisecond(UErrorCode
&status
);
487 * Returns unit of duration: minute.
488 * Caller owns returned value and must free it.
489 * @param status ICU error code.
492 static MeasureUnit
*createMinute(UErrorCode
&status
);
495 * Returns unit of duration: month.
496 * Caller owns returned value and must free it.
497 * @param status ICU error code.
500 static MeasureUnit
*createMonth(UErrorCode
&status
);
502 #ifndef U_HIDE_DRAFT_API
504 * Returns unit of duration: nanosecond.
505 * Caller owns returned value and must free it.
506 * @param status ICU error code.
509 static MeasureUnit
*createNanosecond(UErrorCode
&status
);
511 #endif /* U_HIDE_DRAFT_API */
513 * Returns unit of duration: second.
514 * Caller owns returned value and must free it.
515 * @param status ICU error code.
518 static MeasureUnit
*createSecond(UErrorCode
&status
);
521 * Returns unit of duration: week.
522 * Caller owns returned value and must free it.
523 * @param status ICU error code.
526 static MeasureUnit
*createWeek(UErrorCode
&status
);
529 * Returns unit of duration: year.
530 * Caller owns returned value and must free it.
531 * @param status ICU error code.
534 static MeasureUnit
*createYear(UErrorCode
&status
);
536 #ifndef U_HIDE_DRAFT_API
538 * Returns unit of electric: ampere.
539 * Caller owns returned value and must free it.
540 * @param status ICU error code.
543 static MeasureUnit
*createAmpere(UErrorCode
&status
);
545 #endif /* U_HIDE_DRAFT_API */
546 #ifndef U_HIDE_DRAFT_API
548 * Returns unit of electric: milliampere.
549 * Caller owns returned value and must free it.
550 * @param status ICU error code.
553 static MeasureUnit
*createMilliampere(UErrorCode
&status
);
555 #endif /* U_HIDE_DRAFT_API */
556 #ifndef U_HIDE_DRAFT_API
558 * Returns unit of electric: ohm.
559 * Caller owns returned value and must free it.
560 * @param status ICU error code.
563 static MeasureUnit
*createOhm(UErrorCode
&status
);
565 #endif /* U_HIDE_DRAFT_API */
566 #ifndef U_HIDE_DRAFT_API
568 * Returns unit of electric: volt.
569 * Caller owns returned value and must free it.
570 * @param status ICU error code.
573 static MeasureUnit
*createVolt(UErrorCode
&status
);
575 #endif /* U_HIDE_DRAFT_API */
576 #ifndef U_HIDE_DRAFT_API
578 * Returns unit of energy: calorie.
579 * Caller owns returned value and must free it.
580 * @param status ICU error code.
583 static MeasureUnit
*createCalorie(UErrorCode
&status
);
585 #endif /* U_HIDE_DRAFT_API */
586 #ifndef U_HIDE_DRAFT_API
588 * Returns unit of energy: foodcalorie.
589 * Caller owns returned value and must free it.
590 * @param status ICU error code.
593 static MeasureUnit
*createFoodcalorie(UErrorCode
&status
);
595 #endif /* U_HIDE_DRAFT_API */
596 #ifndef U_HIDE_DRAFT_API
598 * Returns unit of energy: joule.
599 * Caller owns returned value and must free it.
600 * @param status ICU error code.
603 static MeasureUnit
*createJoule(UErrorCode
&status
);
605 #endif /* U_HIDE_DRAFT_API */
606 #ifndef U_HIDE_DRAFT_API
608 * Returns unit of energy: kilocalorie.
609 * Caller owns returned value and must free it.
610 * @param status ICU error code.
613 static MeasureUnit
*createKilocalorie(UErrorCode
&status
);
615 #endif /* U_HIDE_DRAFT_API */
616 #ifndef U_HIDE_DRAFT_API
618 * Returns unit of energy: kilojoule.
619 * Caller owns returned value and must free it.
620 * @param status ICU error code.
623 static MeasureUnit
*createKilojoule(UErrorCode
&status
);
625 #endif /* U_HIDE_DRAFT_API */
626 #ifndef U_HIDE_DRAFT_API
628 * Returns unit of energy: kilowatt-hour.
629 * Caller owns returned value and must free it.
630 * @param status ICU error code.
633 static MeasureUnit
*createKilowattHour(UErrorCode
&status
);
635 #endif /* U_HIDE_DRAFT_API */
636 #ifndef U_HIDE_DRAFT_API
638 * Returns unit of frequency: gigahertz.
639 * Caller owns returned value and must free it.
640 * @param status ICU error code.
643 static MeasureUnit
*createGigahertz(UErrorCode
&status
);
645 #endif /* U_HIDE_DRAFT_API */
646 #ifndef U_HIDE_DRAFT_API
648 * Returns unit of frequency: hertz.
649 * Caller owns returned value and must free it.
650 * @param status ICU error code.
653 static MeasureUnit
*createHertz(UErrorCode
&status
);
655 #endif /* U_HIDE_DRAFT_API */
656 #ifndef U_HIDE_DRAFT_API
658 * Returns unit of frequency: kilohertz.
659 * Caller owns returned value and must free it.
660 * @param status ICU error code.
663 static MeasureUnit
*createKilohertz(UErrorCode
&status
);
665 #endif /* U_HIDE_DRAFT_API */
666 #ifndef U_HIDE_DRAFT_API
668 * Returns unit of frequency: megahertz.
669 * Caller owns returned value and must free it.
670 * @param status ICU error code.
673 static MeasureUnit
*createMegahertz(UErrorCode
&status
);
675 #endif /* U_HIDE_DRAFT_API */
676 #ifndef U_HIDE_DRAFT_API
678 * Returns unit of length: astronomical-unit.
679 * Caller owns returned value and must free it.
680 * @param status ICU error code.
683 static MeasureUnit
*createAstronomicalUnit(UErrorCode
&status
);
685 #endif /* U_HIDE_DRAFT_API */
687 * Returns unit of length: centimeter.
688 * Caller owns returned value and must free it.
689 * @param status ICU error code.
692 static MeasureUnit
*createCentimeter(UErrorCode
&status
);
694 #ifndef U_HIDE_DRAFT_API
696 * Returns unit of length: decimeter.
697 * Caller owns returned value and must free it.
698 * @param status ICU error code.
701 static MeasureUnit
*createDecimeter(UErrorCode
&status
);
703 #endif /* U_HIDE_DRAFT_API */
704 #ifndef U_HIDE_DRAFT_API
706 * Returns unit of length: fathom.
707 * Caller owns returned value and must free it.
708 * @param status ICU error code.
711 static MeasureUnit
*createFathom(UErrorCode
&status
);
713 #endif /* U_HIDE_DRAFT_API */
715 * Returns unit of length: foot.
716 * Caller owns returned value and must free it.
717 * @param status ICU error code.
720 static MeasureUnit
*createFoot(UErrorCode
&status
);
722 #ifndef U_HIDE_DRAFT_API
724 * Returns unit of length: furlong.
725 * Caller owns returned value and must free it.
726 * @param status ICU error code.
729 static MeasureUnit
*createFurlong(UErrorCode
&status
);
731 #endif /* U_HIDE_DRAFT_API */
733 * Returns unit of length: inch.
734 * Caller owns returned value and must free it.
735 * @param status ICU error code.
738 static MeasureUnit
*createInch(UErrorCode
&status
);
741 * Returns unit of length: kilometer.
742 * Caller owns returned value and must free it.
743 * @param status ICU error code.
746 static MeasureUnit
*createKilometer(UErrorCode
&status
);
749 * Returns unit of length: light-year.
750 * Caller owns returned value and must free it.
751 * @param status ICU error code.
754 static MeasureUnit
*createLightYear(UErrorCode
&status
);
757 * Returns unit of length: meter.
758 * Caller owns returned value and must free it.
759 * @param status ICU error code.
762 static MeasureUnit
*createMeter(UErrorCode
&status
);
764 #ifndef U_HIDE_DRAFT_API
766 * Returns unit of length: micrometer.
767 * Caller owns returned value and must free it.
768 * @param status ICU error code.
771 static MeasureUnit
*createMicrometer(UErrorCode
&status
);
773 #endif /* U_HIDE_DRAFT_API */
775 * Returns unit of length: mile.
776 * Caller owns returned value and must free it.
777 * @param status ICU error code.
780 static MeasureUnit
*createMile(UErrorCode
&status
);
783 * Returns unit of length: millimeter.
784 * Caller owns returned value and must free it.
785 * @param status ICU error code.
788 static MeasureUnit
*createMillimeter(UErrorCode
&status
);
790 #ifndef U_HIDE_DRAFT_API
792 * Returns unit of length: nanometer.
793 * Caller owns returned value and must free it.
794 * @param status ICU error code.
797 static MeasureUnit
*createNanometer(UErrorCode
&status
);
799 #endif /* U_HIDE_DRAFT_API */
800 #ifndef U_HIDE_DRAFT_API
802 * Returns unit of length: nautical-mile.
803 * Caller owns returned value and must free it.
804 * @param status ICU error code.
807 static MeasureUnit
*createNauticalMile(UErrorCode
&status
);
809 #endif /* U_HIDE_DRAFT_API */
810 #ifndef U_HIDE_DRAFT_API
812 * Returns unit of length: parsec.
813 * Caller owns returned value and must free it.
814 * @param status ICU error code.
817 static MeasureUnit
*createParsec(UErrorCode
&status
);
819 #endif /* U_HIDE_DRAFT_API */
821 * Returns unit of length: picometer.
822 * Caller owns returned value and must free it.
823 * @param status ICU error code.
826 static MeasureUnit
*createPicometer(UErrorCode
&status
);
829 * Returns unit of length: yard.
830 * Caller owns returned value and must free it.
831 * @param status ICU error code.
834 static MeasureUnit
*createYard(UErrorCode
&status
);
836 #ifndef U_HIDE_DRAFT_API
838 * Returns unit of light: lux.
839 * Caller owns returned value and must free it.
840 * @param status ICU error code.
843 static MeasureUnit
*createLux(UErrorCode
&status
);
845 #endif /* U_HIDE_DRAFT_API */
846 #ifndef U_HIDE_DRAFT_API
848 * Returns unit of mass: carat.
849 * Caller owns returned value and must free it.
850 * @param status ICU error code.
853 static MeasureUnit
*createCarat(UErrorCode
&status
);
855 #endif /* U_HIDE_DRAFT_API */
857 * Returns unit of mass: gram.
858 * Caller owns returned value and must free it.
859 * @param status ICU error code.
862 static MeasureUnit
*createGram(UErrorCode
&status
);
865 * Returns unit of mass: kilogram.
866 * Caller owns returned value and must free it.
867 * @param status ICU error code.
870 static MeasureUnit
*createKilogram(UErrorCode
&status
);
872 #ifndef U_HIDE_DRAFT_API
874 * Returns unit of mass: metric-ton.
875 * Caller owns returned value and must free it.
876 * @param status ICU error code.
879 static MeasureUnit
*createMetricTon(UErrorCode
&status
);
881 #endif /* U_HIDE_DRAFT_API */
882 #ifndef U_HIDE_DRAFT_API
884 * Returns unit of mass: microgram.
885 * Caller owns returned value and must free it.
886 * @param status ICU error code.
889 static MeasureUnit
*createMicrogram(UErrorCode
&status
);
891 #endif /* U_HIDE_DRAFT_API */
892 #ifndef U_HIDE_DRAFT_API
894 * Returns unit of mass: milligram.
895 * Caller owns returned value and must free it.
896 * @param status ICU error code.
899 static MeasureUnit
*createMilligram(UErrorCode
&status
);
901 #endif /* U_HIDE_DRAFT_API */
903 * Returns unit of mass: ounce.
904 * Caller owns returned value and must free it.
905 * @param status ICU error code.
908 static MeasureUnit
*createOunce(UErrorCode
&status
);
910 #ifndef U_HIDE_DRAFT_API
912 * Returns unit of mass: ounce-troy.
913 * Caller owns returned value and must free it.
914 * @param status ICU error code.
917 static MeasureUnit
*createOunceTroy(UErrorCode
&status
);
919 #endif /* U_HIDE_DRAFT_API */
921 * Returns unit of mass: pound.
922 * Caller owns returned value and must free it.
923 * @param status ICU error code.
926 static MeasureUnit
*createPound(UErrorCode
&status
);
928 #ifndef U_HIDE_DRAFT_API
930 * Returns unit of mass: stone.
931 * Caller owns returned value and must free it.
932 * @param status ICU error code.
935 static MeasureUnit
*createStone(UErrorCode
&status
);
937 #endif /* U_HIDE_DRAFT_API */
938 #ifndef U_HIDE_DRAFT_API
940 * Returns unit of mass: ton.
941 * Caller owns returned value and must free it.
942 * @param status ICU error code.
945 static MeasureUnit
*createTon(UErrorCode
&status
);
947 #endif /* U_HIDE_DRAFT_API */
948 #ifndef U_HIDE_DRAFT_API
950 * Returns unit of power: gigawatt.
951 * Caller owns returned value and must free it.
952 * @param status ICU error code.
955 static MeasureUnit
*createGigawatt(UErrorCode
&status
);
957 #endif /* U_HIDE_DRAFT_API */
959 * Returns unit of power: horsepower.
960 * Caller owns returned value and must free it.
961 * @param status ICU error code.
964 static MeasureUnit
*createHorsepower(UErrorCode
&status
);
967 * Returns unit of power: kilowatt.
968 * Caller owns returned value and must free it.
969 * @param status ICU error code.
972 static MeasureUnit
*createKilowatt(UErrorCode
&status
);
974 #ifndef U_HIDE_DRAFT_API
976 * Returns unit of power: megawatt.
977 * Caller owns returned value and must free it.
978 * @param status ICU error code.
981 static MeasureUnit
*createMegawatt(UErrorCode
&status
);
983 #endif /* U_HIDE_DRAFT_API */
984 #ifndef U_HIDE_DRAFT_API
986 * Returns unit of power: milliwatt.
987 * Caller owns returned value and must free it.
988 * @param status ICU error code.
991 static MeasureUnit
*createMilliwatt(UErrorCode
&status
);
993 #endif /* U_HIDE_DRAFT_API */
995 * Returns unit of power: watt.
996 * Caller owns returned value and must free it.
997 * @param status ICU error code.
1000 static MeasureUnit
*createWatt(UErrorCode
&status
);
1003 * Returns unit of pressure: hectopascal.
1004 * Caller owns returned value and must free it.
1005 * @param status ICU error code.
1008 static MeasureUnit
*createHectopascal(UErrorCode
&status
);
1011 * Returns unit of pressure: inch-hg.
1012 * Caller owns returned value and must free it.
1013 * @param status ICU error code.
1016 static MeasureUnit
*createInchHg(UErrorCode
&status
);
1019 * Returns unit of pressure: millibar.
1020 * Caller owns returned value and must free it.
1021 * @param status ICU error code.
1024 static MeasureUnit
*createMillibar(UErrorCode
&status
);
1026 #ifndef U_HIDE_DRAFT_API
1028 * Returns unit of pressure: millimeter-of-mercury.
1029 * Caller owns returned value and must free it.
1030 * @param status ICU error code.
1033 static MeasureUnit
*createMillimeterOfMercury(UErrorCode
&status
);
1035 #endif /* U_HIDE_DRAFT_API */
1036 #ifndef U_HIDE_DRAFT_API
1038 * Returns unit of pressure: pound-per-square-inch.
1039 * Caller owns returned value and must free it.
1040 * @param status ICU error code.
1043 static MeasureUnit
*createPoundPerSquareInch(UErrorCode
&status
);
1045 #endif /* U_HIDE_DRAFT_API */
1046 #ifndef U_HIDE_DRAFT_API
1048 * Returns unit of proportion: karat.
1049 * Caller owns returned value and must free it.
1050 * @param status ICU error code.
1053 static MeasureUnit
*createKarat(UErrorCode
&status
);
1055 #endif /* U_HIDE_DRAFT_API */
1057 * Returns unit of speed: kilometer-per-hour.
1058 * Caller owns returned value and must free it.
1059 * @param status ICU error code.
1062 static MeasureUnit
*createKilometerPerHour(UErrorCode
&status
);
1065 * Returns unit of speed: meter-per-second.
1066 * Caller owns returned value and must free it.
1067 * @param status ICU error code.
1070 static MeasureUnit
*createMeterPerSecond(UErrorCode
&status
);
1073 * Returns unit of speed: mile-per-hour.
1074 * Caller owns returned value and must free it.
1075 * @param status ICU error code.
1078 static MeasureUnit
*createMilePerHour(UErrorCode
&status
);
1081 * Returns unit of temperature: celsius.
1082 * Caller owns returned value and must free it.
1083 * @param status ICU error code.
1086 static MeasureUnit
*createCelsius(UErrorCode
&status
);
1089 * Returns unit of temperature: fahrenheit.
1090 * Caller owns returned value and must free it.
1091 * @param status ICU error code.
1094 static MeasureUnit
*createFahrenheit(UErrorCode
&status
);
1096 #ifndef U_HIDE_DRAFT_API
1098 * Returns unit of temperature: kelvin.
1099 * Caller owns returned value and must free it.
1100 * @param status ICU error code.
1103 static MeasureUnit
*createKelvin(UErrorCode
&status
);
1105 #endif /* U_HIDE_DRAFT_API */
1106 #ifndef U_HIDE_DRAFT_API
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.
1114 static MeasureUnit
*createGenericTemperature(UErrorCode
&status
);
1116 #endif /* U_HIDE_DRAFT_API */
1117 #ifndef U_HIDE_DRAFT_API
1119 * Returns unit of volume: acre-foot.
1120 * Caller owns returned value and must free it.
1121 * @param status ICU error code.
1124 static MeasureUnit
*createAcreFoot(UErrorCode
&status
);
1126 #endif /* U_HIDE_DRAFT_API */
1127 #ifndef U_HIDE_DRAFT_API
1129 * Returns unit of volume: bushel.
1130 * Caller owns returned value and must free it.
1131 * @param status ICU error code.
1134 static MeasureUnit
*createBushel(UErrorCode
&status
);
1136 #endif /* U_HIDE_DRAFT_API */
1137 #ifndef U_HIDE_DRAFT_API
1139 * Returns unit of volume: centiliter.
1140 * Caller owns returned value and must free it.
1141 * @param status ICU error code.
1144 static MeasureUnit
*createCentiliter(UErrorCode
&status
);
1146 #endif /* U_HIDE_DRAFT_API */
1147 #ifndef U_HIDE_DRAFT_API
1149 * Returns unit of volume: cubic-centimeter.
1150 * Caller owns returned value and must free it.
1151 * @param status ICU error code.
1154 static MeasureUnit
*createCubicCentimeter(UErrorCode
&status
);
1156 #endif /* U_HIDE_DRAFT_API */
1157 #ifndef U_HIDE_DRAFT_API
1159 * Returns unit of volume: cubic-foot.
1160 * Caller owns returned value and must free it.
1161 * @param status ICU error code.
1164 static MeasureUnit
*createCubicFoot(UErrorCode
&status
);
1166 #endif /* U_HIDE_DRAFT_API */
1167 #ifndef U_HIDE_DRAFT_API
1169 * Returns unit of volume: cubic-inch.
1170 * Caller owns returned value and must free it.
1171 * @param status ICU error code.
1174 static MeasureUnit
*createCubicInch(UErrorCode
&status
);
1176 #endif /* U_HIDE_DRAFT_API */
1178 * Returns unit of volume: cubic-kilometer.
1179 * Caller owns returned value and must free it.
1180 * @param status ICU error code.
1183 static MeasureUnit
*createCubicKilometer(UErrorCode
&status
);
1185 #ifndef U_HIDE_DRAFT_API
1187 * Returns unit of volume: cubic-meter.
1188 * Caller owns returned value and must free it.
1189 * @param status ICU error code.
1192 static MeasureUnit
*createCubicMeter(UErrorCode
&status
);
1194 #endif /* U_HIDE_DRAFT_API */
1196 * Returns unit of volume: cubic-mile.
1197 * Caller owns returned value and must free it.
1198 * @param status ICU error code.
1201 static MeasureUnit
*createCubicMile(UErrorCode
&status
);
1203 #ifndef U_HIDE_DRAFT_API
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
);
1212 #endif /* U_HIDE_DRAFT_API */
1213 #ifndef U_HIDE_DRAFT_API
1215 * Returns unit of volume: cup.
1216 * Caller owns returned value and must free it.
1217 * @param status ICU error code.
1220 static MeasureUnit
*createCup(UErrorCode
&status
);
1222 #endif /* U_HIDE_DRAFT_API */
1223 #ifndef U_HIDE_DRAFT_API
1225 * Returns unit of volume: deciliter.
1226 * Caller owns returned value and must free it.
1227 * @param status ICU error code.
1230 static MeasureUnit
*createDeciliter(UErrorCode
&status
);
1232 #endif /* U_HIDE_DRAFT_API */
1233 #ifndef U_HIDE_DRAFT_API
1235 * Returns unit of volume: fluid-ounce.
1236 * Caller owns returned value and must free it.
1237 * @param status ICU error code.
1240 static MeasureUnit
*createFluidOunce(UErrorCode
&status
);
1242 #endif /* U_HIDE_DRAFT_API */
1243 #ifndef U_HIDE_DRAFT_API
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 #endif /* U_HIDE_DRAFT_API */
1253 #ifndef U_HIDE_DRAFT_API
1255 * Returns unit of volume: hectoliter.
1256 * Caller owns returned value and must free it.
1257 * @param status ICU error code.
1260 static MeasureUnit
*createHectoliter(UErrorCode
&status
);
1262 #endif /* U_HIDE_DRAFT_API */
1264 * Returns unit of volume: liter.
1265 * Caller owns returned value and must free it.
1266 * @param status ICU error code.
1269 static MeasureUnit
*createLiter(UErrorCode
&status
);
1271 #ifndef U_HIDE_DRAFT_API
1273 * Returns unit of volume: megaliter.
1274 * Caller owns returned value and must free it.
1275 * @param status ICU error code.
1278 static MeasureUnit
*createMegaliter(UErrorCode
&status
);
1280 #endif /* U_HIDE_DRAFT_API */
1281 #ifndef U_HIDE_DRAFT_API
1283 * Returns unit of volume: milliliter.
1284 * Caller owns returned value and must free it.
1285 * @param status ICU error code.
1288 static MeasureUnit
*createMilliliter(UErrorCode
&status
);
1290 #endif /* U_HIDE_DRAFT_API */
1291 #ifndef U_HIDE_DRAFT_API
1293 * Returns unit of volume: pint.
1294 * Caller owns returned value and must free it.
1295 * @param status ICU error code.
1298 static MeasureUnit
*createPint(UErrorCode
&status
);
1300 #endif /* U_HIDE_DRAFT_API */
1301 #ifndef U_HIDE_DRAFT_API
1303 * Returns unit of volume: quart.
1304 * Caller owns returned value and must free it.
1305 * @param status ICU error code.
1308 static MeasureUnit
*createQuart(UErrorCode
&status
);
1310 #endif /* U_HIDE_DRAFT_API */
1311 #ifndef U_HIDE_DRAFT_API
1313 * Returns unit of volume: tablespoon.
1314 * Caller owns returned value and must free it.
1315 * @param status ICU error code.
1318 static MeasureUnit
*createTablespoon(UErrorCode
&status
);
1320 #endif /* U_HIDE_DRAFT_API */
1321 #ifndef U_HIDE_DRAFT_API
1323 * Returns unit of volume: teaspoon.
1324 * Caller owns returned value and must free it.
1325 * @param status ICU error code.
1328 static MeasureUnit
*createTeaspoon(UErrorCode
&status
);
1330 #endif /* U_HIDE_DRAFT_API */
1332 // End generated createXXX methods
1336 #ifndef U_HIDE_INTERNAL_API
1341 void initTime(const char *timeId
);
1347 void initCurrency(const char *isoCurrency
);
1349 #endif /* U_HIDE_INTERNAL_API */
1356 MeasureUnit(int32_t typeId
, int32_t subTypeId
) : fTypeId(typeId
), fSubTypeId(subTypeId
) {
1359 void setTo(int32_t typeId
, int32_t subTypeId
);
1360 int32_t getOffset() const;
1361 static MeasureUnit
*create(int typeId
, int subTypeId
, UErrorCode
&status
);
1366 #endif // !UNCONFIG_NO_FORMATTING
1367 #endif // __MEASUREUNIT_H__