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