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 #include "utypeinfo.h" // for 'typeid' to work
14
15 #include "unicode/measunit.h"
16
17 #if !UCONFIG_NO_FORMATTING
18
19 #include "unicode/uenum.h"
20 #include "unicode/errorcode.h"
21 #include "ustrenum.h"
22 #include "cstring.h"
23 #include "uassert.h"
24 #include "measunit_impl.h"
25
26 U_NAMESPACE_BEGIN
27
28 UOBJECT_DEFINE_RTTI_IMPLEMENTATION(MeasureUnit)
29
30 // All code between the "Start generated code" comment and
31 // the "End generated code" comment is auto generated code
32 // and must not be edited manually. For instructions on how to correctly
33 // update this code, refer to:
34 // http://site.icu-project.org/design/formatting/measureformat/updating-measure-unit
35 //
36 // Start generated code
37 // TODO(ICU-21076): improve how this generated code is produced.
38
39 // Maps from Type ID to offset in gSubTypes.
40 static const int32_t gOffsets[] = {
41 0,
42 2,
43 7,
44 17,
45 25,
46 29,
47 328,
48 339,
49 355,
50 359,
51 368,
52 370,
53 374,
54 382,
55 404,
56 408,
57 423,
58 426,
59 432,
60 442,
61 446,
62 450,
63 452,
64 486
65 };
66
67 // TODO: FIX CODE GENERATION - leaving this here but commented-out to make it
68 // clear that we no longer want this array. We needed it for only one thing: efficient checking of "currency".
69 //
70 // static const int32_t gIndexes[] = {
71 // 0,
72 // 2,
73 // 7,
74 // 17,
75 // 25,
76 // 29,
77 // 29,
78 // 40,
79 // 56,
80 // 60,
81 // 69,
82 // 71,
83 // 75,
84 // 83,
85 // 105,
86 // 109,
87 // 124,
88 // 127,
89 // 133,
90 // 143,
91 // 147,
92 // 151,
93 // 153,
94 // 187
95 // };
96 static const int32_t kCurrencyOffset = 5;
97
98 // Must be sorted alphabetically.
99 static const char * const gTypes[] = {
100 "acceleration",
101 "angle",
102 "area",
103 "concentr",
104 "consumption",
105 "currency",
106 "digital",
107 "duration",
108 "electric",
109 "energy",
110 "force",
111 "frequency",
112 "graphics",
113 "length",
114 "light",
115 "mass",
116 "none",
117 "power",
118 "pressure",
119 "speed",
120 "temperature",
121 "torque",
122 "volume"
123 };
124
125 // Must be grouped by type and sorted alphabetically within each type.
126 static const char * const gSubTypes[] = {
127 "g-force",
128 "meter-per-square-second",
129 "arc-minute",
130 "arc-second",
131 "degree",
132 "radian",
133 "revolution",
134 "acre",
135 "dunam",
136 "hectare",
137 "square-centimeter",
138 "square-foot",
139 "square-inch",
140 "square-kilometer",
141 "square-meter",
142 "square-mile",
143 "square-yard",
144 "karat",
145 "milligram-per-deciliter",
146 "millimole-per-liter",
147 "mole",
148 "percent",
149 "permille",
150 "permillion",
151 "permyriad",
152 "liter-per-100-kilometer",
153 "liter-per-kilometer",
154 "mile-per-gallon",
155 "mile-per-gallon-imperial",
156 "ADP",
157 "AED",
158 "AFA",
159 "AFN",
160 "ALK",
161 "ALL",
162 "AMD",
163 "ANG",
164 "AOA",
165 "AOK",
166 "AON",
167 "AOR",
168 "ARA",
169 "ARP",
170 "ARS",
171 "ARY",
172 "ATS",
173 "AUD",
174 "AWG",
175 "AYM",
176 "AZM",
177 "AZN",
178 "BAD",
179 "BAM",
180 "BBD",
181 "BDT",
182 "BEC",
183 "BEF",
184 "BEL",
185 "BGJ",
186 "BGK",
187 "BGL",
188 "BGN",
189 "BHD",
190 "BIF",
191 "BMD",
192 "BND",
193 "BOB",
194 "BOP",
195 "BOV",
196 "BRB",
197 "BRC",
198 "BRE",
199 "BRL",
200 "BRN",
201 "BRR",
202 "BSD",
203 "BTN",
204 "BUK",
205 "BWP",
206 "BYB",
207 "BYN",
208 "BYR",
209 "BZD",
210 "CAD",
211 "CDF",
212 "CHC",
213 "CHE",
214 "CHF",
215 "CHW",
216 "CLF",
217 "CLP",
218 "CNY",
219 "COP",
220 "COU",
221 "CRC",
222 "CSD",
223 "CSJ",
224 "CSK",
225 "CUC",
226 "CUP",
227 "CVE",
228 "CYP",
229 "CZK",
230 "DDM",
231 "DEM",
232 "DJF",
233 "DKK",
234 "DOP",
235 "DZD",
236 "ECS",
237 "ECV",
238 "EEK",
239 "EGP",
240 "ERN",
241 "ESA",
242 "ESB",
243 "ESP",
244 "ETB",
245 "EUR",
246 "FIM",
247 "FJD",
248 "FKP",
249 "FRF",
250 "GBP",
251 "GEK",
252 "GEL",
253 "GHC",
254 "GHP",
255 "GHS",
256 "GIP",
257 "GMD",
258 "GNE",
259 "GNF",
260 "GNS",
261 "GQE",
262 "GRD",
263 "GTQ",
264 "GWE",
265 "GWP",
266 "GYD",
267 "HKD",
268 "HNL",
269 "HRD",
270 "HRK",
271 "HTG",
272 "HUF",
273 "IDR",
274 "IEP",
275 "ILP",
276 "ILR",
277 "ILS",
278 "INR",
279 "IQD",
280 "IRR",
281 "ISJ",
282 "ISK",
283 "ITL",
284 "JMD",
285 "JOD",
286 "JPY",
287 "KES",
288 "KGS",
289 "KHR",
290 "KMF",
291 "KPW",
292 "KRW",
293 "KWD",
294 "KYD",
295 "KZT",
296 "LAJ",
297 "LAK",
298 "LBP",
299 "LKR",
300 "LRD",
301 "LSL",
302 "LSM",
303 "LTL",
304 "LTT",
305 "LUC",
306 "LUF",
307 "LUL",
308 "LVL",
309 "LVR",
310 "LYD",
311 "MAD",
312 "MDL",
313 "MGA",
314 "MGF",
315 "MKD",
316 "MLF",
317 "MMK",
318 "MNT",
319 "MOP",
320 "MRO",
321 "MRU",
322 "MTL",
323 "MTP",
324 "MUR",
325 "MVQ",
326 "MVR",
327 "MWK",
328 "MXN",
329 "MXP",
330 "MXV",
331 "MYR",
332 "MZE",
333 "MZM",
334 "MZN",
335 "NAD",
336 "NGN",
337 "NIC",
338 "NIO",
339 "NLG",
340 "NOK",
341 "NPR",
342 "NZD",
343 "OMR",
344 "PAB",
345 "PEH",
346 "PEI",
347 "PEN",
348 "PES",
349 "PGK",
350 "PHP",
351 "PKR",
352 "PLN",
353 "PLZ",
354 "PTE",
355 "PYG",
356 "QAR",
357 "RHD",
358 "ROK",
359 "ROL",
360 "RON",
361 "RSD",
362 "RUB",
363 "RUR",
364 "RWF",
365 "SAR",
366 "SBD",
367 "SCR",
368 "SDD",
369 "SDG",
370 "SDP",
371 "SEK",
372 "SGD",
373 "SHP",
374 "SIT",
375 "SKK",
376 "SLL",
377 "SOS",
378 "SRD",
379 "SRG",
380 "SSP",
381 "STD",
382 "STN",
383 "SUR",
384 "SVC",
385 "SYP",
386 "SZL",
387 "THB",
388 "TJR",
389 "TJS",
390 "TMM",
391 "TMT",
392 "TND",
393 "TOP",
394 "TPE",
395 "TRL",
396 "TRY",
397 "TTD",
398 "TWD",
399 "TZS",
400 "UAH",
401 "UAK",
402 "UGS",
403 "UGW",
404 "UGX",
405 "USD",
406 "USN",
407 "USS",
408 "UYI",
409 "UYN",
410 "UYP",
411 "UYU",
412 "UYW",
413 "UZS",
414 "VEB",
415 "VEF",
416 "VES",
417 "VNC",
418 "VND",
419 "VUV",
420 "WST",
421 "XAF",
422 "XAG",
423 "XAU",
424 "XBA",
425 "XBB",
426 "XBC",
427 "XBD",
428 "XCD",
429 "XDR",
430 "XEU",
431 "XOF",
432 "XPD",
433 "XPF",
434 "XPT",
435 "XSU",
436 "XTS",
437 "XUA",
438 "XXX",
439 "YDD",
440 "YER",
441 "YUD",
442 "YUM",
443 "YUN",
444 "ZAL",
445 "ZAR",
446 "ZMK",
447 "ZMW",
448 "ZRN",
449 "ZRZ",
450 "ZWC",
451 "ZWD",
452 "ZWL",
453 "ZWN",
454 "ZWR",
455 "bit",
456 "byte",
457 "gigabit",
458 "gigabyte",
459 "kilobit",
460 "kilobyte",
461 "megabit",
462 "megabyte",
463 "petabyte",
464 "terabit",
465 "terabyte",
466 "century",
467 "day",
468 "day-person",
469 "decade",
470 "hour",
471 "microsecond",
472 "millisecond",
473 "minute",
474 "month",
475 "month-person",
476 "nanosecond",
477 "second",
478 "week",
479 "week-person",
480 "year",
481 "year-person",
482 "ampere",
483 "milliampere",
484 "ohm",
485 "volt",
486 "british-thermal-unit",
487 "calorie",
488 "electronvolt",
489 "foodcalorie",
490 "joule",
491 "kilocalorie",
492 "kilojoule",
493 "kilowatt-hour",
494 "therm-us",
495 "newton",
496 "pound-force",
497 "gigahertz",
498 "hertz",
499 "kilohertz",
500 "megahertz",
501 "dot",
502 "dot-per-centimeter",
503 "dot-per-inch",
504 "em",
505 "megapixel",
506 "pixel",
507 "pixel-per-centimeter",
508 "pixel-per-inch",
509 "astronomical-unit",
510 "centimeter",
511 "decimeter",
512 "earth-radius",
513 "fathom",
514 "foot",
515 "furlong",
516 "inch",
517 "kilometer",
518 "light-year",
519 "meter",
520 "micrometer",
521 "mile",
522 "mile-scandinavian",
523 "millimeter",
524 "nanometer",
525 "nautical-mile",
526 "parsec",
527 "picometer",
528 "point",
529 "solar-radius",
530 "yard",
531 "candela",
532 "lumen",
533 "lux",
534 "solar-luminosity",
535 "carat",
536 "dalton",
537 "earth-mass",
538 "grain",
539 "gram",
540 "kilogram",
541 "metric-ton",
542 "microgram",
543 "milligram",
544 "ounce",
545 "ounce-troy",
546 "pound",
547 "solar-mass",
548 "stone",
549 "ton",
550 "", // TODO(ICU-21076): manual edit of what should have been generated by Java.
551 "percent", // TODO(ICU-21076): regenerate, deal with duplication.
552 "permille", // TODO(ICU-21076): regenerate, deal with duplication.
553 "gigawatt",
554 "horsepower",
555 "kilowatt",
556 "megawatt",
557 "milliwatt",
558 "watt",
559 "atmosphere",
560 "bar",
561 "hectopascal",
562 "inch-ofhg",
563 "kilopascal",
564 "megapascal",
565 "millibar",
566 "millimeter-ofhg",
567 "pascal",
568 "pound-force-per-square-inch",
569 "kilometer-per-hour",
570 "knot",
571 "meter-per-second",
572 "mile-per-hour",
573 "celsius",
574 "fahrenheit",
575 "generic",
576 "kelvin",
577 "newton-meter",
578 "pound-force-foot",
579 "acre-foot",
580 "barrel",
581 "bushel",
582 "centiliter",
583 "cubic-centimeter",
584 "cubic-foot",
585 "cubic-inch",
586 "cubic-kilometer",
587 "cubic-meter",
588 "cubic-mile",
589 "cubic-yard",
590 "cup",
591 "cup-metric",
592 "deciliter",
593 "dessert-spoon",
594 "dessert-spoon-imperial",
595 "dram",
596 "drop",
597 "fluid-ounce",
598 "fluid-ounce-imperial",
599 "gallon",
600 "gallon-imperial",
601 "hectoliter",
602 "jigger",
603 "liter",
604 "megaliter",
605 "milliliter",
606 "pinch",
607 "pint",
608 "pint-metric",
609 "quart",
610 "quart-imperial",
611 "tablespoon",
612 "teaspoon"
613 };
614
615 // unitPerUnitToSingleUnit no longer in use! TODO: remove from code-generation code.
616
617 // Shortcuts to the base unit in order to make the default constructor fast
618 static const int32_t kBaseTypeIdx = 16;
619 static const int32_t kBaseSubTypeIdx = 0;
620
createGForce(UErrorCode & status)621 MeasureUnit *MeasureUnit::createGForce(UErrorCode &status) {
622 return MeasureUnit::create(0, 0, status);
623 }
624
getGForce()625 MeasureUnit MeasureUnit::getGForce() {
626 return MeasureUnit(0, 0);
627 }
628
createMeterPerSecondSquared(UErrorCode & status)629 MeasureUnit *MeasureUnit::createMeterPerSecondSquared(UErrorCode &status) {
630 return MeasureUnit::create(0, 1, status);
631 }
632
getMeterPerSecondSquared()633 MeasureUnit MeasureUnit::getMeterPerSecondSquared() {
634 return MeasureUnit(0, 1);
635 }
636
createArcMinute(UErrorCode & status)637 MeasureUnit *MeasureUnit::createArcMinute(UErrorCode &status) {
638 return MeasureUnit::create(1, 0, status);
639 }
640
getArcMinute()641 MeasureUnit MeasureUnit::getArcMinute() {
642 return MeasureUnit(1, 0);
643 }
644
createArcSecond(UErrorCode & status)645 MeasureUnit *MeasureUnit::createArcSecond(UErrorCode &status) {
646 return MeasureUnit::create(1, 1, status);
647 }
648
getArcSecond()649 MeasureUnit MeasureUnit::getArcSecond() {
650 return MeasureUnit(1, 1);
651 }
652
createDegree(UErrorCode & status)653 MeasureUnit *MeasureUnit::createDegree(UErrorCode &status) {
654 return MeasureUnit::create(1, 2, status);
655 }
656
getDegree()657 MeasureUnit MeasureUnit::getDegree() {
658 return MeasureUnit(1, 2);
659 }
660
createRadian(UErrorCode & status)661 MeasureUnit *MeasureUnit::createRadian(UErrorCode &status) {
662 return MeasureUnit::create(1, 3, status);
663 }
664
getRadian()665 MeasureUnit MeasureUnit::getRadian() {
666 return MeasureUnit(1, 3);
667 }
668
createRevolutionAngle(UErrorCode & status)669 MeasureUnit *MeasureUnit::createRevolutionAngle(UErrorCode &status) {
670 return MeasureUnit::create(1, 4, status);
671 }
672
getRevolutionAngle()673 MeasureUnit MeasureUnit::getRevolutionAngle() {
674 return MeasureUnit(1, 4);
675 }
676
createAcre(UErrorCode & status)677 MeasureUnit *MeasureUnit::createAcre(UErrorCode &status) {
678 return MeasureUnit::create(2, 0, status);
679 }
680
getAcre()681 MeasureUnit MeasureUnit::getAcre() {
682 return MeasureUnit(2, 0);
683 }
684
createDunam(UErrorCode & status)685 MeasureUnit *MeasureUnit::createDunam(UErrorCode &status) {
686 return MeasureUnit::create(2, 1, status);
687 }
688
getDunam()689 MeasureUnit MeasureUnit::getDunam() {
690 return MeasureUnit(2, 1);
691 }
692
createHectare(UErrorCode & status)693 MeasureUnit *MeasureUnit::createHectare(UErrorCode &status) {
694 return MeasureUnit::create(2, 2, status);
695 }
696
getHectare()697 MeasureUnit MeasureUnit::getHectare() {
698 return MeasureUnit(2, 2);
699 }
700
createSquareCentimeter(UErrorCode & status)701 MeasureUnit *MeasureUnit::createSquareCentimeter(UErrorCode &status) {
702 return MeasureUnit::create(2, 3, status);
703 }
704
getSquareCentimeter()705 MeasureUnit MeasureUnit::getSquareCentimeter() {
706 return MeasureUnit(2, 3);
707 }
708
createSquareFoot(UErrorCode & status)709 MeasureUnit *MeasureUnit::createSquareFoot(UErrorCode &status) {
710 return MeasureUnit::create(2, 4, status);
711 }
712
getSquareFoot()713 MeasureUnit MeasureUnit::getSquareFoot() {
714 return MeasureUnit(2, 4);
715 }
716
createSquareInch(UErrorCode & status)717 MeasureUnit *MeasureUnit::createSquareInch(UErrorCode &status) {
718 return MeasureUnit::create(2, 5, status);
719 }
720
getSquareInch()721 MeasureUnit MeasureUnit::getSquareInch() {
722 return MeasureUnit(2, 5);
723 }
724
createSquareKilometer(UErrorCode & status)725 MeasureUnit *MeasureUnit::createSquareKilometer(UErrorCode &status) {
726 return MeasureUnit::create(2, 6, status);
727 }
728
getSquareKilometer()729 MeasureUnit MeasureUnit::getSquareKilometer() {
730 return MeasureUnit(2, 6);
731 }
732
createSquareMeter(UErrorCode & status)733 MeasureUnit *MeasureUnit::createSquareMeter(UErrorCode &status) {
734 return MeasureUnit::create(2, 7, status);
735 }
736
getSquareMeter()737 MeasureUnit MeasureUnit::getSquareMeter() {
738 return MeasureUnit(2, 7);
739 }
740
createSquareMile(UErrorCode & status)741 MeasureUnit *MeasureUnit::createSquareMile(UErrorCode &status) {
742 return MeasureUnit::create(2, 8, status);
743 }
744
getSquareMile()745 MeasureUnit MeasureUnit::getSquareMile() {
746 return MeasureUnit(2, 8);
747 }
748
createSquareYard(UErrorCode & status)749 MeasureUnit *MeasureUnit::createSquareYard(UErrorCode &status) {
750 return MeasureUnit::create(2, 9, status);
751 }
752
getSquareYard()753 MeasureUnit MeasureUnit::getSquareYard() {
754 return MeasureUnit(2, 9);
755 }
756
createKarat(UErrorCode & status)757 MeasureUnit *MeasureUnit::createKarat(UErrorCode &status) {
758 return MeasureUnit::create(3, 0, status);
759 }
760
getKarat()761 MeasureUnit MeasureUnit::getKarat() {
762 return MeasureUnit(3, 0);
763 }
764
createMilligramPerDeciliter(UErrorCode & status)765 MeasureUnit *MeasureUnit::createMilligramPerDeciliter(UErrorCode &status) {
766 return MeasureUnit::create(3, 1, status);
767 }
768
getMilligramPerDeciliter()769 MeasureUnit MeasureUnit::getMilligramPerDeciliter() {
770 return MeasureUnit(3, 1);
771 }
772
createMillimolePerLiter(UErrorCode & status)773 MeasureUnit *MeasureUnit::createMillimolePerLiter(UErrorCode &status) {
774 return MeasureUnit::create(3, 2, status);
775 }
776
getMillimolePerLiter()777 MeasureUnit MeasureUnit::getMillimolePerLiter() {
778 return MeasureUnit(3, 2);
779 }
780
createMole(UErrorCode & status)781 MeasureUnit *MeasureUnit::createMole(UErrorCode &status) {
782 return MeasureUnit::create(3, 3, status);
783 }
784
getMole()785 MeasureUnit MeasureUnit::getMole() {
786 return MeasureUnit(3, 3);
787 }
788
createPercent(UErrorCode & status)789 MeasureUnit *MeasureUnit::createPercent(UErrorCode &status) {
790 return MeasureUnit::create(3, 4, status);
791 }
792
getPercent()793 MeasureUnit MeasureUnit::getPercent() {
794 return MeasureUnit(3, 4);
795 }
796
createPermille(UErrorCode & status)797 MeasureUnit *MeasureUnit::createPermille(UErrorCode &status) {
798 return MeasureUnit::create(3, 5, status);
799 }
800
getPermille()801 MeasureUnit MeasureUnit::getPermille() {
802 return MeasureUnit(3, 5);
803 }
804
createPartPerMillion(UErrorCode & status)805 MeasureUnit *MeasureUnit::createPartPerMillion(UErrorCode &status) {
806 return MeasureUnit::create(3, 6, status);
807 }
808
getPartPerMillion()809 MeasureUnit MeasureUnit::getPartPerMillion() {
810 return MeasureUnit(3, 6);
811 }
812
createPermyriad(UErrorCode & status)813 MeasureUnit *MeasureUnit::createPermyriad(UErrorCode &status) {
814 return MeasureUnit::create(3, 7, status);
815 }
816
getPermyriad()817 MeasureUnit MeasureUnit::getPermyriad() {
818 return MeasureUnit(3, 7);
819 }
820
createLiterPer100Kilometers(UErrorCode & status)821 MeasureUnit *MeasureUnit::createLiterPer100Kilometers(UErrorCode &status) {
822 return MeasureUnit::create(4, 0, status);
823 }
824
getLiterPer100Kilometers()825 MeasureUnit MeasureUnit::getLiterPer100Kilometers() {
826 return MeasureUnit(4, 0);
827 }
828
createLiterPerKilometer(UErrorCode & status)829 MeasureUnit *MeasureUnit::createLiterPerKilometer(UErrorCode &status) {
830 return MeasureUnit::create(4, 1, status);
831 }
832
getLiterPerKilometer()833 MeasureUnit MeasureUnit::getLiterPerKilometer() {
834 return MeasureUnit(4, 1);
835 }
836
createMilePerGallon(UErrorCode & status)837 MeasureUnit *MeasureUnit::createMilePerGallon(UErrorCode &status) {
838 return MeasureUnit::create(4, 2, status);
839 }
840
getMilePerGallon()841 MeasureUnit MeasureUnit::getMilePerGallon() {
842 return MeasureUnit(4, 2);
843 }
844
createMilePerGallonImperial(UErrorCode & status)845 MeasureUnit *MeasureUnit::createMilePerGallonImperial(UErrorCode &status) {
846 return MeasureUnit::create(4, 3, status);
847 }
848
getMilePerGallonImperial()849 MeasureUnit MeasureUnit::getMilePerGallonImperial() {
850 return MeasureUnit(4, 3);
851 }
852
createBit(UErrorCode & status)853 MeasureUnit *MeasureUnit::createBit(UErrorCode &status) {
854 return MeasureUnit::create(6, 0, status);
855 }
856
getBit()857 MeasureUnit MeasureUnit::getBit() {
858 return MeasureUnit(6, 0);
859 }
860
createByte(UErrorCode & status)861 MeasureUnit *MeasureUnit::createByte(UErrorCode &status) {
862 return MeasureUnit::create(6, 1, status);
863 }
864
getByte()865 MeasureUnit MeasureUnit::getByte() {
866 return MeasureUnit(6, 1);
867 }
868
createGigabit(UErrorCode & status)869 MeasureUnit *MeasureUnit::createGigabit(UErrorCode &status) {
870 return MeasureUnit::create(6, 2, status);
871 }
872
getGigabit()873 MeasureUnit MeasureUnit::getGigabit() {
874 return MeasureUnit(6, 2);
875 }
876
createGigabyte(UErrorCode & status)877 MeasureUnit *MeasureUnit::createGigabyte(UErrorCode &status) {
878 return MeasureUnit::create(6, 3, status);
879 }
880
getGigabyte()881 MeasureUnit MeasureUnit::getGigabyte() {
882 return MeasureUnit(6, 3);
883 }
884
createKilobit(UErrorCode & status)885 MeasureUnit *MeasureUnit::createKilobit(UErrorCode &status) {
886 return MeasureUnit::create(6, 4, status);
887 }
888
getKilobit()889 MeasureUnit MeasureUnit::getKilobit() {
890 return MeasureUnit(6, 4);
891 }
892
createKilobyte(UErrorCode & status)893 MeasureUnit *MeasureUnit::createKilobyte(UErrorCode &status) {
894 return MeasureUnit::create(6, 5, status);
895 }
896
getKilobyte()897 MeasureUnit MeasureUnit::getKilobyte() {
898 return MeasureUnit(6, 5);
899 }
900
createMegabit(UErrorCode & status)901 MeasureUnit *MeasureUnit::createMegabit(UErrorCode &status) {
902 return MeasureUnit::create(6, 6, status);
903 }
904
getMegabit()905 MeasureUnit MeasureUnit::getMegabit() {
906 return MeasureUnit(6, 6);
907 }
908
createMegabyte(UErrorCode & status)909 MeasureUnit *MeasureUnit::createMegabyte(UErrorCode &status) {
910 return MeasureUnit::create(6, 7, status);
911 }
912
getMegabyte()913 MeasureUnit MeasureUnit::getMegabyte() {
914 return MeasureUnit(6, 7);
915 }
916
createPetabyte(UErrorCode & status)917 MeasureUnit *MeasureUnit::createPetabyte(UErrorCode &status) {
918 return MeasureUnit::create(6, 8, status);
919 }
920
getPetabyte()921 MeasureUnit MeasureUnit::getPetabyte() {
922 return MeasureUnit(6, 8);
923 }
924
createTerabit(UErrorCode & status)925 MeasureUnit *MeasureUnit::createTerabit(UErrorCode &status) {
926 return MeasureUnit::create(6, 9, status);
927 }
928
getTerabit()929 MeasureUnit MeasureUnit::getTerabit() {
930 return MeasureUnit(6, 9);
931 }
932
createTerabyte(UErrorCode & status)933 MeasureUnit *MeasureUnit::createTerabyte(UErrorCode &status) {
934 return MeasureUnit::create(6, 10, status);
935 }
936
getTerabyte()937 MeasureUnit MeasureUnit::getTerabyte() {
938 return MeasureUnit(6, 10);
939 }
940
createCentury(UErrorCode & status)941 MeasureUnit *MeasureUnit::createCentury(UErrorCode &status) {
942 return MeasureUnit::create(7, 0, status);
943 }
944
getCentury()945 MeasureUnit MeasureUnit::getCentury() {
946 return MeasureUnit(7, 0);
947 }
948
createDay(UErrorCode & status)949 MeasureUnit *MeasureUnit::createDay(UErrorCode &status) {
950 return MeasureUnit::create(7, 1, status);
951 }
952
getDay()953 MeasureUnit MeasureUnit::getDay() {
954 return MeasureUnit(7, 1);
955 }
956
createDayPerson(UErrorCode & status)957 MeasureUnit *MeasureUnit::createDayPerson(UErrorCode &status) {
958 return MeasureUnit::create(7, 2, status);
959 }
960
getDayPerson()961 MeasureUnit MeasureUnit::getDayPerson() {
962 return MeasureUnit(7, 2);
963 }
964
createDecade(UErrorCode & status)965 MeasureUnit *MeasureUnit::createDecade(UErrorCode &status) {
966 return MeasureUnit::create(7, 3, status);
967 }
968
getDecade()969 MeasureUnit MeasureUnit::getDecade() {
970 return MeasureUnit(7, 3);
971 }
972
createHour(UErrorCode & status)973 MeasureUnit *MeasureUnit::createHour(UErrorCode &status) {
974 return MeasureUnit::create(7, 4, status);
975 }
976
getHour()977 MeasureUnit MeasureUnit::getHour() {
978 return MeasureUnit(7, 4);
979 }
980
createMicrosecond(UErrorCode & status)981 MeasureUnit *MeasureUnit::createMicrosecond(UErrorCode &status) {
982 return MeasureUnit::create(7, 5, status);
983 }
984
getMicrosecond()985 MeasureUnit MeasureUnit::getMicrosecond() {
986 return MeasureUnit(7, 5);
987 }
988
createMillisecond(UErrorCode & status)989 MeasureUnit *MeasureUnit::createMillisecond(UErrorCode &status) {
990 return MeasureUnit::create(7, 6, status);
991 }
992
getMillisecond()993 MeasureUnit MeasureUnit::getMillisecond() {
994 return MeasureUnit(7, 6);
995 }
996
createMinute(UErrorCode & status)997 MeasureUnit *MeasureUnit::createMinute(UErrorCode &status) {
998 return MeasureUnit::create(7, 7, status);
999 }
1000
getMinute()1001 MeasureUnit MeasureUnit::getMinute() {
1002 return MeasureUnit(7, 7);
1003 }
1004
createMonth(UErrorCode & status)1005 MeasureUnit *MeasureUnit::createMonth(UErrorCode &status) {
1006 return MeasureUnit::create(7, 8, status);
1007 }
1008
getMonth()1009 MeasureUnit MeasureUnit::getMonth() {
1010 return MeasureUnit(7, 8);
1011 }
1012
createMonthPerson(UErrorCode & status)1013 MeasureUnit *MeasureUnit::createMonthPerson(UErrorCode &status) {
1014 return MeasureUnit::create(7, 9, status);
1015 }
1016
getMonthPerson()1017 MeasureUnit MeasureUnit::getMonthPerson() {
1018 return MeasureUnit(7, 9);
1019 }
1020
createNanosecond(UErrorCode & status)1021 MeasureUnit *MeasureUnit::createNanosecond(UErrorCode &status) {
1022 return MeasureUnit::create(7, 10, status);
1023 }
1024
getNanosecond()1025 MeasureUnit MeasureUnit::getNanosecond() {
1026 return MeasureUnit(7, 10);
1027 }
1028
createSecond(UErrorCode & status)1029 MeasureUnit *MeasureUnit::createSecond(UErrorCode &status) {
1030 return MeasureUnit::create(7, 11, status);
1031 }
1032
getSecond()1033 MeasureUnit MeasureUnit::getSecond() {
1034 return MeasureUnit(7, 11);
1035 }
1036
createWeek(UErrorCode & status)1037 MeasureUnit *MeasureUnit::createWeek(UErrorCode &status) {
1038 return MeasureUnit::create(7, 12, status);
1039 }
1040
getWeek()1041 MeasureUnit MeasureUnit::getWeek() {
1042 return MeasureUnit(7, 12);
1043 }
1044
createWeekPerson(UErrorCode & status)1045 MeasureUnit *MeasureUnit::createWeekPerson(UErrorCode &status) {
1046 return MeasureUnit::create(7, 13, status);
1047 }
1048
getWeekPerson()1049 MeasureUnit MeasureUnit::getWeekPerson() {
1050 return MeasureUnit(7, 13);
1051 }
1052
createYear(UErrorCode & status)1053 MeasureUnit *MeasureUnit::createYear(UErrorCode &status) {
1054 return MeasureUnit::create(7, 14, status);
1055 }
1056
getYear()1057 MeasureUnit MeasureUnit::getYear() {
1058 return MeasureUnit(7, 14);
1059 }
1060
createYearPerson(UErrorCode & status)1061 MeasureUnit *MeasureUnit::createYearPerson(UErrorCode &status) {
1062 return MeasureUnit::create(7, 15, status);
1063 }
1064
getYearPerson()1065 MeasureUnit MeasureUnit::getYearPerson() {
1066 return MeasureUnit(7, 15);
1067 }
1068
createAmpere(UErrorCode & status)1069 MeasureUnit *MeasureUnit::createAmpere(UErrorCode &status) {
1070 return MeasureUnit::create(8, 0, status);
1071 }
1072
getAmpere()1073 MeasureUnit MeasureUnit::getAmpere() {
1074 return MeasureUnit(8, 0);
1075 }
1076
createMilliampere(UErrorCode & status)1077 MeasureUnit *MeasureUnit::createMilliampere(UErrorCode &status) {
1078 return MeasureUnit::create(8, 1, status);
1079 }
1080
getMilliampere()1081 MeasureUnit MeasureUnit::getMilliampere() {
1082 return MeasureUnit(8, 1);
1083 }
1084
createOhm(UErrorCode & status)1085 MeasureUnit *MeasureUnit::createOhm(UErrorCode &status) {
1086 return MeasureUnit::create(8, 2, status);
1087 }
1088
getOhm()1089 MeasureUnit MeasureUnit::getOhm() {
1090 return MeasureUnit(8, 2);
1091 }
1092
createVolt(UErrorCode & status)1093 MeasureUnit *MeasureUnit::createVolt(UErrorCode &status) {
1094 return MeasureUnit::create(8, 3, status);
1095 }
1096
getVolt()1097 MeasureUnit MeasureUnit::getVolt() {
1098 return MeasureUnit(8, 3);
1099 }
1100
createBritishThermalUnit(UErrorCode & status)1101 MeasureUnit *MeasureUnit::createBritishThermalUnit(UErrorCode &status) {
1102 return MeasureUnit::create(9, 0, status);
1103 }
1104
getBritishThermalUnit()1105 MeasureUnit MeasureUnit::getBritishThermalUnit() {
1106 return MeasureUnit(9, 0);
1107 }
1108
createCalorie(UErrorCode & status)1109 MeasureUnit *MeasureUnit::createCalorie(UErrorCode &status) {
1110 return MeasureUnit::create(9, 1, status);
1111 }
1112
getCalorie()1113 MeasureUnit MeasureUnit::getCalorie() {
1114 return MeasureUnit(9, 1);
1115 }
1116
createElectronvolt(UErrorCode & status)1117 MeasureUnit *MeasureUnit::createElectronvolt(UErrorCode &status) {
1118 return MeasureUnit::create(9, 2, status);
1119 }
1120
getElectronvolt()1121 MeasureUnit MeasureUnit::getElectronvolt() {
1122 return MeasureUnit(9, 2);
1123 }
1124
createFoodcalorie(UErrorCode & status)1125 MeasureUnit *MeasureUnit::createFoodcalorie(UErrorCode &status) {
1126 return MeasureUnit::create(9, 3, status);
1127 }
1128
getFoodcalorie()1129 MeasureUnit MeasureUnit::getFoodcalorie() {
1130 return MeasureUnit(9, 3);
1131 }
1132
createJoule(UErrorCode & status)1133 MeasureUnit *MeasureUnit::createJoule(UErrorCode &status) {
1134 return MeasureUnit::create(9, 4, status);
1135 }
1136
getJoule()1137 MeasureUnit MeasureUnit::getJoule() {
1138 return MeasureUnit(9, 4);
1139 }
1140
createKilocalorie(UErrorCode & status)1141 MeasureUnit *MeasureUnit::createKilocalorie(UErrorCode &status) {
1142 return MeasureUnit::create(9, 5, status);
1143 }
1144
getKilocalorie()1145 MeasureUnit MeasureUnit::getKilocalorie() {
1146 return MeasureUnit(9, 5);
1147 }
1148
createKilojoule(UErrorCode & status)1149 MeasureUnit *MeasureUnit::createKilojoule(UErrorCode &status) {
1150 return MeasureUnit::create(9, 6, status);
1151 }
1152
getKilojoule()1153 MeasureUnit MeasureUnit::getKilojoule() {
1154 return MeasureUnit(9, 6);
1155 }
1156
createKilowattHour(UErrorCode & status)1157 MeasureUnit *MeasureUnit::createKilowattHour(UErrorCode &status) {
1158 return MeasureUnit::create(9, 7, status);
1159 }
1160
getKilowattHour()1161 MeasureUnit MeasureUnit::getKilowattHour() {
1162 return MeasureUnit(9, 7);
1163 }
1164
createThermUs(UErrorCode & status)1165 MeasureUnit *MeasureUnit::createThermUs(UErrorCode &status) {
1166 return MeasureUnit::create(9, 8, status);
1167 }
1168
getThermUs()1169 MeasureUnit MeasureUnit::getThermUs() {
1170 return MeasureUnit(9, 8);
1171 }
1172
createNewton(UErrorCode & status)1173 MeasureUnit *MeasureUnit::createNewton(UErrorCode &status) {
1174 return MeasureUnit::create(10, 0, status);
1175 }
1176
getNewton()1177 MeasureUnit MeasureUnit::getNewton() {
1178 return MeasureUnit(10, 0);
1179 }
1180
createPoundForce(UErrorCode & status)1181 MeasureUnit *MeasureUnit::createPoundForce(UErrorCode &status) {
1182 return MeasureUnit::create(10, 1, status);
1183 }
1184
getPoundForce()1185 MeasureUnit MeasureUnit::getPoundForce() {
1186 return MeasureUnit(10, 1);
1187 }
1188
createGigahertz(UErrorCode & status)1189 MeasureUnit *MeasureUnit::createGigahertz(UErrorCode &status) {
1190 return MeasureUnit::create(11, 0, status);
1191 }
1192
getGigahertz()1193 MeasureUnit MeasureUnit::getGigahertz() {
1194 return MeasureUnit(11, 0);
1195 }
1196
createHertz(UErrorCode & status)1197 MeasureUnit *MeasureUnit::createHertz(UErrorCode &status) {
1198 return MeasureUnit::create(11, 1, status);
1199 }
1200
getHertz()1201 MeasureUnit MeasureUnit::getHertz() {
1202 return MeasureUnit(11, 1);
1203 }
1204
createKilohertz(UErrorCode & status)1205 MeasureUnit *MeasureUnit::createKilohertz(UErrorCode &status) {
1206 return MeasureUnit::create(11, 2, status);
1207 }
1208
getKilohertz()1209 MeasureUnit MeasureUnit::getKilohertz() {
1210 return MeasureUnit(11, 2);
1211 }
1212
createMegahertz(UErrorCode & status)1213 MeasureUnit *MeasureUnit::createMegahertz(UErrorCode &status) {
1214 return MeasureUnit::create(11, 3, status);
1215 }
1216
getMegahertz()1217 MeasureUnit MeasureUnit::getMegahertz() {
1218 return MeasureUnit(11, 3);
1219 }
1220
createDot(UErrorCode & status)1221 MeasureUnit *MeasureUnit::createDot(UErrorCode &status) {
1222 return MeasureUnit::create(12, 0, status);
1223 }
1224
getDot()1225 MeasureUnit MeasureUnit::getDot() {
1226 return MeasureUnit(12, 0);
1227 }
1228
createDotPerCentimeter(UErrorCode & status)1229 MeasureUnit *MeasureUnit::createDotPerCentimeter(UErrorCode &status) {
1230 return MeasureUnit::create(12, 1, status);
1231 }
1232
getDotPerCentimeter()1233 MeasureUnit MeasureUnit::getDotPerCentimeter() {
1234 return MeasureUnit(12, 1);
1235 }
1236
createDotPerInch(UErrorCode & status)1237 MeasureUnit *MeasureUnit::createDotPerInch(UErrorCode &status) {
1238 return MeasureUnit::create(12, 2, status);
1239 }
1240
getDotPerInch()1241 MeasureUnit MeasureUnit::getDotPerInch() {
1242 return MeasureUnit(12, 2);
1243 }
1244
createEm(UErrorCode & status)1245 MeasureUnit *MeasureUnit::createEm(UErrorCode &status) {
1246 return MeasureUnit::create(12, 3, status);
1247 }
1248
getEm()1249 MeasureUnit MeasureUnit::getEm() {
1250 return MeasureUnit(12, 3);
1251 }
1252
createMegapixel(UErrorCode & status)1253 MeasureUnit *MeasureUnit::createMegapixel(UErrorCode &status) {
1254 return MeasureUnit::create(12, 4, status);
1255 }
1256
getMegapixel()1257 MeasureUnit MeasureUnit::getMegapixel() {
1258 return MeasureUnit(12, 4);
1259 }
1260
createPixel(UErrorCode & status)1261 MeasureUnit *MeasureUnit::createPixel(UErrorCode &status) {
1262 return MeasureUnit::create(12, 5, status);
1263 }
1264
getPixel()1265 MeasureUnit MeasureUnit::getPixel() {
1266 return MeasureUnit(12, 5);
1267 }
1268
createPixelPerCentimeter(UErrorCode & status)1269 MeasureUnit *MeasureUnit::createPixelPerCentimeter(UErrorCode &status) {
1270 return MeasureUnit::create(12, 6, status);
1271 }
1272
getPixelPerCentimeter()1273 MeasureUnit MeasureUnit::getPixelPerCentimeter() {
1274 return MeasureUnit(12, 6);
1275 }
1276
createPixelPerInch(UErrorCode & status)1277 MeasureUnit *MeasureUnit::createPixelPerInch(UErrorCode &status) {
1278 return MeasureUnit::create(12, 7, status);
1279 }
1280
getPixelPerInch()1281 MeasureUnit MeasureUnit::getPixelPerInch() {
1282 return MeasureUnit(12, 7);
1283 }
1284
createAstronomicalUnit(UErrorCode & status)1285 MeasureUnit *MeasureUnit::createAstronomicalUnit(UErrorCode &status) {
1286 return MeasureUnit::create(13, 0, status);
1287 }
1288
getAstronomicalUnit()1289 MeasureUnit MeasureUnit::getAstronomicalUnit() {
1290 return MeasureUnit(13, 0);
1291 }
1292
createCentimeter(UErrorCode & status)1293 MeasureUnit *MeasureUnit::createCentimeter(UErrorCode &status) {
1294 return MeasureUnit::create(13, 1, status);
1295 }
1296
getCentimeter()1297 MeasureUnit MeasureUnit::getCentimeter() {
1298 return MeasureUnit(13, 1);
1299 }
1300
createDecimeter(UErrorCode & status)1301 MeasureUnit *MeasureUnit::createDecimeter(UErrorCode &status) {
1302 return MeasureUnit::create(13, 2, status);
1303 }
1304
getDecimeter()1305 MeasureUnit MeasureUnit::getDecimeter() {
1306 return MeasureUnit(13, 2);
1307 }
1308
createEarthRadius(UErrorCode & status)1309 MeasureUnit *MeasureUnit::createEarthRadius(UErrorCode &status) {
1310 return MeasureUnit::create(13, 3, status);
1311 }
1312
getEarthRadius()1313 MeasureUnit MeasureUnit::getEarthRadius() {
1314 return MeasureUnit(13, 3);
1315 }
1316
createFathom(UErrorCode & status)1317 MeasureUnit *MeasureUnit::createFathom(UErrorCode &status) {
1318 return MeasureUnit::create(13, 4, status);
1319 }
1320
getFathom()1321 MeasureUnit MeasureUnit::getFathom() {
1322 return MeasureUnit(13, 4);
1323 }
1324
createFoot(UErrorCode & status)1325 MeasureUnit *MeasureUnit::createFoot(UErrorCode &status) {
1326 return MeasureUnit::create(13, 5, status);
1327 }
1328
getFoot()1329 MeasureUnit MeasureUnit::getFoot() {
1330 return MeasureUnit(13, 5);
1331 }
1332
createFurlong(UErrorCode & status)1333 MeasureUnit *MeasureUnit::createFurlong(UErrorCode &status) {
1334 return MeasureUnit::create(13, 6, status);
1335 }
1336
getFurlong()1337 MeasureUnit MeasureUnit::getFurlong() {
1338 return MeasureUnit(13, 6);
1339 }
1340
createInch(UErrorCode & status)1341 MeasureUnit *MeasureUnit::createInch(UErrorCode &status) {
1342 return MeasureUnit::create(13, 7, status);
1343 }
1344
getInch()1345 MeasureUnit MeasureUnit::getInch() {
1346 return MeasureUnit(13, 7);
1347 }
1348
createKilometer(UErrorCode & status)1349 MeasureUnit *MeasureUnit::createKilometer(UErrorCode &status) {
1350 return MeasureUnit::create(13, 8, status);
1351 }
1352
getKilometer()1353 MeasureUnit MeasureUnit::getKilometer() {
1354 return MeasureUnit(13, 8);
1355 }
1356
createLightYear(UErrorCode & status)1357 MeasureUnit *MeasureUnit::createLightYear(UErrorCode &status) {
1358 return MeasureUnit::create(13, 9, status);
1359 }
1360
getLightYear()1361 MeasureUnit MeasureUnit::getLightYear() {
1362 return MeasureUnit(13, 9);
1363 }
1364
createMeter(UErrorCode & status)1365 MeasureUnit *MeasureUnit::createMeter(UErrorCode &status) {
1366 return MeasureUnit::create(13, 10, status);
1367 }
1368
getMeter()1369 MeasureUnit MeasureUnit::getMeter() {
1370 return MeasureUnit(13, 10);
1371 }
1372
createMicrometer(UErrorCode & status)1373 MeasureUnit *MeasureUnit::createMicrometer(UErrorCode &status) {
1374 return MeasureUnit::create(13, 11, status);
1375 }
1376
getMicrometer()1377 MeasureUnit MeasureUnit::getMicrometer() {
1378 return MeasureUnit(13, 11);
1379 }
1380
createMile(UErrorCode & status)1381 MeasureUnit *MeasureUnit::createMile(UErrorCode &status) {
1382 return MeasureUnit::create(13, 12, status);
1383 }
1384
getMile()1385 MeasureUnit MeasureUnit::getMile() {
1386 return MeasureUnit(13, 12);
1387 }
1388
createMileScandinavian(UErrorCode & status)1389 MeasureUnit *MeasureUnit::createMileScandinavian(UErrorCode &status) {
1390 return MeasureUnit::create(13, 13, status);
1391 }
1392
getMileScandinavian()1393 MeasureUnit MeasureUnit::getMileScandinavian() {
1394 return MeasureUnit(13, 13);
1395 }
1396
createMillimeter(UErrorCode & status)1397 MeasureUnit *MeasureUnit::createMillimeter(UErrorCode &status) {
1398 return MeasureUnit::create(13, 14, status);
1399 }
1400
getMillimeter()1401 MeasureUnit MeasureUnit::getMillimeter() {
1402 return MeasureUnit(13, 14);
1403 }
1404
createNanometer(UErrorCode & status)1405 MeasureUnit *MeasureUnit::createNanometer(UErrorCode &status) {
1406 return MeasureUnit::create(13, 15, status);
1407 }
1408
getNanometer()1409 MeasureUnit MeasureUnit::getNanometer() {
1410 return MeasureUnit(13, 15);
1411 }
1412
createNauticalMile(UErrorCode & status)1413 MeasureUnit *MeasureUnit::createNauticalMile(UErrorCode &status) {
1414 return MeasureUnit::create(13, 16, status);
1415 }
1416
getNauticalMile()1417 MeasureUnit MeasureUnit::getNauticalMile() {
1418 return MeasureUnit(13, 16);
1419 }
1420
createParsec(UErrorCode & status)1421 MeasureUnit *MeasureUnit::createParsec(UErrorCode &status) {
1422 return MeasureUnit::create(13, 17, status);
1423 }
1424
getParsec()1425 MeasureUnit MeasureUnit::getParsec() {
1426 return MeasureUnit(13, 17);
1427 }
1428
createPicometer(UErrorCode & status)1429 MeasureUnit *MeasureUnit::createPicometer(UErrorCode &status) {
1430 return MeasureUnit::create(13, 18, status);
1431 }
1432
getPicometer()1433 MeasureUnit MeasureUnit::getPicometer() {
1434 return MeasureUnit(13, 18);
1435 }
1436
createPoint(UErrorCode & status)1437 MeasureUnit *MeasureUnit::createPoint(UErrorCode &status) {
1438 return MeasureUnit::create(13, 19, status);
1439 }
1440
getPoint()1441 MeasureUnit MeasureUnit::getPoint() {
1442 return MeasureUnit(13, 19);
1443 }
1444
createSolarRadius(UErrorCode & status)1445 MeasureUnit *MeasureUnit::createSolarRadius(UErrorCode &status) {
1446 return MeasureUnit::create(13, 20, status);
1447 }
1448
getSolarRadius()1449 MeasureUnit MeasureUnit::getSolarRadius() {
1450 return MeasureUnit(13, 20);
1451 }
1452
createYard(UErrorCode & status)1453 MeasureUnit *MeasureUnit::createYard(UErrorCode &status) {
1454 return MeasureUnit::create(13, 21, status);
1455 }
1456
getYard()1457 MeasureUnit MeasureUnit::getYard() {
1458 return MeasureUnit(13, 21);
1459 }
1460
createCandela(UErrorCode & status)1461 MeasureUnit *MeasureUnit::createCandela(UErrorCode &status) {
1462 return MeasureUnit::create(14, 0, status);
1463 }
1464
getCandela()1465 MeasureUnit MeasureUnit::getCandela() {
1466 return MeasureUnit(14, 0);
1467 }
1468
createLumen(UErrorCode & status)1469 MeasureUnit *MeasureUnit::createLumen(UErrorCode &status) {
1470 return MeasureUnit::create(14, 1, status);
1471 }
1472
getLumen()1473 MeasureUnit MeasureUnit::getLumen() {
1474 return MeasureUnit(14, 1);
1475 }
1476
createLux(UErrorCode & status)1477 MeasureUnit *MeasureUnit::createLux(UErrorCode &status) {
1478 return MeasureUnit::create(14, 2, status);
1479 }
1480
getLux()1481 MeasureUnit MeasureUnit::getLux() {
1482 return MeasureUnit(14, 2);
1483 }
1484
createSolarLuminosity(UErrorCode & status)1485 MeasureUnit *MeasureUnit::createSolarLuminosity(UErrorCode &status) {
1486 return MeasureUnit::create(14, 3, status);
1487 }
1488
getSolarLuminosity()1489 MeasureUnit MeasureUnit::getSolarLuminosity() {
1490 return MeasureUnit(14, 3);
1491 }
1492
createCarat(UErrorCode & status)1493 MeasureUnit *MeasureUnit::createCarat(UErrorCode &status) {
1494 return MeasureUnit::create(15, 0, status);
1495 }
1496
getCarat()1497 MeasureUnit MeasureUnit::getCarat() {
1498 return MeasureUnit(15, 0);
1499 }
1500
createDalton(UErrorCode & status)1501 MeasureUnit *MeasureUnit::createDalton(UErrorCode &status) {
1502 return MeasureUnit::create(15, 1, status);
1503 }
1504
getDalton()1505 MeasureUnit MeasureUnit::getDalton() {
1506 return MeasureUnit(15, 1);
1507 }
1508
createEarthMass(UErrorCode & status)1509 MeasureUnit *MeasureUnit::createEarthMass(UErrorCode &status) {
1510 return MeasureUnit::create(15, 2, status);
1511 }
1512
getEarthMass()1513 MeasureUnit MeasureUnit::getEarthMass() {
1514 return MeasureUnit(15, 2);
1515 }
1516
createGrain(UErrorCode & status)1517 MeasureUnit *MeasureUnit::createGrain(UErrorCode &status) {
1518 return MeasureUnit::create(15, 3, status);
1519 }
1520
getGrain()1521 MeasureUnit MeasureUnit::getGrain() {
1522 return MeasureUnit(15, 3);
1523 }
1524
createGram(UErrorCode & status)1525 MeasureUnit *MeasureUnit::createGram(UErrorCode &status) {
1526 return MeasureUnit::create(15, 4, status);
1527 }
1528
getGram()1529 MeasureUnit MeasureUnit::getGram() {
1530 return MeasureUnit(15, 4);
1531 }
1532
createKilogram(UErrorCode & status)1533 MeasureUnit *MeasureUnit::createKilogram(UErrorCode &status) {
1534 return MeasureUnit::create(15, 5, status);
1535 }
1536
getKilogram()1537 MeasureUnit MeasureUnit::getKilogram() {
1538 return MeasureUnit(15, 5);
1539 }
1540
createMetricTon(UErrorCode & status)1541 MeasureUnit *MeasureUnit::createMetricTon(UErrorCode &status) {
1542 return MeasureUnit::create(15, 6, status);
1543 }
1544
getMetricTon()1545 MeasureUnit MeasureUnit::getMetricTon() {
1546 return MeasureUnit(15, 6);
1547 }
1548
createMicrogram(UErrorCode & status)1549 MeasureUnit *MeasureUnit::createMicrogram(UErrorCode &status) {
1550 return MeasureUnit::create(15, 7, status);
1551 }
1552
getMicrogram()1553 MeasureUnit MeasureUnit::getMicrogram() {
1554 return MeasureUnit(15, 7);
1555 }
1556
createMilligram(UErrorCode & status)1557 MeasureUnit *MeasureUnit::createMilligram(UErrorCode &status) {
1558 return MeasureUnit::create(15, 8, status);
1559 }
1560
getMilligram()1561 MeasureUnit MeasureUnit::getMilligram() {
1562 return MeasureUnit(15, 8);
1563 }
1564
createOunce(UErrorCode & status)1565 MeasureUnit *MeasureUnit::createOunce(UErrorCode &status) {
1566 return MeasureUnit::create(15, 9, status);
1567 }
1568
getOunce()1569 MeasureUnit MeasureUnit::getOunce() {
1570 return MeasureUnit(15, 9);
1571 }
1572
createOunceTroy(UErrorCode & status)1573 MeasureUnit *MeasureUnit::createOunceTroy(UErrorCode &status) {
1574 return MeasureUnit::create(15, 10, status);
1575 }
1576
getOunceTroy()1577 MeasureUnit MeasureUnit::getOunceTroy() {
1578 return MeasureUnit(15, 10);
1579 }
1580
createPound(UErrorCode & status)1581 MeasureUnit *MeasureUnit::createPound(UErrorCode &status) {
1582 return MeasureUnit::create(15, 11, status);
1583 }
1584
getPound()1585 MeasureUnit MeasureUnit::getPound() {
1586 return MeasureUnit(15, 11);
1587 }
1588
createSolarMass(UErrorCode & status)1589 MeasureUnit *MeasureUnit::createSolarMass(UErrorCode &status) {
1590 return MeasureUnit::create(15, 12, status);
1591 }
1592
getSolarMass()1593 MeasureUnit MeasureUnit::getSolarMass() {
1594 return MeasureUnit(15, 12);
1595 }
1596
createStone(UErrorCode & status)1597 MeasureUnit *MeasureUnit::createStone(UErrorCode &status) {
1598 return MeasureUnit::create(15, 13, status);
1599 }
1600
getStone()1601 MeasureUnit MeasureUnit::getStone() {
1602 return MeasureUnit(15, 13);
1603 }
1604
createTon(UErrorCode & status)1605 MeasureUnit *MeasureUnit::createTon(UErrorCode &status) {
1606 return MeasureUnit::create(15, 14, status);
1607 }
1608
getTon()1609 MeasureUnit MeasureUnit::getTon() {
1610 return MeasureUnit(15, 14);
1611 }
1612
createGigawatt(UErrorCode & status)1613 MeasureUnit *MeasureUnit::createGigawatt(UErrorCode &status) {
1614 return MeasureUnit::create(17, 0, status);
1615 }
1616
getGigawatt()1617 MeasureUnit MeasureUnit::getGigawatt() {
1618 return MeasureUnit(17, 0);
1619 }
1620
createHorsepower(UErrorCode & status)1621 MeasureUnit *MeasureUnit::createHorsepower(UErrorCode &status) {
1622 return MeasureUnit::create(17, 1, status);
1623 }
1624
getHorsepower()1625 MeasureUnit MeasureUnit::getHorsepower() {
1626 return MeasureUnit(17, 1);
1627 }
1628
createKilowatt(UErrorCode & status)1629 MeasureUnit *MeasureUnit::createKilowatt(UErrorCode &status) {
1630 return MeasureUnit::create(17, 2, status);
1631 }
1632
getKilowatt()1633 MeasureUnit MeasureUnit::getKilowatt() {
1634 return MeasureUnit(17, 2);
1635 }
1636
createMegawatt(UErrorCode & status)1637 MeasureUnit *MeasureUnit::createMegawatt(UErrorCode &status) {
1638 return MeasureUnit::create(17, 3, status);
1639 }
1640
getMegawatt()1641 MeasureUnit MeasureUnit::getMegawatt() {
1642 return MeasureUnit(17, 3);
1643 }
1644
createMilliwatt(UErrorCode & status)1645 MeasureUnit *MeasureUnit::createMilliwatt(UErrorCode &status) {
1646 return MeasureUnit::create(17, 4, status);
1647 }
1648
getMilliwatt()1649 MeasureUnit MeasureUnit::getMilliwatt() {
1650 return MeasureUnit(17, 4);
1651 }
1652
createWatt(UErrorCode & status)1653 MeasureUnit *MeasureUnit::createWatt(UErrorCode &status) {
1654 return MeasureUnit::create(17, 5, status);
1655 }
1656
getWatt()1657 MeasureUnit MeasureUnit::getWatt() {
1658 return MeasureUnit(17, 5);
1659 }
1660
createAtmosphere(UErrorCode & status)1661 MeasureUnit *MeasureUnit::createAtmosphere(UErrorCode &status) {
1662 return MeasureUnit::create(18, 0, status);
1663 }
1664
getAtmosphere()1665 MeasureUnit MeasureUnit::getAtmosphere() {
1666 return MeasureUnit(18, 0);
1667 }
1668
createBar(UErrorCode & status)1669 MeasureUnit *MeasureUnit::createBar(UErrorCode &status) {
1670 return MeasureUnit::create(18, 1, status);
1671 }
1672
getBar()1673 MeasureUnit MeasureUnit::getBar() {
1674 return MeasureUnit(18, 1);
1675 }
1676
createHectopascal(UErrorCode & status)1677 MeasureUnit *MeasureUnit::createHectopascal(UErrorCode &status) {
1678 return MeasureUnit::create(18, 2, status);
1679 }
1680
getHectopascal()1681 MeasureUnit MeasureUnit::getHectopascal() {
1682 return MeasureUnit(18, 2);
1683 }
1684
createInchHg(UErrorCode & status)1685 MeasureUnit *MeasureUnit::createInchHg(UErrorCode &status) {
1686 return MeasureUnit::create(18, 3, status);
1687 }
1688
getInchHg()1689 MeasureUnit MeasureUnit::getInchHg() {
1690 return MeasureUnit(18, 3);
1691 }
1692
createKilopascal(UErrorCode & status)1693 MeasureUnit *MeasureUnit::createKilopascal(UErrorCode &status) {
1694 return MeasureUnit::create(18, 4, status);
1695 }
1696
getKilopascal()1697 MeasureUnit MeasureUnit::getKilopascal() {
1698 return MeasureUnit(18, 4);
1699 }
1700
createMegapascal(UErrorCode & status)1701 MeasureUnit *MeasureUnit::createMegapascal(UErrorCode &status) {
1702 return MeasureUnit::create(18, 5, status);
1703 }
1704
getMegapascal()1705 MeasureUnit MeasureUnit::getMegapascal() {
1706 return MeasureUnit(18, 5);
1707 }
1708
createMillibar(UErrorCode & status)1709 MeasureUnit *MeasureUnit::createMillibar(UErrorCode &status) {
1710 return MeasureUnit::create(18, 6, status);
1711 }
1712
getMillibar()1713 MeasureUnit MeasureUnit::getMillibar() {
1714 return MeasureUnit(18, 6);
1715 }
1716
createMillimeterOfMercury(UErrorCode & status)1717 MeasureUnit *MeasureUnit::createMillimeterOfMercury(UErrorCode &status) {
1718 return MeasureUnit::create(18, 7, status);
1719 }
1720
getMillimeterOfMercury()1721 MeasureUnit MeasureUnit::getMillimeterOfMercury() {
1722 return MeasureUnit(18, 7);
1723 }
1724
createPascal(UErrorCode & status)1725 MeasureUnit *MeasureUnit::createPascal(UErrorCode &status) {
1726 return MeasureUnit::create(18, 8, status);
1727 }
1728
getPascal()1729 MeasureUnit MeasureUnit::getPascal() {
1730 return MeasureUnit(18, 8);
1731 }
1732
createPoundPerSquareInch(UErrorCode & status)1733 MeasureUnit *MeasureUnit::createPoundPerSquareInch(UErrorCode &status) {
1734 return MeasureUnit::create(18, 9, status);
1735 }
1736
getPoundPerSquareInch()1737 MeasureUnit MeasureUnit::getPoundPerSquareInch() {
1738 return MeasureUnit(18, 9);
1739 }
1740
createKilometerPerHour(UErrorCode & status)1741 MeasureUnit *MeasureUnit::createKilometerPerHour(UErrorCode &status) {
1742 return MeasureUnit::create(19, 0, status);
1743 }
1744
getKilometerPerHour()1745 MeasureUnit MeasureUnit::getKilometerPerHour() {
1746 return MeasureUnit(19, 0);
1747 }
1748
createKnot(UErrorCode & status)1749 MeasureUnit *MeasureUnit::createKnot(UErrorCode &status) {
1750 return MeasureUnit::create(19, 1, status);
1751 }
1752
getKnot()1753 MeasureUnit MeasureUnit::getKnot() {
1754 return MeasureUnit(19, 1);
1755 }
1756
createMeterPerSecond(UErrorCode & status)1757 MeasureUnit *MeasureUnit::createMeterPerSecond(UErrorCode &status) {
1758 return MeasureUnit::create(19, 2, status);
1759 }
1760
getMeterPerSecond()1761 MeasureUnit MeasureUnit::getMeterPerSecond() {
1762 return MeasureUnit(19, 2);
1763 }
1764
createMilePerHour(UErrorCode & status)1765 MeasureUnit *MeasureUnit::createMilePerHour(UErrorCode &status) {
1766 return MeasureUnit::create(19, 3, status);
1767 }
1768
getMilePerHour()1769 MeasureUnit MeasureUnit::getMilePerHour() {
1770 return MeasureUnit(19, 3);
1771 }
1772
createCelsius(UErrorCode & status)1773 MeasureUnit *MeasureUnit::createCelsius(UErrorCode &status) {
1774 return MeasureUnit::create(20, 0, status);
1775 }
1776
getCelsius()1777 MeasureUnit MeasureUnit::getCelsius() {
1778 return MeasureUnit(20, 0);
1779 }
1780
createFahrenheit(UErrorCode & status)1781 MeasureUnit *MeasureUnit::createFahrenheit(UErrorCode &status) {
1782 return MeasureUnit::create(20, 1, status);
1783 }
1784
getFahrenheit()1785 MeasureUnit MeasureUnit::getFahrenheit() {
1786 return MeasureUnit(20, 1);
1787 }
1788
createGenericTemperature(UErrorCode & status)1789 MeasureUnit *MeasureUnit::createGenericTemperature(UErrorCode &status) {
1790 return MeasureUnit::create(20, 2, status);
1791 }
1792
getGenericTemperature()1793 MeasureUnit MeasureUnit::getGenericTemperature() {
1794 return MeasureUnit(20, 2);
1795 }
1796
createKelvin(UErrorCode & status)1797 MeasureUnit *MeasureUnit::createKelvin(UErrorCode &status) {
1798 return MeasureUnit::create(20, 3, status);
1799 }
1800
getKelvin()1801 MeasureUnit MeasureUnit::getKelvin() {
1802 return MeasureUnit(20, 3);
1803 }
1804
createNewtonMeter(UErrorCode & status)1805 MeasureUnit *MeasureUnit::createNewtonMeter(UErrorCode &status) {
1806 return MeasureUnit::create(21, 0, status);
1807 }
1808
getNewtonMeter()1809 MeasureUnit MeasureUnit::getNewtonMeter() {
1810 return MeasureUnit(21, 0);
1811 }
1812
createPoundFoot(UErrorCode & status)1813 MeasureUnit *MeasureUnit::createPoundFoot(UErrorCode &status) {
1814 return MeasureUnit::create(21, 1, status);
1815 }
1816
getPoundFoot()1817 MeasureUnit MeasureUnit::getPoundFoot() {
1818 return MeasureUnit(21, 1);
1819 }
1820
createAcreFoot(UErrorCode & status)1821 MeasureUnit *MeasureUnit::createAcreFoot(UErrorCode &status) {
1822 return MeasureUnit::create(22, 0, status);
1823 }
1824
getAcreFoot()1825 MeasureUnit MeasureUnit::getAcreFoot() {
1826 return MeasureUnit(22, 0);
1827 }
1828
createBarrel(UErrorCode & status)1829 MeasureUnit *MeasureUnit::createBarrel(UErrorCode &status) {
1830 return MeasureUnit::create(22, 1, status);
1831 }
1832
getBarrel()1833 MeasureUnit MeasureUnit::getBarrel() {
1834 return MeasureUnit(22, 1);
1835 }
1836
createBushel(UErrorCode & status)1837 MeasureUnit *MeasureUnit::createBushel(UErrorCode &status) {
1838 return MeasureUnit::create(22, 2, status);
1839 }
1840
getBushel()1841 MeasureUnit MeasureUnit::getBushel() {
1842 return MeasureUnit(22, 2);
1843 }
1844
createCentiliter(UErrorCode & status)1845 MeasureUnit *MeasureUnit::createCentiliter(UErrorCode &status) {
1846 return MeasureUnit::create(22, 3, status);
1847 }
1848
getCentiliter()1849 MeasureUnit MeasureUnit::getCentiliter() {
1850 return MeasureUnit(22, 3);
1851 }
1852
createCubicCentimeter(UErrorCode & status)1853 MeasureUnit *MeasureUnit::createCubicCentimeter(UErrorCode &status) {
1854 return MeasureUnit::create(22, 4, status);
1855 }
1856
getCubicCentimeter()1857 MeasureUnit MeasureUnit::getCubicCentimeter() {
1858 return MeasureUnit(22, 4);
1859 }
1860
createCubicFoot(UErrorCode & status)1861 MeasureUnit *MeasureUnit::createCubicFoot(UErrorCode &status) {
1862 return MeasureUnit::create(22, 5, status);
1863 }
1864
getCubicFoot()1865 MeasureUnit MeasureUnit::getCubicFoot() {
1866 return MeasureUnit(22, 5);
1867 }
1868
createCubicInch(UErrorCode & status)1869 MeasureUnit *MeasureUnit::createCubicInch(UErrorCode &status) {
1870 return MeasureUnit::create(22, 6, status);
1871 }
1872
getCubicInch()1873 MeasureUnit MeasureUnit::getCubicInch() {
1874 return MeasureUnit(22, 6);
1875 }
1876
createCubicKilometer(UErrorCode & status)1877 MeasureUnit *MeasureUnit::createCubicKilometer(UErrorCode &status) {
1878 return MeasureUnit::create(22, 7, status);
1879 }
1880
getCubicKilometer()1881 MeasureUnit MeasureUnit::getCubicKilometer() {
1882 return MeasureUnit(22, 7);
1883 }
1884
createCubicMeter(UErrorCode & status)1885 MeasureUnit *MeasureUnit::createCubicMeter(UErrorCode &status) {
1886 return MeasureUnit::create(22, 8, status);
1887 }
1888
getCubicMeter()1889 MeasureUnit MeasureUnit::getCubicMeter() {
1890 return MeasureUnit(22, 8);
1891 }
1892
createCubicMile(UErrorCode & status)1893 MeasureUnit *MeasureUnit::createCubicMile(UErrorCode &status) {
1894 return MeasureUnit::create(22, 9, status);
1895 }
1896
getCubicMile()1897 MeasureUnit MeasureUnit::getCubicMile() {
1898 return MeasureUnit(22, 9);
1899 }
1900
createCubicYard(UErrorCode & status)1901 MeasureUnit *MeasureUnit::createCubicYard(UErrorCode &status) {
1902 return MeasureUnit::create(22, 10, status);
1903 }
1904
getCubicYard()1905 MeasureUnit MeasureUnit::getCubicYard() {
1906 return MeasureUnit(22, 10);
1907 }
1908
createCup(UErrorCode & status)1909 MeasureUnit *MeasureUnit::createCup(UErrorCode &status) {
1910 return MeasureUnit::create(22, 11, status);
1911 }
1912
getCup()1913 MeasureUnit MeasureUnit::getCup() {
1914 return MeasureUnit(22, 11);
1915 }
1916
createCupMetric(UErrorCode & status)1917 MeasureUnit *MeasureUnit::createCupMetric(UErrorCode &status) {
1918 return MeasureUnit::create(22, 12, status);
1919 }
1920
getCupMetric()1921 MeasureUnit MeasureUnit::getCupMetric() {
1922 return MeasureUnit(22, 12);
1923 }
1924
createDeciliter(UErrorCode & status)1925 MeasureUnit *MeasureUnit::createDeciliter(UErrorCode &status) {
1926 return MeasureUnit::create(22, 13, status);
1927 }
1928
getDeciliter()1929 MeasureUnit MeasureUnit::getDeciliter() {
1930 return MeasureUnit(22, 13);
1931 }
1932
createDessertSpoon(UErrorCode & status)1933 MeasureUnit *MeasureUnit::createDessertSpoon(UErrorCode &status) {
1934 return MeasureUnit::create(22, 14, status);
1935 }
1936
getDessertSpoon()1937 MeasureUnit MeasureUnit::getDessertSpoon() {
1938 return MeasureUnit(22, 14);
1939 }
1940
createDessertSpoonImperial(UErrorCode & status)1941 MeasureUnit *MeasureUnit::createDessertSpoonImperial(UErrorCode &status) {
1942 return MeasureUnit::create(22, 15, status);
1943 }
1944
getDessertSpoonImperial()1945 MeasureUnit MeasureUnit::getDessertSpoonImperial() {
1946 return MeasureUnit(22, 15);
1947 }
1948
createDram(UErrorCode & status)1949 MeasureUnit *MeasureUnit::createDram(UErrorCode &status) {
1950 return MeasureUnit::create(22, 16, status);
1951 }
1952
getDram()1953 MeasureUnit MeasureUnit::getDram() {
1954 return MeasureUnit(22, 16);
1955 }
1956
createDrop(UErrorCode & status)1957 MeasureUnit *MeasureUnit::createDrop(UErrorCode &status) {
1958 return MeasureUnit::create(22, 17, status);
1959 }
1960
getDrop()1961 MeasureUnit MeasureUnit::getDrop() {
1962 return MeasureUnit(22, 17);
1963 }
1964
createFluidOunce(UErrorCode & status)1965 MeasureUnit *MeasureUnit::createFluidOunce(UErrorCode &status) {
1966 return MeasureUnit::create(22, 18, status);
1967 }
1968
getFluidOunce()1969 MeasureUnit MeasureUnit::getFluidOunce() {
1970 return MeasureUnit(22, 18);
1971 }
1972
createFluidOunceImperial(UErrorCode & status)1973 MeasureUnit *MeasureUnit::createFluidOunceImperial(UErrorCode &status) {
1974 return MeasureUnit::create(22, 19, status);
1975 }
1976
getFluidOunceImperial()1977 MeasureUnit MeasureUnit::getFluidOunceImperial() {
1978 return MeasureUnit(22, 19);
1979 }
1980
createGallon(UErrorCode & status)1981 MeasureUnit *MeasureUnit::createGallon(UErrorCode &status) {
1982 return MeasureUnit::create(22, 20, status);
1983 }
1984
getGallon()1985 MeasureUnit MeasureUnit::getGallon() {
1986 return MeasureUnit(22, 20);
1987 }
1988
createGallonImperial(UErrorCode & status)1989 MeasureUnit *MeasureUnit::createGallonImperial(UErrorCode &status) {
1990 return MeasureUnit::create(22, 21, status);
1991 }
1992
getGallonImperial()1993 MeasureUnit MeasureUnit::getGallonImperial() {
1994 return MeasureUnit(22, 21);
1995 }
1996
createHectoliter(UErrorCode & status)1997 MeasureUnit *MeasureUnit::createHectoliter(UErrorCode &status) {
1998 return MeasureUnit::create(22, 22, status);
1999 }
2000
getHectoliter()2001 MeasureUnit MeasureUnit::getHectoliter() {
2002 return MeasureUnit(22, 22);
2003 }
2004
createJigger(UErrorCode & status)2005 MeasureUnit *MeasureUnit::createJigger(UErrorCode &status) {
2006 return MeasureUnit::create(22, 23, status);
2007 }
2008
getJigger()2009 MeasureUnit MeasureUnit::getJigger() {
2010 return MeasureUnit(22, 23);
2011 }
2012
createLiter(UErrorCode & status)2013 MeasureUnit *MeasureUnit::createLiter(UErrorCode &status) {
2014 return MeasureUnit::create(22, 24, status);
2015 }
2016
getLiter()2017 MeasureUnit MeasureUnit::getLiter() {
2018 return MeasureUnit(22, 24);
2019 }
2020
createMegaliter(UErrorCode & status)2021 MeasureUnit *MeasureUnit::createMegaliter(UErrorCode &status) {
2022 return MeasureUnit::create(22, 25, status);
2023 }
2024
getMegaliter()2025 MeasureUnit MeasureUnit::getMegaliter() {
2026 return MeasureUnit(22, 25);
2027 }
2028
createMilliliter(UErrorCode & status)2029 MeasureUnit *MeasureUnit::createMilliliter(UErrorCode &status) {
2030 return MeasureUnit::create(22, 26, status);
2031 }
2032
getMilliliter()2033 MeasureUnit MeasureUnit::getMilliliter() {
2034 return MeasureUnit(22, 26);
2035 }
2036
createPinch(UErrorCode & status)2037 MeasureUnit *MeasureUnit::createPinch(UErrorCode &status) {
2038 return MeasureUnit::create(22, 27, status);
2039 }
2040
getPinch()2041 MeasureUnit MeasureUnit::getPinch() {
2042 return MeasureUnit(22, 27);
2043 }
2044
createPint(UErrorCode & status)2045 MeasureUnit *MeasureUnit::createPint(UErrorCode &status) {
2046 return MeasureUnit::create(22, 28, status);
2047 }
2048
getPint()2049 MeasureUnit MeasureUnit::getPint() {
2050 return MeasureUnit(22, 28);
2051 }
2052
createPintMetric(UErrorCode & status)2053 MeasureUnit *MeasureUnit::createPintMetric(UErrorCode &status) {
2054 return MeasureUnit::create(22, 29, status);
2055 }
2056
getPintMetric()2057 MeasureUnit MeasureUnit::getPintMetric() {
2058 return MeasureUnit(22, 29);
2059 }
2060
createQuart(UErrorCode & status)2061 MeasureUnit *MeasureUnit::createQuart(UErrorCode &status) {
2062 return MeasureUnit::create(22, 30, status);
2063 }
2064
getQuart()2065 MeasureUnit MeasureUnit::getQuart() {
2066 return MeasureUnit(22, 30);
2067 }
2068
createQuartImperial(UErrorCode & status)2069 MeasureUnit *MeasureUnit::createQuartImperial(UErrorCode &status) {
2070 return MeasureUnit::create(22, 31, status);
2071 }
2072
getQuartImperial()2073 MeasureUnit MeasureUnit::getQuartImperial() {
2074 return MeasureUnit(22, 31);
2075 }
2076
createTablespoon(UErrorCode & status)2077 MeasureUnit *MeasureUnit::createTablespoon(UErrorCode &status) {
2078 return MeasureUnit::create(22, 32, status);
2079 }
2080
getTablespoon()2081 MeasureUnit MeasureUnit::getTablespoon() {
2082 return MeasureUnit(22, 32);
2083 }
2084
createTeaspoon(UErrorCode & status)2085 MeasureUnit *MeasureUnit::createTeaspoon(UErrorCode &status) {
2086 return MeasureUnit::create(22, 33, status);
2087 }
2088
getTeaspoon()2089 MeasureUnit MeasureUnit::getTeaspoon() {
2090 return MeasureUnit(22, 33);
2091 }
2092
2093 // End generated code
2094
binarySearch(const char * const * array,int32_t start,int32_t end,StringPiece key)2095 static int32_t binarySearch(
2096 const char * const * array, int32_t start, int32_t end, StringPiece key) {
2097 while (start < end) {
2098 int32_t mid = (start + end) / 2;
2099 int32_t cmp = StringPiece(array[mid]).compare(key);
2100 if (cmp < 0) {
2101 start = mid + 1;
2102 continue;
2103 }
2104 if (cmp == 0) {
2105 return mid;
2106 }
2107 end = mid;
2108 }
2109 return -1;
2110 }
2111
MeasureUnit()2112 MeasureUnit::MeasureUnit() : MeasureUnit(kBaseTypeIdx, kBaseSubTypeIdx) {
2113 }
2114
MeasureUnit(int32_t typeId,int32_t subTypeId)2115 MeasureUnit::MeasureUnit(int32_t typeId, int32_t subTypeId)
2116 : fImpl(nullptr), fSubTypeId(subTypeId), fTypeId(typeId) {
2117 }
2118
MeasureUnit(const MeasureUnit & other)2119 MeasureUnit::MeasureUnit(const MeasureUnit &other)
2120 : fImpl(nullptr) {
2121 *this = other;
2122 }
2123
MeasureUnit(MeasureUnit && other)2124 MeasureUnit::MeasureUnit(MeasureUnit &&other) noexcept
2125 : fImpl(other.fImpl),
2126 fSubTypeId(other.fSubTypeId),
2127 fTypeId(other.fTypeId) {
2128 other.fImpl = nullptr;
2129 }
2130
MeasureUnit(MeasureUnitImpl && impl)2131 MeasureUnit::MeasureUnit(MeasureUnitImpl&& impl)
2132 : fImpl(nullptr), fSubTypeId(-1), fTypeId(-1) {
2133 if (!findBySubType(impl.identifier.toStringPiece(), this)) {
2134 fImpl = new MeasureUnitImpl(std::move(impl));
2135 }
2136 }
2137
operator =(const MeasureUnit & other)2138 MeasureUnit &MeasureUnit::operator=(const MeasureUnit &other) {
2139 if (this == &other) {
2140 return *this;
2141 }
2142 if (fImpl != nullptr) {
2143 delete fImpl;
2144 }
2145 if (other.fImpl) {
2146 ErrorCode localStatus;
2147 fImpl = new MeasureUnitImpl(other.fImpl->copy(localStatus));
2148 if (!fImpl || localStatus.isFailure()) {
2149 // Unrecoverable allocation error; set to the default unit
2150 *this = MeasureUnit();
2151 return *this;
2152 }
2153 } else {
2154 fImpl = nullptr;
2155 }
2156 fTypeId = other.fTypeId;
2157 fSubTypeId = other.fSubTypeId;
2158 return *this;
2159 }
2160
operator =(MeasureUnit && other)2161 MeasureUnit &MeasureUnit::operator=(MeasureUnit &&other) noexcept {
2162 if (this == &other) {
2163 return *this;
2164 }
2165 if (fImpl != nullptr) {
2166 delete fImpl;
2167 }
2168 fImpl = other.fImpl;
2169 other.fImpl = nullptr;
2170 fTypeId = other.fTypeId;
2171 fSubTypeId = other.fSubTypeId;
2172 return *this;
2173 }
2174
clone() const2175 MeasureUnit *MeasureUnit::clone() const {
2176 return new MeasureUnit(*this);
2177 }
2178
~MeasureUnit()2179 MeasureUnit::~MeasureUnit() {
2180 if (fImpl != nullptr) {
2181 delete fImpl;
2182 fImpl = nullptr;
2183 }
2184 }
2185
getType() const2186 const char *MeasureUnit::getType() const {
2187 // We have a type & subtype only if fTypeId is present.
2188 if (fTypeId == -1) {
2189 return "";
2190 }
2191 return gTypes[fTypeId];
2192 }
2193
getSubtype() const2194 const char *MeasureUnit::getSubtype() const {
2195 // We have a type & subtype only if fTypeId is present.
2196 if (fTypeId == -1) {
2197 return "";
2198 }
2199 return getIdentifier();
2200 }
2201
getIdentifier() const2202 const char *MeasureUnit::getIdentifier() const {
2203 return fImpl ? fImpl->identifier.data() : gSubTypes[getOffset()];
2204 }
2205
operator ==(const UObject & other) const2206 UBool MeasureUnit::operator==(const UObject& other) const {
2207 if (this == &other) { // Same object, equal
2208 return TRUE;
2209 }
2210 if (typeid(*this) != typeid(other)) { // Different types, not equal
2211 return FALSE;
2212 }
2213 const MeasureUnit &rhs = static_cast<const MeasureUnit&>(other);
2214 return uprv_strcmp(getIdentifier(), rhs.getIdentifier()) == 0;
2215 }
2216
getAvailable(MeasureUnit * dest,int32_t destCapacity,UErrorCode & errorCode)2217 int32_t MeasureUnit::getAvailable(
2218 MeasureUnit *dest,
2219 int32_t destCapacity,
2220 UErrorCode &errorCode) {
2221 if (U_FAILURE(errorCode)) {
2222 return 0;
2223 }
2224 if (destCapacity < UPRV_LENGTHOF(gSubTypes)) {
2225 errorCode = U_BUFFER_OVERFLOW_ERROR;
2226 return UPRV_LENGTHOF(gSubTypes);
2227 }
2228 int32_t idx = 0;
2229 for (int32_t typeIdx = 0; typeIdx < UPRV_LENGTHOF(gTypes); ++typeIdx) {
2230 int32_t len = gOffsets[typeIdx + 1] - gOffsets[typeIdx];
2231 for (int32_t subTypeIdx = 0; subTypeIdx < len; ++subTypeIdx) {
2232 dest[idx].setTo(typeIdx, subTypeIdx);
2233 ++idx;
2234 }
2235 }
2236 U_ASSERT(idx == UPRV_LENGTHOF(gSubTypes));
2237 return UPRV_LENGTHOF(gSubTypes);
2238 }
2239
getAvailable(const char * type,MeasureUnit * dest,int32_t destCapacity,UErrorCode & errorCode)2240 int32_t MeasureUnit::getAvailable(
2241 const char *type,
2242 MeasureUnit *dest,
2243 int32_t destCapacity,
2244 UErrorCode &errorCode) {
2245 if (U_FAILURE(errorCode)) {
2246 return 0;
2247 }
2248 int32_t typeIdx = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), type);
2249 if (typeIdx == -1) {
2250 return 0;
2251 }
2252 int32_t len = gOffsets[typeIdx + 1] - gOffsets[typeIdx];
2253 if (destCapacity < len) {
2254 errorCode = U_BUFFER_OVERFLOW_ERROR;
2255 return len;
2256 }
2257 for (int subTypeIdx = 0; subTypeIdx < len; ++subTypeIdx) {
2258 dest[subTypeIdx].setTo(typeIdx, subTypeIdx);
2259 }
2260 return len;
2261 }
2262
getAvailableTypes(UErrorCode & errorCode)2263 StringEnumeration* MeasureUnit::getAvailableTypes(UErrorCode &errorCode) {
2264 UEnumeration *uenum = uenum_openCharStringsEnumeration(
2265 gTypes, UPRV_LENGTHOF(gTypes), &errorCode);
2266 if (U_FAILURE(errorCode)) {
2267 uenum_close(uenum);
2268 return NULL;
2269 }
2270 StringEnumeration *result = new UStringEnumeration(uenum);
2271 if (result == NULL) {
2272 errorCode = U_MEMORY_ALLOCATION_ERROR;
2273 uenum_close(uenum);
2274 return NULL;
2275 }
2276 return result;
2277 }
2278
findBySubType(StringPiece subType,MeasureUnit * output)2279 bool MeasureUnit::findBySubType(StringPiece subType, MeasureUnit* output) {
2280 for (int32_t t = 0; t < UPRV_LENGTHOF(gOffsets) - 1; t++) {
2281 // Ensure kCurrencyOffset is set correctly
2282 U_ASSERT(uprv_strcmp(gTypes[kCurrencyOffset], "currency") == 0);
2283 // Skip currency units
2284 if (t == kCurrencyOffset) {
2285 continue;
2286 }
2287 int32_t st = binarySearch(gSubTypes, gOffsets[t], gOffsets[t + 1], subType);
2288 if (st >= 0) {
2289 output->setTo(t, st - gOffsets[t]);
2290 return true;
2291 }
2292 }
2293 return false;
2294 }
2295
create(int typeId,int subTypeId,UErrorCode & status)2296 MeasureUnit *MeasureUnit::create(int typeId, int subTypeId, UErrorCode &status) {
2297 if (U_FAILURE(status)) {
2298 return NULL;
2299 }
2300 MeasureUnit *result = new MeasureUnit(typeId, subTypeId);
2301 if (result == NULL) {
2302 status = U_MEMORY_ALLOCATION_ERROR;
2303 }
2304 return result;
2305 }
2306
initTime(const char * timeId)2307 void MeasureUnit::initTime(const char *timeId) {
2308 int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "duration");
2309 U_ASSERT(result != -1);
2310 fTypeId = result;
2311 result = binarySearch(gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], timeId);
2312 U_ASSERT(result != -1);
2313 fSubTypeId = result - gOffsets[fTypeId];
2314 }
2315
initCurrency(StringPiece isoCurrency)2316 void MeasureUnit::initCurrency(StringPiece isoCurrency) {
2317 int32_t result = binarySearch(gTypes, 0, UPRV_LENGTHOF(gTypes), "currency");
2318 U_ASSERT(result != -1);
2319 fTypeId = result;
2320 result = binarySearch(
2321 gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], isoCurrency);
2322 if (result == -1) {
2323 fImpl = new MeasureUnitImpl(MeasureUnitImpl::forCurrencyCode(isoCurrency));
2324 if (fImpl) {
2325 fSubTypeId = -1;
2326 return;
2327 }
2328 // malloc error: fall back to the undefined currency
2329 result = binarySearch(
2330 gSubTypes, gOffsets[fTypeId], gOffsets[fTypeId + 1], kDefaultCurrency8);
2331 U_ASSERT(result != -1);
2332 }
2333 fSubTypeId = result - gOffsets[fTypeId];
2334 }
2335
setTo(int32_t typeId,int32_t subTypeId)2336 void MeasureUnit::setTo(int32_t typeId, int32_t subTypeId) {
2337 fTypeId = typeId;
2338 fSubTypeId = subTypeId;
2339 if (fImpl != nullptr) {
2340 delete fImpl;
2341 fImpl = nullptr;
2342 }
2343 }
2344
getOffset() const2345 int32_t MeasureUnit::getOffset() const {
2346 if (fTypeId < 0 || fSubTypeId < 0) {
2347 return -1;
2348 }
2349 return gOffsets[fTypeId] + fSubTypeId;
2350 }
2351
copy(UErrorCode & status) const2352 MeasureUnitImpl MeasureUnitImpl::copy(UErrorCode &status) const {
2353 MeasureUnitImpl result;
2354 result.complexity = complexity;
2355 result.identifier.append(identifier, status);
2356 for (int32_t i = 0; i < units.length(); i++) {
2357 SingleUnitImpl *item = result.units.emplaceBack(*units[i]);
2358 if (!item) {
2359 status = U_MEMORY_ALLOCATION_ERROR;
2360 return result;
2361 }
2362 }
2363 return result;
2364 }
2365
2366 U_NAMESPACE_END
2367
2368 #endif /* !UNCONFIG_NO_FORMATTING */
2369