ICU 67.1 67.1

measunit.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 **********************************************************************
5 * Copyright (c) 2004-2016, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
8 * Author: Alan Liu
9 * Created: April 26, 2004
10 * Since: ICU 3.0
11 **********************************************************************
12 */
13 #ifndef __MEASUREUNIT_H__
14 #define __MEASUREUNIT_H__
15
16 #include "unicode/utypes.h"
17
18 #if U_SHOW_CPLUSPLUS_API
19
20 #if !UCONFIG_NO_FORMATTING
21
22 #include "unicode/unistr.h"
23 #include "unicode/localpointer.h"
24
30 U_NAMESPACE_BEGIN
31
32 class StringEnumeration;
33 struct MeasureUnitImpl;
34
35 #ifndef U_HIDE_DRAFT_API
36
51 enum UMeasureUnitComplexity {
57 UMEASURE_UNIT_SINGLE,
58
64 UMEASURE_UNIT_COMPOUND,
65
71 UMEASURE_UNIT_MIXED
72 };
73
79 typedef enum UMeasureSIPrefix {
80
86 UMEASURE_SI_PREFIX_YOTTA = 24,
87
93 UMEASURE_SI_PREFIX_ZETTA = 21,
94
100 UMEASURE_SI_PREFIX_EXA = 18,
101
107 UMEASURE_SI_PREFIX_PETA = 15,
108
114 UMEASURE_SI_PREFIX_TERA = 12,
115
121 UMEASURE_SI_PREFIX_GIGA = 9,
122
128 UMEASURE_SI_PREFIX_MEGA = 6,
129
135 UMEASURE_SI_PREFIX_KILO = 3,
136
142 UMEASURE_SI_PREFIX_HECTO = 2,
143
149 UMEASURE_SI_PREFIX_DEKA = 1,
150
156 UMEASURE_SI_PREFIX_ONE = 0,
157
163 UMEASURE_SI_PREFIX_DECI = -1,
164
170 UMEASURE_SI_PREFIX_CENTI = -2,
171
177 UMEASURE_SI_PREFIX_MILLI = -3,
178
184 UMEASURE_SI_PREFIX_MICRO = -6,
185
191 UMEASURE_SI_PREFIX_NANO = -9,
192
198 UMEASURE_SI_PREFIX_PICO = -12,
199
205 UMEASURE_SI_PREFIX_FEMTO = -15,
206
212 UMEASURE_SI_PREFIX_ATTO = -18,
213
219 UMEASURE_SI_PREFIX_ZEPTO = -21,
220
226 UMEASURE_SI_PREFIX_YOCTO = -24
227 } UMeasureSIPrefix;
228 #endif // U_HIDE_DRAFT_API
229
237 class U_I18N_API MeasureUnit: public UObject {
238 public:
239
245 MeasureUnit();
246
251 MeasureUnit(const MeasureUnit &other);
252
253 #ifndef U_HIDE_DRAFT_API
254
258 MeasureUnit(MeasureUnit &&other) noexcept;
259
272 static MeasureUnit forIdentifier(StringPiece identifier, UErrorCode& status);
273 #endif // U_HIDE_DRAFT_API
274
279 MeasureUnit &operator=(const MeasureUnit &other);
280
281 #ifndef U_HIDE_DRAFT_API
282
286 MeasureUnit &operator=(MeasureUnit &&other) noexcept;
287 #endif // U_HIDE_DRAFT_API
288
294 virtual MeasureUnit* clone() const;
295
300 virtual ~MeasureUnit();
301
307 virtual UBool operator==(const UObject& other) const;
308
314 UBool operator!=(const UObject& other) const {
315 return !(*this == other);
316 }
317
325 const char *getType() const;
326
334 const char *getSubtype() const;
335
336 #ifndef U_HIDE_DRAFT_API
337
343 const char* getIdentifier() const;
344
352 UMeasureUnitComplexity getComplexity(UErrorCode& status) const;
353
368 MeasureUnit withSIPrefix(UMeasureSIPrefix prefix, UErrorCode& status) const;
369
381 UMeasureSIPrefix getSIPrefix(UErrorCode& status) const;
382
397 MeasureUnit withDimensionality(int32_t dimensionality, UErrorCode& status) const;
398
412 int32_t getDimensionality(UErrorCode& status) const;
413
426 MeasureUnit reciprocal(UErrorCode& status) const;
427
445 MeasureUnit product(const MeasureUnit& other, UErrorCode& status) const;
446 #endif // U_HIDE_DRAFT_API
447
448 #ifndef U_HIDE_INTERNAL_API
449
467 LocalArray<MeasureUnit> splitToSingleUnits(int32_t& outCount, UErrorCode& status) const;
468 #endif // U_HIDE_INTERNAL_API
469
481 static int32_t getAvailable(
482 MeasureUnit *destArray,
483 int32_t destCapacity,
484 UErrorCode &errorCode);
485
498 static int32_t getAvailable(
499 const char *type,
500 MeasureUnit *destArray,
501 int32_t destCapacity,
502 UErrorCode &errorCode);
503
512 static StringEnumeration* getAvailableTypes(UErrorCode &errorCode);
513
525 static UClassID U_EXPORT2 getStaticClassID(void);
526
538 virtual UClassID getDynamicClassID(void) const;
539
540 #ifndef U_HIDE_INTERNAL_API
541
547 int32_t getIndex() const;
548
554 static int32_t getIndexCount();
555
562 static int32_t internalGetIndexForTypeAndSubtype(const char *type, const char *subtype);
563
568 static MeasureUnit resolveUnitPerUnit(
569 const MeasureUnit &unit, const MeasureUnit &perUnit, bool* isResolved);
570 #endif /* U_HIDE_INTERNAL_API */
571
572 // All code between the "Start generated createXXX methods" comment and
573 // the "End generated createXXX methods" comment is auto generated code
574 // and must not be edited manually. For instructions on how to correctly
575 // update this code, refer to:
576 // http://site.icu-project.org/design/formatting/measureformat/updating-measure-unit
577 //
578 // Start generated createXXX methods
579
587 static MeasureUnit *createGForce(UErrorCode &status);
588
594 static MeasureUnit getGForce();
595
603 static MeasureUnit *createMeterPerSecondSquared(UErrorCode &status);
604
610 static MeasureUnit getMeterPerSecondSquared();
611
619 static MeasureUnit *createArcMinute(UErrorCode &status);
620
626 static MeasureUnit getArcMinute();
627
635 static MeasureUnit *createArcSecond(UErrorCode &status);
636
642 static MeasureUnit getArcSecond();
643
651 static MeasureUnit *createDegree(UErrorCode &status);
652
658 static MeasureUnit getDegree();
659
667 static MeasureUnit *createRadian(UErrorCode &status);
668
674 static MeasureUnit getRadian();
675
683 static MeasureUnit *createRevolutionAngle(UErrorCode &status);
684
690 static MeasureUnit getRevolutionAngle();
691
699 static MeasureUnit *createAcre(UErrorCode &status);
700
706 static MeasureUnit getAcre();
707
715 static MeasureUnit *createDunam(UErrorCode &status);
716
722 static MeasureUnit getDunam();
723
731 static MeasureUnit *createHectare(UErrorCode &status);
732
738 static MeasureUnit getHectare();
739
747 static MeasureUnit *createSquareCentimeter(UErrorCode &status);
748
754 static MeasureUnit getSquareCentimeter();
755
763 static MeasureUnit *createSquareFoot(UErrorCode &status);
764
770 static MeasureUnit getSquareFoot();
771
779 static MeasureUnit *createSquareInch(UErrorCode &status);
780
786 static MeasureUnit getSquareInch();
787
795 static MeasureUnit *createSquareKilometer(UErrorCode &status);
796
802 static MeasureUnit getSquareKilometer();
803
811 static MeasureUnit *createSquareMeter(UErrorCode &status);
812
818 static MeasureUnit getSquareMeter();
819
827 static MeasureUnit *createSquareMile(UErrorCode &status);
828
834 static MeasureUnit getSquareMile();
835
843 static MeasureUnit *createSquareYard(UErrorCode &status);
844
850 static MeasureUnit getSquareYard();
851
859 static MeasureUnit *createKarat(UErrorCode &status);
860
866 static MeasureUnit getKarat();
867
875 static MeasureUnit *createMilligramPerDeciliter(UErrorCode &status);
876
882 static MeasureUnit getMilligramPerDeciliter();
883
891 static MeasureUnit *createMillimolePerLiter(UErrorCode &status);
892
898 static MeasureUnit getMillimolePerLiter();
899
907 static MeasureUnit *createMole(UErrorCode &status);
908
914 static MeasureUnit getMole();
915
923 static MeasureUnit *createPartPerMillion(UErrorCode &status);
924
930 static MeasureUnit getPartPerMillion();
931
939 static MeasureUnit *createPercent(UErrorCode &status);
940
946 static MeasureUnit getPercent();
947
955 static MeasureUnit *createPermille(UErrorCode &status);
956
962 static MeasureUnit getPermille();
963
971 static MeasureUnit *createPermyriad(UErrorCode &status);
972
978 static MeasureUnit getPermyriad();
979
987 static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status);
988
994 static MeasureUnit getLiterPer100Kilometers();
995
1003 static MeasureUnit *createLiterPerKilometer(UErrorCode &status);
1004
1010 static MeasureUnit getLiterPerKilometer();
1011
1019 static MeasureUnit *createMilePerGallon(UErrorCode &status);
1020
1026 static MeasureUnit getMilePerGallon();
1027
1035 static MeasureUnit *createMilePerGallonImperial(UErrorCode &status);
1036
1042 static MeasureUnit getMilePerGallonImperial();
1043
1051 static MeasureUnit *createBit(UErrorCode &status);
1052
1058 static MeasureUnit getBit();
1059
1067 static MeasureUnit *createByte(UErrorCode &status);
1068
1074 static MeasureUnit getByte();
1075
1083 static MeasureUnit *createGigabit(UErrorCode &status);
1084
1090 static MeasureUnit getGigabit();
1091
1099 static MeasureUnit *createGigabyte(UErrorCode &status);
1100
1106 static MeasureUnit getGigabyte();
1107
1115 static MeasureUnit *createKilobit(UErrorCode &status);
1116
1122 static MeasureUnit getKilobit();
1123
1131 static MeasureUnit *createKilobyte(UErrorCode &status);
1132
1138 static MeasureUnit getKilobyte();
1139
1147 static MeasureUnit *createMegabit(UErrorCode &status);
1148
1154 static MeasureUnit getMegabit();
1155
1163 static MeasureUnit *createMegabyte(UErrorCode &status);
1164
1170 static MeasureUnit getMegabyte();
1171
1179 static MeasureUnit *createPetabyte(UErrorCode &status);
1180
1186 static MeasureUnit getPetabyte();
1187
1195 static MeasureUnit *createTerabit(UErrorCode &status);
1196
1202 static MeasureUnit getTerabit();
1203
1211 static MeasureUnit *createTerabyte(UErrorCode &status);
1212
1218 static MeasureUnit getTerabyte();
1219
1227 static MeasureUnit *createCentury(UErrorCode &status);
1228
1234 static MeasureUnit getCentury();
1235
1243 static MeasureUnit *createDay(UErrorCode &status);
1244
1250 static MeasureUnit getDay();
1251
1259 static MeasureUnit *createDayPerson(UErrorCode &status);
1260
1266 static MeasureUnit getDayPerson();
1267
1268 #ifndef U_HIDE_DRAFT_API
1269
1276 static MeasureUnit *createDecade(UErrorCode &status);
1277
1283 static MeasureUnit getDecade();
1284 #endif /* U_HIDE_DRAFT_API */
1285
1293 static MeasureUnit *createHour(UErrorCode &status);
1294
1300 static MeasureUnit getHour();
1301
1309 static MeasureUnit *createMicrosecond(UErrorCode &status);
1310
1316 static MeasureUnit getMicrosecond();
1317
1325 static MeasureUnit *createMillisecond(UErrorCode &status);
1326
1332 static MeasureUnit getMillisecond();
1333
1341 static MeasureUnit *createMinute(UErrorCode &status);
1342
1348 static MeasureUnit getMinute();
1349
1357 static MeasureUnit *createMonth(UErrorCode &status);
1358
1364 static MeasureUnit getMonth();
1365
1373 static MeasureUnit *createMonthPerson(UErrorCode &status);
1374
1380 static MeasureUnit getMonthPerson();
1381
1389 static MeasureUnit *createNanosecond(UErrorCode &status);
1390
1396 static MeasureUnit getNanosecond();
1397
1405 static MeasureUnit *createSecond(UErrorCode &status);
1406
1412 static MeasureUnit getSecond();
1413
1421 static MeasureUnit *createWeek(UErrorCode &status);
1422
1428 static MeasureUnit getWeek();
1429
1437 static MeasureUnit *createWeekPerson(UErrorCode &status);
1438
1444 static MeasureUnit getWeekPerson();
1445
1453 static MeasureUnit *createYear(UErrorCode &status);
1454
1460 static MeasureUnit getYear();
1461
1469 static MeasureUnit *createYearPerson(UErrorCode &status);
1470
1476 static MeasureUnit getYearPerson();
1477
1485 static MeasureUnit *createAmpere(UErrorCode &status);
1486
1492 static MeasureUnit getAmpere();
1493
1501 static MeasureUnit *createMilliampere(UErrorCode &status);
1502
1508 static MeasureUnit getMilliampere();
1509
1517 static MeasureUnit *createOhm(UErrorCode &status);
1518
1524 static MeasureUnit getOhm();
1525
1533 static MeasureUnit *createVolt(UErrorCode &status);
1534
1540 static MeasureUnit getVolt();
1541
1549 static MeasureUnit *createBritishThermalUnit(UErrorCode &status);
1550
1556 static MeasureUnit getBritishThermalUnit();
1557
1565 static MeasureUnit *createCalorie(UErrorCode &status);
1566
1572 static MeasureUnit getCalorie();
1573
1581 static MeasureUnit *createElectronvolt(UErrorCode &status);
1582
1588 static MeasureUnit getElectronvolt();
1589
1597 static MeasureUnit *createFoodcalorie(UErrorCode &status);
1598
1604 static MeasureUnit getFoodcalorie();
1605
1613 static MeasureUnit *createJoule(UErrorCode &status);
1614
1620 static MeasureUnit getJoule();
1621
1629 static MeasureUnit *createKilocalorie(UErrorCode &status);
1630
1636 static MeasureUnit getKilocalorie();
1637
1645 static MeasureUnit *createKilojoule(UErrorCode &status);
1646
1652 static MeasureUnit getKilojoule();
1653
1661 static MeasureUnit *createKilowattHour(UErrorCode &status);
1662
1668 static MeasureUnit getKilowattHour();
1669
1670 #ifndef U_HIDE_DRAFT_API
1671
1678 static MeasureUnit *createThermUs(UErrorCode &status);
1679
1685 static MeasureUnit getThermUs();
1686 #endif /* U_HIDE_DRAFT_API */
1687
1695 static MeasureUnit *createNewton(UErrorCode &status);
1696
1702 static MeasureUnit getNewton();
1703
1711 static MeasureUnit *createPoundForce(UErrorCode &status);
1712
1718 static MeasureUnit getPoundForce();
1719
1727 static MeasureUnit *createGigahertz(UErrorCode &status);
1728
1734 static MeasureUnit getGigahertz();
1735
1743 static MeasureUnit *createHertz(UErrorCode &status);
1744
1750 static MeasureUnit getHertz();
1751
1759 static MeasureUnit *createKilohertz(UErrorCode &status);
1760
1766 static MeasureUnit getKilohertz();
1767
1775 static MeasureUnit *createMegahertz(UErrorCode &status);
1776
1782 static MeasureUnit getMegahertz();
1783
1784 #ifndef U_HIDE_DRAFT_API
1785
1792 static MeasureUnit *createDotPerCentimeter(UErrorCode &status);
1793
1799 static MeasureUnit getDotPerCentimeter();
1800 #endif /* U_HIDE_DRAFT_API */
1801
1802 #ifndef U_HIDE_DRAFT_API
1803
1810 static MeasureUnit *createDotPerInch(UErrorCode &status);
1811
1817 static MeasureUnit getDotPerInch();
1818 #endif /* U_HIDE_DRAFT_API */
1819
1820 #ifndef U_HIDE_DRAFT_API
1821
1828 static MeasureUnit *createEm(UErrorCode &status);
1829
1835 static MeasureUnit getEm();
1836 #endif /* U_HIDE_DRAFT_API */
1837
1838 #ifndef U_HIDE_DRAFT_API
1839
1846 static MeasureUnit *createMegapixel(UErrorCode &status);
1847
1853 static MeasureUnit getMegapixel();
1854 #endif /* U_HIDE_DRAFT_API */
1855
1856 #ifndef U_HIDE_DRAFT_API
1857
1864 static MeasureUnit *createPixel(UErrorCode &status);
1865
1871 static MeasureUnit getPixel();
1872 #endif /* U_HIDE_DRAFT_API */
1873
1874 #ifndef U_HIDE_DRAFT_API
1875
1882 static MeasureUnit *createPixelPerCentimeter(UErrorCode &status);
1883
1889 static MeasureUnit getPixelPerCentimeter();
1890 #endif /* U_HIDE_DRAFT_API */
1891
1892 #ifndef U_HIDE_DRAFT_API
1893
1900 static MeasureUnit *createPixelPerInch(UErrorCode &status);
1901
1907 static MeasureUnit getPixelPerInch();
1908 #endif /* U_HIDE_DRAFT_API */
1909
1917 static MeasureUnit *createAstronomicalUnit(UErrorCode &status);
1918
1924 static MeasureUnit getAstronomicalUnit();
1925
1933 static MeasureUnit *createCentimeter(UErrorCode &status);
1934
1940 static MeasureUnit getCentimeter();
1941
1949 static MeasureUnit *createDecimeter(UErrorCode &status);
1950
1956 static MeasureUnit getDecimeter();
1957
1965 static MeasureUnit *createFathom(UErrorCode &status);
1966
1972 static MeasureUnit getFathom();
1973
1981 static MeasureUnit *createFoot(UErrorCode &status);
1982
1988 static MeasureUnit getFoot();
1989
1997 static MeasureUnit *createFurlong(UErrorCode &status);
1998
2004 static MeasureUnit getFurlong();
2005
2013 static MeasureUnit *createInch(UErrorCode &status);
2014
2020 static MeasureUnit getInch();
2021
2029 static MeasureUnit *createKilometer(UErrorCode &status);
2030
2036 static MeasureUnit getKilometer();
2037
2045 static MeasureUnit *createLightYear(UErrorCode &status);
2046
2052 static MeasureUnit getLightYear();
2053
2061 static MeasureUnit *createMeter(UErrorCode &status);
2062
2068 static MeasureUnit getMeter();
2069
2077 static MeasureUnit *createMicrometer(UErrorCode &status);
2078
2084 static MeasureUnit getMicrometer();
2085
2093 static MeasureUnit *createMile(UErrorCode &status);
2094
2100 static MeasureUnit getMile();
2101
2109 static MeasureUnit *createMileScandinavian(UErrorCode &status);
2110
2116 static MeasureUnit getMileScandinavian();
2117
2125 static MeasureUnit *createMillimeter(UErrorCode &status);
2126
2132 static MeasureUnit getMillimeter();
2133
2141 static MeasureUnit *createNanometer(UErrorCode &status);
2142
2148 static MeasureUnit getNanometer();
2149
2157 static MeasureUnit *createNauticalMile(UErrorCode &status);
2158
2164 static MeasureUnit getNauticalMile();
2165
2173 static MeasureUnit *createParsec(UErrorCode &status);
2174
2180 static MeasureUnit getParsec();
2181
2189 static MeasureUnit *createPicometer(UErrorCode &status);
2190
2196 static MeasureUnit getPicometer();
2197
2205 static MeasureUnit *createPoint(UErrorCode &status);
2206
2212 static MeasureUnit getPoint();
2213
2221 static MeasureUnit *createSolarRadius(UErrorCode &status);
2222
2228 static MeasureUnit getSolarRadius();
2229
2237 static MeasureUnit *createYard(UErrorCode &status);
2238
2244 static MeasureUnit getYard();
2245
2253 static MeasureUnit *createLux(UErrorCode &status);
2254
2260 static MeasureUnit getLux();
2261
2269 static MeasureUnit *createSolarLuminosity(UErrorCode &status);
2270
2276 static MeasureUnit getSolarLuminosity();
2277
2285 static MeasureUnit *createCarat(UErrorCode &status);
2286
2292 static MeasureUnit getCarat();
2293
2301 static MeasureUnit *createDalton(UErrorCode &status);
2302
2308 static MeasureUnit getDalton();
2309
2317 static MeasureUnit *createEarthMass(UErrorCode &status);
2318
2324 static MeasureUnit getEarthMass();
2325
2333 static MeasureUnit *createGram(UErrorCode &status);
2334
2340 static MeasureUnit getGram();
2341
2349 static MeasureUnit *createKilogram(UErrorCode &status);
2350
2356 static MeasureUnit getKilogram();
2357
2365 static MeasureUnit *createMetricTon(UErrorCode &status);
2366
2372 static MeasureUnit getMetricTon();
2373
2381 static MeasureUnit *createMicrogram(UErrorCode &status);
2382
2388 static MeasureUnit getMicrogram();
2389
2397 static MeasureUnit *createMilligram(UErrorCode &status);
2398
2404 static MeasureUnit getMilligram();
2405
2413 static MeasureUnit *createOunce(UErrorCode &status);
2414
2420 static MeasureUnit getOunce();
2421
2429 static MeasureUnit *createOunceTroy(UErrorCode &status);
2430
2436 static MeasureUnit getOunceTroy();
2437
2445 static MeasureUnit *createPound(UErrorCode &status);
2446
2452 static MeasureUnit getPound();
2453
2461 static MeasureUnit *createSolarMass(UErrorCode &status);
2462
2468 static MeasureUnit getSolarMass();
2469
2477 static MeasureUnit *createStone(UErrorCode &status);
2478
2484 static MeasureUnit getStone();
2485
2493 static MeasureUnit *createTon(UErrorCode &status);
2494
2500 static MeasureUnit getTon();
2501
2509 static MeasureUnit *createGigawatt(UErrorCode &status);
2510
2516 static MeasureUnit getGigawatt();
2517
2525 static MeasureUnit *createHorsepower(UErrorCode &status);
2526
2532 static MeasureUnit getHorsepower();
2533
2541 static MeasureUnit *createKilowatt(UErrorCode &status);
2542
2548 static MeasureUnit getKilowatt();
2549
2557 static MeasureUnit *createMegawatt(UErrorCode &status);
2558
2564 static MeasureUnit getMegawatt();
2565
2573 static MeasureUnit *createMilliwatt(UErrorCode &status);
2574
2580 static MeasureUnit getMilliwatt();
2581
2589 static MeasureUnit *createWatt(UErrorCode &status);
2590
2596 static MeasureUnit getWatt();
2597
2605 static MeasureUnit *createAtmosphere(UErrorCode &status);
2606
2612 static MeasureUnit getAtmosphere();
2613
2614 #ifndef U_HIDE_DRAFT_API
2615
2622 static MeasureUnit *createBar(UErrorCode &status);
2623
2629 static MeasureUnit getBar();
2630 #endif /* U_HIDE_DRAFT_API */
2631
2639 static MeasureUnit *createHectopascal(UErrorCode &status);
2640
2646 static MeasureUnit getHectopascal();
2647
2655 static MeasureUnit *createInchHg(UErrorCode &status);
2656
2662 static MeasureUnit getInchHg();
2663
2671 static MeasureUnit *createKilopascal(UErrorCode &status);
2672
2678 static MeasureUnit getKilopascal();
2679
2687 static MeasureUnit *createMegapascal(UErrorCode &status);
2688
2694 static MeasureUnit getMegapascal();
2695
2703 static MeasureUnit *createMillibar(UErrorCode &status);
2704
2710 static MeasureUnit getMillibar();
2711
2719 static MeasureUnit *createMillimeterOfMercury(UErrorCode &status);
2720
2726 static MeasureUnit getMillimeterOfMercury();
2727
2728 #ifndef U_HIDE_DRAFT_API
2729
2736 static MeasureUnit *createPascal(UErrorCode &status);
2737
2743 static MeasureUnit getPascal();
2744 #endif /* U_HIDE_DRAFT_API */
2745
2753 static MeasureUnit *createPoundPerSquareInch(UErrorCode &status);
2754
2760 static MeasureUnit getPoundPerSquareInch();
2761
2769 static MeasureUnit *createKilometerPerHour(UErrorCode &status);
2770
2776 static MeasureUnit getKilometerPerHour();
2777
2785 static MeasureUnit *createKnot(UErrorCode &status);
2786
2792 static MeasureUnit getKnot();
2793
2801 static MeasureUnit *createMeterPerSecond(UErrorCode &status);
2802
2808 static MeasureUnit getMeterPerSecond();
2809
2817 static MeasureUnit *createMilePerHour(UErrorCode &status);
2818
2824 static MeasureUnit getMilePerHour();
2825
2833 static MeasureUnit *createCelsius(UErrorCode &status);
2834
2840 static MeasureUnit getCelsius();
2841
2849 static MeasureUnit *createFahrenheit(UErrorCode &status);
2850
2856 static MeasureUnit getFahrenheit();
2857
2865 static MeasureUnit *createGenericTemperature(UErrorCode &status);
2866
2872 static MeasureUnit getGenericTemperature();
2873
2881 static MeasureUnit *createKelvin(UErrorCode &status);
2882
2888 static MeasureUnit getKelvin();
2889
2897 static MeasureUnit *createNewtonMeter(UErrorCode &status);
2898
2904 static MeasureUnit getNewtonMeter();
2905
2913 static MeasureUnit *createPoundFoot(UErrorCode &status);
2914
2920 static MeasureUnit getPoundFoot();
2921
2929 static MeasureUnit *createAcreFoot(UErrorCode &status);
2930
2936 static MeasureUnit getAcreFoot();
2937
2945 static MeasureUnit *createBarrel(UErrorCode &status);
2946
2952 static MeasureUnit getBarrel();
2953
2961 static MeasureUnit *createBushel(UErrorCode &status);
2962
2968 static MeasureUnit getBushel();
2969
2977 static MeasureUnit *createCentiliter(UErrorCode &status);
2978
2984 static MeasureUnit getCentiliter();
2985
2993 static MeasureUnit *createCubicCentimeter(UErrorCode &status);
2994
3000 static MeasureUnit getCubicCentimeter();
3001
3009 static MeasureUnit *createCubicFoot(UErrorCode &status);
3010
3016 static MeasureUnit getCubicFoot();
3017
3025 static MeasureUnit *createCubicInch(UErrorCode &status);
3026
3032 static MeasureUnit getCubicInch();
3033
3041 static MeasureUnit *createCubicKilometer(UErrorCode &status);
3042
3048 static MeasureUnit getCubicKilometer();
3049
3057 static MeasureUnit *createCubicMeter(UErrorCode &status);
3058
3064 static MeasureUnit getCubicMeter();
3065
3073 static MeasureUnit *createCubicMile(UErrorCode &status);
3074
3080 static MeasureUnit getCubicMile();
3081
3089 static MeasureUnit *createCubicYard(UErrorCode &status);
3090
3096 static MeasureUnit getCubicYard();
3097
3105 static MeasureUnit *createCup(UErrorCode &status);
3106
3112 static MeasureUnit getCup();
3113
3121 static MeasureUnit *createCupMetric(UErrorCode &status);
3122
3128 static MeasureUnit getCupMetric();
3129
3137 static MeasureUnit *createDeciliter(UErrorCode &status);
3138
3144 static MeasureUnit getDeciliter();
3145
3153 static MeasureUnit *createFluidOunce(UErrorCode &status);
3154
3160 static MeasureUnit getFluidOunce();
3161
3169 static MeasureUnit *createFluidOunceImperial(UErrorCode &status);
3170
3176 static MeasureUnit getFluidOunceImperial();
3177
3185 static MeasureUnit *createGallon(UErrorCode &status);
3186
3192 static MeasureUnit getGallon();
3193
3201 static MeasureUnit *createGallonImperial(UErrorCode &status);
3202
3208 static MeasureUnit getGallonImperial();
3209
3217 static MeasureUnit *createHectoliter(UErrorCode &status);
3218
3224 static MeasureUnit getHectoliter();
3225
3233 static MeasureUnit *createLiter(UErrorCode &status);
3234
3240 static MeasureUnit getLiter();
3241
3249 static MeasureUnit *createMegaliter(UErrorCode &status);
3250
3256 static MeasureUnit getMegaliter();
3257
3265 static MeasureUnit *createMilliliter(UErrorCode &status);
3266
3272 static MeasureUnit getMilliliter();
3273
3281 static MeasureUnit *createPint(UErrorCode &status);
3282
3288 static MeasureUnit getPint();
3289
3297 static MeasureUnit *createPintMetric(UErrorCode &status);
3298
3304 static MeasureUnit getPintMetric();
3305
3313 static MeasureUnit *createQuart(UErrorCode &status);
3314
3320 static MeasureUnit getQuart();
3321
3329 static MeasureUnit *createTablespoon(UErrorCode &status);
3330
3336 static MeasureUnit getTablespoon();
3337
3345 static MeasureUnit *createTeaspoon(UErrorCode &status);
3346
3352 static MeasureUnit getTeaspoon();
3353
3354
3355 // End generated createXXX methods
3356
3357 protected:
3358
3359 #ifndef U_HIDE_INTERNAL_API
3360
3364 void initTime(const char *timeId);
3365
3370 void initCurrency(StringPiece isoCurrency);
3371
3376 void initNoUnit(const char *subtype);
3377
3378 #endif /* U_HIDE_INTERNAL_API */
3379
3380 private:
3381
3382 // Used by new draft APIs in ICU 67. If non-null, fImpl is owned by the
3383 // MeasureUnit.
3384 MeasureUnitImpl* fImpl;
3385
3386 // An index into a static string list in measunit.cpp. If set to -1, fImpl
3387 // is in use instead of fTypeId and fSubTypeId.
3388 int16_t fSubTypeId;
3389 // An index into a static string list in measunit.cpp. If set to -1, fImpl
3390 // is in use instead of fTypeId and fSubTypeId.
3391 int8_t fTypeId;
3392
3393 MeasureUnit(int32_t typeId, int32_t subTypeId);
3394 MeasureUnit(MeasureUnitImpl&& impl);
3395 void setTo(int32_t typeId, int32_t subTypeId);
3396 int32_t getOffset() const;
3397 static MeasureUnit *create(int typeId, int subTypeId, UErrorCode &status);
3398
3406 static bool findBySubType(StringPiece subType, MeasureUnit* output);
3407
3408 friend struct MeasureUnitImpl;
3409 };
3410
3411 U_NAMESPACE_END
3412
3413 #endif // !UNCONFIG_NO_FORMATTING
3414
3415 #endif /* U_SHOW_CPLUSPLUS_API */
3416
3417 #endif // __MEASUREUNIT_H__
icu::MeasureUnit
A unit such as length, mass, volume, currency, etc.
Definition: measunit.h:237
icu::UMEASURE_SI_PREFIX_PICO
SI prefix: pico, 10^-12.
Definition: measunit.h:198
icu::UMEASURE_SI_PREFIX_ZETTA
SI prefix: zetta, 10^21.
Definition: measunit.h:93
icu::UMEASURE_SI_PREFIX_ONE
The absence of an SI prefix.
Definition: measunit.h:156
icu::UMEASURE_SI_PREFIX_PETA
SI prefix: peta, 10^15.
Definition: measunit.h:107
unistr.h
C++ API: Unicode String.
icu::UMeasureSIPrefix
enum icu::UMeasureSIPrefix UMeasureSIPrefix
Enumeration for SI prefixes, such as "kilo".
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
icu::MeasureUnit::operator!=
UBool operator!=(const UObject &other) const
Inequality operator.
Definition: measunit.h:314
icu::UMEASURE_UNIT_COMPOUND
A compound unit, like meter-per-second.
Definition: measunit.h:64
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler&#39;s RTTI.
Definition: uobject.h:96
icu::StringEnumeration
Base class for &#39;pure&#39; C++ implementations of uenum api.
Definition: strenum.h:61
icu::UMEASURE_SI_PREFIX_ZEPTO
SI prefix: zepto, 10^-21.
Definition: measunit.h:219
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:301
icu::UMEASURE_SI_PREFIX_ATTO
SI prefix: atto, 10^-18.
Definition: measunit.h:212
icu::UMEASURE_UNIT_MIXED
A mixed unit, like hour+minute.
Definition: measunit.h:71
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
icu::UMEASURE_SI_PREFIX_CENTI
SI prefix: centi, 10^-2.
Definition: measunit.h:170
icu::UMEASURE_SI_PREFIX_YOCTO
SI prefix: yocto, 10^-24.
Definition: measunit.h:226
icu::LocalArray
"Smart pointer" class, deletes objects via the C++ array delete[] operator.
Definition: localpointer.h:366
icu::UObject::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU4C "poor man&#39;s RTTI", returns a UClassID for the actual ICU class.
icu::UMEASURE_SI_PREFIX_GIGA
SI prefix: giga, 10^9.
Definition: measunit.h:121
icu::UMEASURE_SI_PREFIX_YOTTA
SI prefix: yotta, 10^24.
Definition: measunit.h:86
icu::UMEASURE_SI_PREFIX_HECTO
SI prefix: hecto, 10^2.
Definition: measunit.h:142
icu::UMeasureSIPrefix
UMeasureSIPrefix
Enumeration for SI prefixes, such as "kilo".
Definition: measunit.h:79
icu::UMEASURE_SI_PREFIX_MEGA
SI prefix: mega, 10^6.
Definition: measunit.h:128
icu::UMEASURE_SI_PREFIX_DEKA
SI prefix: deka, 10^1.
Definition: measunit.h:149
icu::UMEASURE_SI_PREFIX_DECI
SI prefix: deci, 10^-1.
Definition: measunit.h:163
icu::UMEASURE_SI_PREFIX_EXA
SI prefix: exa, 10^18.
Definition: measunit.h:100
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
icu::UMEASURE_SI_PREFIX_FEMTO
SI prefix: femto, 10^-15.
Definition: measunit.h:205
icu::UMEASURE_SI_PREFIX_MICRO
SI prefix: micro, 10^-6.
Definition: measunit.h:184
icu::UMEASURE_SI_PREFIX_TERA
SI prefix: tera, 10^12.
Definition: measunit.h:114
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
icu::UMEASURE_UNIT_SINGLE
A single unit, like kilojoule.
Definition: measunit.h:57
icu::UMEASURE_SI_PREFIX_KILO
SI prefix: kilo, 10^3.
Definition: measunit.h:135
icu::UMEASURE_SI_PREFIX_MILLI
SI prefix: milli, 10^-3.
Definition: measunit.h:177
icu::StringPiece
A string-like object that points to a sized piece of memory.
Definition: stringpiece.h:60
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
icu::UMEASURE_SI_PREFIX_NANO
SI prefix: nano, 10^-9.
Definition: measunit.h:191
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:261
icu::UMeasureUnitComplexity
UMeasureUnitComplexity
Enumeration for unit complexity.
Definition: measunit.h:51