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 | |
24 | U_NAMESPACE_BEGIN |
25 | |
26 | UOBJECT_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 | |
37 | static 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 | |
64 | static 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. |
92 | static 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. |
119 | static 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. |
597 | static 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 |
611 | static const int32_t kBaseTypeIdx = 16; |
612 | static const int32_t kBaseSubTypeIdx = 0; |
613 | |
614 | MeasureUnit *MeasureUnit::createGForce(UErrorCode &status) { |
615 | return MeasureUnit::create(0, 0, status); |
616 | } |
617 | |
618 | MeasureUnit MeasureUnit::getGForce() { |
619 | return MeasureUnit(0, 0); |
620 | } |
621 | |
622 | MeasureUnit *MeasureUnit::createMeterPerSecondSquared(UErrorCode &status) { |
623 | return MeasureUnit::create(0, 1, status); |
624 | } |
625 | |
626 | MeasureUnit MeasureUnit::getMeterPerSecondSquared() { |
627 | return MeasureUnit(0, 1); |
628 | } |
629 | |
630 | MeasureUnit *MeasureUnit::createArcMinute(UErrorCode &status) { |
631 | return MeasureUnit::create(1, 0, status); |
632 | } |
633 | |
634 | MeasureUnit MeasureUnit::getArcMinute() { |
635 | return MeasureUnit(1, 0); |
636 | } |
637 | |
638 | MeasureUnit *MeasureUnit::createArcSecond(UErrorCode &status) { |
639 | return MeasureUnit::create(1, 1, status); |
640 | } |
641 | |
642 | MeasureUnit MeasureUnit::getArcSecond() { |
643 | return MeasureUnit(1, 1); |
644 | } |
645 | |
646 | MeasureUnit *MeasureUnit::createDegree(UErrorCode &status) { |
647 | return MeasureUnit::create(1, 2, status); |
648 | } |
649 | |
650 | MeasureUnit MeasureUnit::getDegree() { |
651 | return MeasureUnit(1, 2); |
652 | } |
653 | |
654 | MeasureUnit *MeasureUnit::createRadian(UErrorCode &status) { |
655 | return MeasureUnit::create(1, 3, status); |
656 | } |
657 | |
658 | MeasureUnit MeasureUnit::getRadian() { |
659 | return MeasureUnit(1, 3); |
660 | } |
661 | |
662 | MeasureUnit *MeasureUnit::createRevolutionAngle(UErrorCode &status) { |
663 | return MeasureUnit::create(1, 4, status); |
664 | } |
665 | |
666 | MeasureUnit MeasureUnit::getRevolutionAngle() { |
667 | return MeasureUnit(1, 4); |
668 | } |
669 | |
670 | MeasureUnit *MeasureUnit::createAcre(UErrorCode &status) { |
671 | return MeasureUnit::create(2, 0, status); |
672 | } |
673 | |
674 | MeasureUnit MeasureUnit::getAcre() { |
675 | return MeasureUnit(2, 0); |
676 | } |
677 | |
678 | MeasureUnit *MeasureUnit::createDunam(UErrorCode &status) { |
679 | return MeasureUnit::create(2, 1, status); |
680 | } |
681 | |
682 | MeasureUnit MeasureUnit::getDunam() { |
683 | return MeasureUnit(2, 1); |
684 | } |
685 | |
686 | MeasureUnit *MeasureUnit::createHectare(UErrorCode &status) { |
687 | return MeasureUnit::create(2, 2, status); |
688 | } |
689 | |
690 | MeasureUnit MeasureUnit::getHectare() { |
691 | return MeasureUnit(2, 2); |
692 | } |
693 | |
694 | MeasureUnit *MeasureUnit::createSquareCentimeter(UErrorCode &status) { |
695 | return MeasureUnit::create(2, 3, status); |
696 | } |
697 | |
698 | MeasureUnit MeasureUnit::getSquareCentimeter() { |
699 | return MeasureUnit(2, 3); |
700 | } |
701 | |
702 | MeasureUnit *MeasureUnit::(UErrorCode &status) { |
703 | return MeasureUnit::create(2, 4, status); |
704 | } |
705 | |
706 | MeasureUnit MeasureUnit::() { |
707 | return MeasureUnit(2, 4); |
708 | } |
709 | |
710 | MeasureUnit *MeasureUnit::createSquareInch(UErrorCode &status) { |
711 | return MeasureUnit::create(2, 5, status); |
712 | } |
713 | |
714 | MeasureUnit MeasureUnit::getSquareInch() { |
715 | return MeasureUnit(2, 5); |
716 | } |
717 | |
718 | MeasureUnit *MeasureUnit::createSquareKilometer(UErrorCode &status) { |
719 | return MeasureUnit::create(2, 6, status); |
720 | } |
721 | |
722 | MeasureUnit MeasureUnit::getSquareKilometer() { |
723 | return MeasureUnit(2, 6); |
724 | } |
725 | |
726 | MeasureUnit *MeasureUnit::createSquareMeter(UErrorCode &status) { |
727 | return MeasureUnit::create(2, 7, status); |
728 | } |
729 | |
730 | MeasureUnit MeasureUnit::getSquareMeter() { |
731 | return MeasureUnit(2, 7); |
732 | } |
733 | |
734 | MeasureUnit *MeasureUnit::createSquareMile(UErrorCode &status) { |
735 | return MeasureUnit::create(2, 8, status); |
736 | } |
737 | |
738 | MeasureUnit MeasureUnit::getSquareMile() { |
739 | return MeasureUnit(2, 8); |
740 | } |
741 | |
742 | MeasureUnit *MeasureUnit::createSquareYard(UErrorCode &status) { |
743 | return MeasureUnit::create(2, 9, status); |
744 | } |
745 | |
746 | MeasureUnit MeasureUnit::getSquareYard() { |
747 | return MeasureUnit(2, 9); |
748 | } |
749 | |
750 | MeasureUnit *MeasureUnit::createKarat(UErrorCode &status) { |
751 | return MeasureUnit::create(3, 0, status); |
752 | } |
753 | |
754 | MeasureUnit MeasureUnit::getKarat() { |
755 | return MeasureUnit(3, 0); |
756 | } |
757 | |
758 | MeasureUnit *MeasureUnit::createMilligramPerDeciliter(UErrorCode &status) { |
759 | return MeasureUnit::create(3, 1, status); |
760 | } |
761 | |
762 | MeasureUnit MeasureUnit::getMilligramPerDeciliter() { |
763 | return MeasureUnit(3, 1); |
764 | } |
765 | |
766 | MeasureUnit *MeasureUnit::createMillimolePerLiter(UErrorCode &status) { |
767 | return MeasureUnit::create(3, 2, status); |
768 | } |
769 | |
770 | MeasureUnit MeasureUnit::getMillimolePerLiter() { |
771 | return MeasureUnit(3, 2); |
772 | } |
773 | |
774 | MeasureUnit *MeasureUnit::createMole(UErrorCode &status) { |
775 | return MeasureUnit::create(3, 3, status); |
776 | } |
777 | |
778 | MeasureUnit MeasureUnit::getMole() { |
779 | return MeasureUnit(3, 3); |
780 | } |
781 | |
782 | MeasureUnit *MeasureUnit::createPartPerMillion(UErrorCode &status) { |
783 | return MeasureUnit::create(3, 4, status); |
784 | } |
785 | |
786 | MeasureUnit MeasureUnit::getPartPerMillion() { |
787 | return MeasureUnit(3, 4); |
788 | } |
789 | |
790 | MeasureUnit *MeasureUnit::createPercent(UErrorCode &status) { |
791 | return MeasureUnit::create(3, 5, status); |
792 | } |
793 | |
794 | MeasureUnit MeasureUnit::getPercent() { |
795 | return MeasureUnit(3, 5); |
796 | } |
797 | |
798 | MeasureUnit *MeasureUnit::createPermille(UErrorCode &status) { |
799 | return MeasureUnit::create(3, 6, status); |
800 | } |
801 | |
802 | MeasureUnit MeasureUnit::getPermille() { |
803 | return MeasureUnit(3, 6); |
804 | } |
805 | |
806 | MeasureUnit *MeasureUnit::createPermyriad(UErrorCode &status) { |
807 | return MeasureUnit::create(3, 7, status); |
808 | } |
809 | |
810 | MeasureUnit MeasureUnit::getPermyriad() { |
811 | return MeasureUnit(3, 7); |
812 | } |
813 | |
814 | MeasureUnit *MeasureUnit::createLiterPer100Kilometers(UErrorCode &status) { |
815 | return MeasureUnit::create(4, 0, status); |
816 | } |
817 | |
818 | MeasureUnit MeasureUnit::getLiterPer100Kilometers() { |
819 | return MeasureUnit(4, 0); |
820 | } |
821 | |
822 | MeasureUnit *MeasureUnit::createLiterPerKilometer(UErrorCode &status) { |
823 | return MeasureUnit::create(4, 1, status); |
824 | } |
825 | |
826 | MeasureUnit MeasureUnit::getLiterPerKilometer() { |
827 | return MeasureUnit(4, 1); |
828 | } |
829 | |
830 | MeasureUnit *MeasureUnit::createMilePerGallon(UErrorCode &status) { |
831 | return MeasureUnit::create(4, 2, status); |
832 | } |
833 | |
834 | MeasureUnit MeasureUnit::getMilePerGallon() { |
835 | return MeasureUnit(4, 2); |
836 | } |
837 | |
838 | MeasureUnit *MeasureUnit::createMilePerGallonImperial(UErrorCode &status) { |
839 | return MeasureUnit::create(4, 3, status); |
840 | } |
841 | |
842 | MeasureUnit MeasureUnit::getMilePerGallonImperial() { |
843 | return MeasureUnit(4, 3); |
844 | } |
845 | |
846 | MeasureUnit *MeasureUnit::createBit(UErrorCode &status) { |
847 | return MeasureUnit::create(6, 0, status); |
848 | } |
849 | |
850 | MeasureUnit MeasureUnit::getBit() { |
851 | return MeasureUnit(6, 0); |
852 | } |
853 | |
854 | MeasureUnit *MeasureUnit::createByte(UErrorCode &status) { |
855 | return MeasureUnit::create(6, 1, status); |
856 | } |
857 | |
858 | MeasureUnit MeasureUnit::getByte() { |
859 | return MeasureUnit(6, 1); |
860 | } |
861 | |
862 | MeasureUnit *MeasureUnit::createGigabit(UErrorCode &status) { |
863 | return MeasureUnit::create(6, 2, status); |
864 | } |
865 | |
866 | MeasureUnit MeasureUnit::getGigabit() { |
867 | return MeasureUnit(6, 2); |
868 | } |
869 | |
870 | MeasureUnit *MeasureUnit::createGigabyte(UErrorCode &status) { |
871 | return MeasureUnit::create(6, 3, status); |
872 | } |
873 | |
874 | MeasureUnit MeasureUnit::getGigabyte() { |
875 | return MeasureUnit(6, 3); |
876 | } |
877 | |
878 | MeasureUnit *MeasureUnit::createKilobit(UErrorCode &status) { |
879 | return MeasureUnit::create(6, 4, status); |
880 | } |
881 | |
882 | MeasureUnit MeasureUnit::getKilobit() { |
883 | return MeasureUnit(6, 4); |
884 | } |
885 | |
886 | MeasureUnit *MeasureUnit::createKilobyte(UErrorCode &status) { |
887 | return MeasureUnit::create(6, 5, status); |
888 | } |
889 | |
890 | MeasureUnit MeasureUnit::getKilobyte() { |
891 | return MeasureUnit(6, 5); |
892 | } |
893 | |
894 | MeasureUnit *MeasureUnit::createMegabit(UErrorCode &status) { |
895 | return MeasureUnit::create(6, 6, status); |
896 | } |
897 | |
898 | MeasureUnit MeasureUnit::getMegabit() { |
899 | return MeasureUnit(6, 6); |
900 | } |
901 | |
902 | MeasureUnit *MeasureUnit::createMegabyte(UErrorCode &status) { |
903 | return MeasureUnit::create(6, 7, status); |
904 | } |
905 | |
906 | MeasureUnit MeasureUnit::getMegabyte() { |
907 | return MeasureUnit(6, 7); |
908 | } |
909 | |
910 | MeasureUnit *MeasureUnit::createPetabyte(UErrorCode &status) { |
911 | return MeasureUnit::create(6, 8, status); |
912 | } |
913 | |
914 | MeasureUnit MeasureUnit::getPetabyte() { |
915 | return MeasureUnit(6, 8); |
916 | } |
917 | |
918 | MeasureUnit *MeasureUnit::createTerabit(UErrorCode &status) { |
919 | return MeasureUnit::create(6, 9, status); |
920 | } |
921 | |
922 | MeasureUnit MeasureUnit::getTerabit() { |
923 | return MeasureUnit(6, 9); |
924 | } |
925 | |
926 | MeasureUnit *MeasureUnit::createTerabyte(UErrorCode &status) { |
927 | return MeasureUnit::create(6, 10, status); |
928 | } |
929 | |
930 | MeasureUnit MeasureUnit::getTerabyte() { |
931 | return MeasureUnit(6, 10); |
932 | } |
933 | |
934 | MeasureUnit *MeasureUnit::createCentury(UErrorCode &status) { |
935 | return MeasureUnit::create(7, 0, status); |
936 | } |
937 | |
938 | MeasureUnit MeasureUnit::getCentury() { |
939 | return MeasureUnit(7, 0); |
940 | } |
941 | |
942 | MeasureUnit *MeasureUnit::createDay(UErrorCode &status) { |
943 | return MeasureUnit::create(7, 1, status); |
944 | } |
945 | |
946 | MeasureUnit MeasureUnit::getDay() { |
947 | return MeasureUnit(7, 1); |
948 | } |
949 | |
950 | MeasureUnit *MeasureUnit::createDayPerson(UErrorCode &status) { |
951 | return MeasureUnit::create(7, 2, status); |
952 | } |
953 | |
954 | MeasureUnit MeasureUnit::getDayPerson() { |
955 | return MeasureUnit(7, 2); |
956 | } |
957 | |
958 | MeasureUnit *MeasureUnit::createDecade(UErrorCode &status) { |
959 | return MeasureUnit::create(7, 3, status); |
960 | } |
961 | |
962 | MeasureUnit MeasureUnit::getDecade() { |
963 | return MeasureUnit(7, 3); |
964 | } |
965 | |
966 | MeasureUnit *MeasureUnit::createHour(UErrorCode &status) { |
967 | return MeasureUnit::create(7, 4, status); |
968 | } |
969 | |
970 | MeasureUnit MeasureUnit::getHour() { |
971 | return MeasureUnit(7, 4); |
972 | } |
973 | |
974 | MeasureUnit *MeasureUnit::createMicrosecond(UErrorCode &status) { |
975 | return MeasureUnit::create(7, 5, status); |
976 | } |
977 | |
978 | MeasureUnit MeasureUnit::getMicrosecond() { |
979 | return MeasureUnit(7, 5); |
980 | } |
981 | |
982 | MeasureUnit *MeasureUnit::createMillisecond(UErrorCode &status) { |
983 | return MeasureUnit::create(7, 6, status); |
984 | } |
985 | |
986 | MeasureUnit MeasureUnit::getMillisecond() { |
987 | return MeasureUnit(7, 6); |
988 | } |
989 | |
990 | MeasureUnit *MeasureUnit::createMinute(UErrorCode &status) { |
991 | return MeasureUnit::create(7, 7, status); |
992 | } |
993 | |
994 | MeasureUnit MeasureUnit::getMinute() { |
995 | return MeasureUnit(7, 7); |
996 | } |
997 | |
998 | MeasureUnit *MeasureUnit::createMonth(UErrorCode &status) { |
999 | return MeasureUnit::create(7, 8, status); |
1000 | } |
1001 | |
1002 | MeasureUnit MeasureUnit::getMonth() { |
1003 | return MeasureUnit(7, 8); |
1004 | } |
1005 | |
1006 | MeasureUnit *MeasureUnit::createMonthPerson(UErrorCode &status) { |
1007 | return MeasureUnit::create(7, 9, status); |
1008 | } |
1009 | |
1010 | MeasureUnit MeasureUnit::getMonthPerson() { |
1011 | return MeasureUnit(7, 9); |
1012 | } |
1013 | |
1014 | MeasureUnit *MeasureUnit::createNanosecond(UErrorCode &status) { |
1015 | return MeasureUnit::create(7, 10, status); |
1016 | } |
1017 | |
1018 | MeasureUnit MeasureUnit::getNanosecond() { |
1019 | return MeasureUnit(7, 10); |
1020 | } |
1021 | |
1022 | MeasureUnit *MeasureUnit::createSecond(UErrorCode &status) { |
1023 | return MeasureUnit::create(7, 11, status); |
1024 | } |
1025 | |
1026 | MeasureUnit MeasureUnit::getSecond() { |
1027 | return MeasureUnit(7, 11); |
1028 | } |
1029 | |
1030 | MeasureUnit *MeasureUnit::createWeek(UErrorCode &status) { |
1031 | return MeasureUnit::create(7, 12, status); |
1032 | } |
1033 | |
1034 | MeasureUnit MeasureUnit::getWeek() { |
1035 | return MeasureUnit(7, 12); |
1036 | } |
1037 | |
1038 | MeasureUnit *MeasureUnit::createWeekPerson(UErrorCode &status) { |
1039 | return MeasureUnit::create(7, 13, status); |
1040 | } |
1041 | |
1042 | MeasureUnit MeasureUnit::getWeekPerson() { |
1043 | return MeasureUnit(7, 13); |
1044 | } |
1045 | |
1046 | MeasureUnit *MeasureUnit::createYear(UErrorCode &status) { |
1047 | return MeasureUnit::create(7, 14, status); |
1048 | } |
1049 | |
1050 | MeasureUnit MeasureUnit::getYear() { |
1051 | return MeasureUnit(7, 14); |
1052 | } |
1053 | |
1054 | MeasureUnit *MeasureUnit::createYearPerson(UErrorCode &status) { |
1055 | return MeasureUnit::create(7, 15, status); |
1056 | } |
1057 | |
1058 | MeasureUnit MeasureUnit::getYearPerson() { |
1059 | return MeasureUnit(7, 15); |
1060 | } |
1061 | |
1062 | MeasureUnit *MeasureUnit::createAmpere(UErrorCode &status) { |
1063 | return MeasureUnit::create(8, 0, status); |
1064 | } |
1065 | |
1066 | MeasureUnit MeasureUnit::getAmpere() { |
1067 | return MeasureUnit(8, 0); |
1068 | } |
1069 | |
1070 | MeasureUnit *MeasureUnit::createMilliampere(UErrorCode &status) { |
1071 | return MeasureUnit::create(8, 1, status); |
1072 | } |
1073 | |
1074 | MeasureUnit MeasureUnit::getMilliampere() { |
1075 | return MeasureUnit(8, 1); |
1076 | } |
1077 | |
1078 | MeasureUnit *MeasureUnit::createOhm(UErrorCode &status) { |
1079 | return MeasureUnit::create(8, 2, status); |
1080 | } |
1081 | |
1082 | MeasureUnit MeasureUnit::getOhm() { |
1083 | return MeasureUnit(8, 2); |
1084 | } |
1085 | |
1086 | MeasureUnit *MeasureUnit::createVolt(UErrorCode &status) { |
1087 | return MeasureUnit::create(8, 3, status); |
1088 | } |
1089 | |
1090 | MeasureUnit MeasureUnit::getVolt() { |
1091 | return MeasureUnit(8, 3); |
1092 | } |
1093 | |
1094 | MeasureUnit *MeasureUnit::createBritishThermalUnit(UErrorCode &status) { |
1095 | return MeasureUnit::create(9, 0, status); |
1096 | } |
1097 | |
1098 | MeasureUnit MeasureUnit::getBritishThermalUnit() { |
1099 | return MeasureUnit(9, 0); |
1100 | } |
1101 | |
1102 | MeasureUnit *MeasureUnit::createCalorie(UErrorCode &status) { |
1103 | return MeasureUnit::create(9, 1, status); |
1104 | } |
1105 | |
1106 | MeasureUnit MeasureUnit::getCalorie() { |
1107 | return MeasureUnit(9, 1); |
1108 | } |
1109 | |
1110 | MeasureUnit *MeasureUnit::createElectronvolt(UErrorCode &status) { |
1111 | return MeasureUnit::create(9, 2, status); |
1112 | } |
1113 | |
1114 | MeasureUnit MeasureUnit::getElectronvolt() { |
1115 | return MeasureUnit(9, 2); |
1116 | } |
1117 | |
1118 | MeasureUnit *MeasureUnit::createFoodcalorie(UErrorCode &status) { |
1119 | return MeasureUnit::create(9, 3, status); |
1120 | } |
1121 | |
1122 | MeasureUnit MeasureUnit::getFoodcalorie() { |
1123 | return MeasureUnit(9, 3); |
1124 | } |
1125 | |
1126 | MeasureUnit *MeasureUnit::createJoule(UErrorCode &status) { |
1127 | return MeasureUnit::create(9, 4, status); |
1128 | } |
1129 | |
1130 | MeasureUnit MeasureUnit::getJoule() { |
1131 | return MeasureUnit(9, 4); |
1132 | } |
1133 | |
1134 | MeasureUnit *MeasureUnit::createKilocalorie(UErrorCode &status) { |
1135 | return MeasureUnit::create(9, 5, status); |
1136 | } |
1137 | |
1138 | MeasureUnit MeasureUnit::getKilocalorie() { |
1139 | return MeasureUnit(9, 5); |
1140 | } |
1141 | |
1142 | MeasureUnit *MeasureUnit::createKilojoule(UErrorCode &status) { |
1143 | return MeasureUnit::create(9, 6, status); |
1144 | } |
1145 | |
1146 | MeasureUnit MeasureUnit::getKilojoule() { |
1147 | return MeasureUnit(9, 6); |
1148 | } |
1149 | |
1150 | MeasureUnit *MeasureUnit::createKilowattHour(UErrorCode &status) { |
1151 | return MeasureUnit::create(9, 7, status); |
1152 | } |
1153 | |
1154 | MeasureUnit MeasureUnit::getKilowattHour() { |
1155 | return MeasureUnit(9, 7); |
1156 | } |
1157 | |
1158 | MeasureUnit *MeasureUnit::createThermUs(UErrorCode &status) { |
1159 | return MeasureUnit::create(9, 8, status); |
1160 | } |
1161 | |
1162 | MeasureUnit MeasureUnit::getThermUs() { |
1163 | return MeasureUnit(9, 8); |
1164 | } |
1165 | |
1166 | MeasureUnit *MeasureUnit::createNewton(UErrorCode &status) { |
1167 | return MeasureUnit::create(10, 0, status); |
1168 | } |
1169 | |
1170 | MeasureUnit MeasureUnit::getNewton() { |
1171 | return MeasureUnit(10, 0); |
1172 | } |
1173 | |
1174 | MeasureUnit *MeasureUnit::createPoundForce(UErrorCode &status) { |
1175 | return MeasureUnit::create(10, 1, status); |
1176 | } |
1177 | |
1178 | MeasureUnit MeasureUnit::getPoundForce() { |
1179 | return MeasureUnit(10, 1); |
1180 | } |
1181 | |
1182 | MeasureUnit *MeasureUnit::createGigahertz(UErrorCode &status) { |
1183 | return MeasureUnit::create(11, 0, status); |
1184 | } |
1185 | |
1186 | MeasureUnit MeasureUnit::getGigahertz() { |
1187 | return MeasureUnit(11, 0); |
1188 | } |
1189 | |
1190 | MeasureUnit *MeasureUnit::createHertz(UErrorCode &status) { |
1191 | return MeasureUnit::create(11, 1, status); |
1192 | } |
1193 | |
1194 | MeasureUnit MeasureUnit::getHertz() { |
1195 | return MeasureUnit(11, 1); |
1196 | } |
1197 | |
1198 | MeasureUnit *MeasureUnit::createKilohertz(UErrorCode &status) { |
1199 | return MeasureUnit::create(11, 2, status); |
1200 | } |
1201 | |
1202 | MeasureUnit MeasureUnit::getKilohertz() { |
1203 | return MeasureUnit(11, 2); |
1204 | } |
1205 | |
1206 | MeasureUnit *MeasureUnit::createMegahertz(UErrorCode &status) { |
1207 | return MeasureUnit::create(11, 3, status); |
1208 | } |
1209 | |
1210 | MeasureUnit MeasureUnit::getMegahertz() { |
1211 | return MeasureUnit(11, 3); |
1212 | } |
1213 | |
1214 | MeasureUnit *MeasureUnit::createDotPerCentimeter(UErrorCode &status) { |
1215 | return MeasureUnit::create(12, 0, status); |
1216 | } |
1217 | |
1218 | MeasureUnit MeasureUnit::getDotPerCentimeter() { |
1219 | return MeasureUnit(12, 0); |
1220 | } |
1221 | |
1222 | MeasureUnit *MeasureUnit::createDotPerInch(UErrorCode &status) { |
1223 | return MeasureUnit::create(12, 1, status); |
1224 | } |
1225 | |
1226 | MeasureUnit MeasureUnit::getDotPerInch() { |
1227 | return MeasureUnit(12, 1); |
1228 | } |
1229 | |
1230 | MeasureUnit *MeasureUnit::createEm(UErrorCode &status) { |
1231 | return MeasureUnit::create(12, 2, status); |
1232 | } |
1233 | |
1234 | MeasureUnit MeasureUnit::getEm() { |
1235 | return MeasureUnit(12, 2); |
1236 | } |
1237 | |
1238 | MeasureUnit *MeasureUnit::createMegapixel(UErrorCode &status) { |
1239 | return MeasureUnit::create(12, 3, status); |
1240 | } |
1241 | |
1242 | MeasureUnit MeasureUnit::getMegapixel() { |
1243 | return MeasureUnit(12, 3); |
1244 | } |
1245 | |
1246 | MeasureUnit *MeasureUnit::createPixel(UErrorCode &status) { |
1247 | return MeasureUnit::create(12, 4, status); |
1248 | } |
1249 | |
1250 | MeasureUnit MeasureUnit::getPixel() { |
1251 | return MeasureUnit(12, 4); |
1252 | } |
1253 | |
1254 | MeasureUnit *MeasureUnit::createPixelPerCentimeter(UErrorCode &status) { |
1255 | return MeasureUnit::create(12, 5, status); |
1256 | } |
1257 | |
1258 | MeasureUnit MeasureUnit::getPixelPerCentimeter() { |
1259 | return MeasureUnit(12, 5); |
1260 | } |
1261 | |
1262 | MeasureUnit *MeasureUnit::createPixelPerInch(UErrorCode &status) { |
1263 | return MeasureUnit::create(12, 6, status); |
1264 | } |
1265 | |
1266 | MeasureUnit MeasureUnit::getPixelPerInch() { |
1267 | return MeasureUnit(12, 6); |
1268 | } |
1269 | |
1270 | MeasureUnit *MeasureUnit::createAstronomicalUnit(UErrorCode &status) { |
1271 | return MeasureUnit::create(13, 0, status); |
1272 | } |
1273 | |
1274 | MeasureUnit MeasureUnit::getAstronomicalUnit() { |
1275 | return MeasureUnit(13, 0); |
1276 | } |
1277 | |
1278 | MeasureUnit *MeasureUnit::createCentimeter(UErrorCode &status) { |
1279 | return MeasureUnit::create(13, 1, status); |
1280 | } |
1281 | |
1282 | MeasureUnit MeasureUnit::getCentimeter() { |
1283 | return MeasureUnit(13, 1); |
1284 | } |
1285 | |
1286 | MeasureUnit *MeasureUnit::createDecimeter(UErrorCode &status) { |
1287 | return MeasureUnit::create(13, 2, status); |
1288 | } |
1289 | |
1290 | MeasureUnit MeasureUnit::getDecimeter() { |
1291 | return MeasureUnit(13, 2); |
1292 | } |
1293 | |
1294 | MeasureUnit *MeasureUnit::createFathom(UErrorCode &status) { |
1295 | return MeasureUnit::create(13, 3, status); |
1296 | } |
1297 | |
1298 | MeasureUnit MeasureUnit::getFathom() { |
1299 | return MeasureUnit(13, 3); |
1300 | } |
1301 | |
1302 | MeasureUnit *MeasureUnit::(UErrorCode &status) { |
1303 | return MeasureUnit::create(13, 4, status); |
1304 | } |
1305 | |
1306 | MeasureUnit MeasureUnit::() { |
1307 | return MeasureUnit(13, 4); |
1308 | } |
1309 | |
1310 | MeasureUnit *MeasureUnit::createFurlong(UErrorCode &status) { |
1311 | return MeasureUnit::create(13, 5, status); |
1312 | } |
1313 | |
1314 | MeasureUnit MeasureUnit::getFurlong() { |
1315 | return MeasureUnit(13, 5); |
1316 | } |
1317 | |
1318 | MeasureUnit *MeasureUnit::createInch(UErrorCode &status) { |
1319 | return MeasureUnit::create(13, 6, status); |
1320 | } |
1321 | |
1322 | MeasureUnit MeasureUnit::getInch() { |
1323 | return MeasureUnit(13, 6); |
1324 | } |
1325 | |
1326 | MeasureUnit *MeasureUnit::createKilometer(UErrorCode &status) { |
1327 | return MeasureUnit::create(13, 7, status); |
1328 | } |
1329 | |
1330 | MeasureUnit MeasureUnit::getKilometer() { |
1331 | return MeasureUnit(13, 7); |
1332 | } |
1333 | |
1334 | MeasureUnit *MeasureUnit::createLightYear(UErrorCode &status) { |
1335 | return MeasureUnit::create(13, 8, status); |
1336 | } |
1337 | |
1338 | MeasureUnit MeasureUnit::getLightYear() { |
1339 | return MeasureUnit(13, 8); |
1340 | } |
1341 | |
1342 | MeasureUnit *MeasureUnit::createMeter(UErrorCode &status) { |
1343 | return MeasureUnit::create(13, 9, status); |
1344 | } |
1345 | |
1346 | MeasureUnit MeasureUnit::getMeter() { |
1347 | return MeasureUnit(13, 9); |
1348 | } |
1349 | |
1350 | MeasureUnit *MeasureUnit::createMicrometer(UErrorCode &status) { |
1351 | return MeasureUnit::create(13, 10, status); |
1352 | } |
1353 | |
1354 | MeasureUnit MeasureUnit::getMicrometer() { |
1355 | return MeasureUnit(13, 10); |
1356 | } |
1357 | |
1358 | MeasureUnit *MeasureUnit::createMile(UErrorCode &status) { |
1359 | return MeasureUnit::create(13, 11, status); |
1360 | } |
1361 | |
1362 | MeasureUnit MeasureUnit::getMile() { |
1363 | return MeasureUnit(13, 11); |
1364 | } |
1365 | |
1366 | MeasureUnit *MeasureUnit::createMileScandinavian(UErrorCode &status) { |
1367 | return MeasureUnit::create(13, 12, status); |
1368 | } |
1369 | |
1370 | MeasureUnit MeasureUnit::getMileScandinavian() { |
1371 | return MeasureUnit(13, 12); |
1372 | } |
1373 | |
1374 | MeasureUnit *MeasureUnit::createMillimeter(UErrorCode &status) { |
1375 | return MeasureUnit::create(13, 13, status); |
1376 | } |
1377 | |
1378 | MeasureUnit MeasureUnit::getMillimeter() { |
1379 | return MeasureUnit(13, 13); |
1380 | } |
1381 | |
1382 | MeasureUnit *MeasureUnit::createNanometer(UErrorCode &status) { |
1383 | return MeasureUnit::create(13, 14, status); |
1384 | } |
1385 | |
1386 | MeasureUnit MeasureUnit::getNanometer() { |
1387 | return MeasureUnit(13, 14); |
1388 | } |
1389 | |
1390 | MeasureUnit *MeasureUnit::createNauticalMile(UErrorCode &status) { |
1391 | return MeasureUnit::create(13, 15, status); |
1392 | } |
1393 | |
1394 | MeasureUnit MeasureUnit::getNauticalMile() { |
1395 | return MeasureUnit(13, 15); |
1396 | } |
1397 | |
1398 | MeasureUnit *MeasureUnit::createParsec(UErrorCode &status) { |
1399 | return MeasureUnit::create(13, 16, status); |
1400 | } |
1401 | |
1402 | MeasureUnit MeasureUnit::getParsec() { |
1403 | return MeasureUnit(13, 16); |
1404 | } |
1405 | |
1406 | MeasureUnit *MeasureUnit::createPicometer(UErrorCode &status) { |
1407 | return MeasureUnit::create(13, 17, status); |
1408 | } |
1409 | |
1410 | MeasureUnit MeasureUnit::getPicometer() { |
1411 | return MeasureUnit(13, 17); |
1412 | } |
1413 | |
1414 | MeasureUnit *MeasureUnit::createPoint(UErrorCode &status) { |
1415 | return MeasureUnit::create(13, 18, status); |
1416 | } |
1417 | |
1418 | MeasureUnit MeasureUnit::getPoint() { |
1419 | return MeasureUnit(13, 18); |
1420 | } |
1421 | |
1422 | MeasureUnit *MeasureUnit::createSolarRadius(UErrorCode &status) { |
1423 | return MeasureUnit::create(13, 19, status); |
1424 | } |
1425 | |
1426 | MeasureUnit MeasureUnit::getSolarRadius() { |
1427 | return MeasureUnit(13, 19); |
1428 | } |
1429 | |
1430 | MeasureUnit *MeasureUnit::createYard(UErrorCode &status) { |
1431 | return MeasureUnit::create(13, 20, status); |
1432 | } |
1433 | |
1434 | MeasureUnit MeasureUnit::getYard() { |
1435 | return MeasureUnit(13, 20); |
1436 | } |
1437 | |
1438 | MeasureUnit *MeasureUnit::createLux(UErrorCode &status) { |
1439 | return MeasureUnit::create(14, 0, status); |
1440 | } |
1441 | |
1442 | MeasureUnit MeasureUnit::getLux() { |
1443 | return MeasureUnit(14, 0); |
1444 | } |
1445 | |
1446 | MeasureUnit *MeasureUnit::createSolarLuminosity(UErrorCode &status) { |
1447 | return MeasureUnit::create(14, 1, status); |
1448 | } |
1449 | |
1450 | MeasureUnit MeasureUnit::getSolarLuminosity() { |
1451 | return MeasureUnit(14, 1); |
1452 | } |
1453 | |
1454 | MeasureUnit *MeasureUnit::createCarat(UErrorCode &status) { |
1455 | return MeasureUnit::create(15, 0, status); |
1456 | } |
1457 | |
1458 | MeasureUnit MeasureUnit::getCarat() { |
1459 | return MeasureUnit(15, 0); |
1460 | } |
1461 | |
1462 | MeasureUnit *MeasureUnit::createDalton(UErrorCode &status) { |
1463 | return MeasureUnit::create(15, 1, status); |
1464 | } |
1465 | |
1466 | MeasureUnit MeasureUnit::getDalton() { |
1467 | return MeasureUnit(15, 1); |
1468 | } |
1469 | |
1470 | MeasureUnit *MeasureUnit::createEarthMass(UErrorCode &status) { |
1471 | return MeasureUnit::create(15, 2, status); |
1472 | } |
1473 | |
1474 | MeasureUnit MeasureUnit::getEarthMass() { |
1475 | return MeasureUnit(15, 2); |
1476 | } |
1477 | |
1478 | MeasureUnit *MeasureUnit::createGram(UErrorCode &status) { |
1479 | return MeasureUnit::create(15, 3, status); |
1480 | } |
1481 | |
1482 | MeasureUnit MeasureUnit::getGram() { |
1483 | return MeasureUnit(15, 3); |
1484 | } |
1485 | |
1486 | MeasureUnit *MeasureUnit::createKilogram(UErrorCode &status) { |
1487 | return MeasureUnit::create(15, 4, status); |
1488 | } |
1489 | |
1490 | MeasureUnit MeasureUnit::getKilogram() { |
1491 | return MeasureUnit(15, 4); |
1492 | } |
1493 | |
1494 | MeasureUnit *MeasureUnit::createMetricTon(UErrorCode &status) { |
1495 | return MeasureUnit::create(15, 5, status); |
1496 | } |
1497 | |
1498 | MeasureUnit MeasureUnit::getMetricTon() { |
1499 | return MeasureUnit(15, 5); |
1500 | } |
1501 | |
1502 | MeasureUnit *MeasureUnit::createMicrogram(UErrorCode &status) { |
1503 | return MeasureUnit::create(15, 6, status); |
1504 | } |
1505 | |
1506 | MeasureUnit MeasureUnit::getMicrogram() { |
1507 | return MeasureUnit(15, 6); |
1508 | } |
1509 | |
1510 | MeasureUnit *MeasureUnit::createMilligram(UErrorCode &status) { |
1511 | return MeasureUnit::create(15, 7, status); |
1512 | } |
1513 | |
1514 | MeasureUnit MeasureUnit::getMilligram() { |
1515 | return MeasureUnit(15, 7); |
1516 | } |
1517 | |
1518 | MeasureUnit *MeasureUnit::createOunce(UErrorCode &status) { |
1519 | return MeasureUnit::create(15, 8, status); |
1520 | } |
1521 | |
1522 | MeasureUnit MeasureUnit::getOunce() { |
1523 | return MeasureUnit(15, 8); |
1524 | } |
1525 | |
1526 | MeasureUnit *MeasureUnit::createOunceTroy(UErrorCode &status) { |
1527 | return MeasureUnit::create(15, 9, status); |
1528 | } |
1529 | |
1530 | MeasureUnit MeasureUnit::getOunceTroy() { |
1531 | return MeasureUnit(15, 9); |
1532 | } |
1533 | |
1534 | MeasureUnit *MeasureUnit::createPound(UErrorCode &status) { |
1535 | return MeasureUnit::create(15, 10, status); |
1536 | } |
1537 | |
1538 | MeasureUnit MeasureUnit::getPound() { |
1539 | return MeasureUnit(15, 10); |
1540 | } |
1541 | |
1542 | MeasureUnit *MeasureUnit::createSolarMass(UErrorCode &status) { |
1543 | return MeasureUnit::create(15, 11, status); |
1544 | } |
1545 | |
1546 | MeasureUnit MeasureUnit::getSolarMass() { |
1547 | return MeasureUnit(15, 11); |
1548 | } |
1549 | |
1550 | MeasureUnit *MeasureUnit::createStone(UErrorCode &status) { |
1551 | return MeasureUnit::create(15, 12, status); |
1552 | } |
1553 | |
1554 | MeasureUnit MeasureUnit::getStone() { |
1555 | return MeasureUnit(15, 12); |
1556 | } |
1557 | |
1558 | MeasureUnit *MeasureUnit::createTon(UErrorCode &status) { |
1559 | return MeasureUnit::create(15, 13, status); |
1560 | } |
1561 | |
1562 | MeasureUnit MeasureUnit::getTon() { |
1563 | return MeasureUnit(15, 13); |
1564 | } |
1565 | |
1566 | MeasureUnit *MeasureUnit::createGigawatt(UErrorCode &status) { |
1567 | return MeasureUnit::create(17, 0, status); |
1568 | } |
1569 | |
1570 | MeasureUnit MeasureUnit::getGigawatt() { |
1571 | return MeasureUnit(17, 0); |
1572 | } |
1573 | |
1574 | MeasureUnit *MeasureUnit::createHorsepower(UErrorCode &status) { |
1575 | return MeasureUnit::create(17, 1, status); |
1576 | } |
1577 | |
1578 | MeasureUnit MeasureUnit::getHorsepower() { |
1579 | return MeasureUnit(17, 1); |
1580 | } |
1581 | |
1582 | MeasureUnit *MeasureUnit::createKilowatt(UErrorCode &status) { |
1583 | return MeasureUnit::create(17, 2, status); |
1584 | } |
1585 | |
1586 | MeasureUnit MeasureUnit::getKilowatt() { |
1587 | return MeasureUnit(17, 2); |
1588 | } |
1589 | |
1590 | MeasureUnit *MeasureUnit::createMegawatt(UErrorCode &status) { |
1591 | return MeasureUnit::create(17, 3, status); |
1592 | } |
1593 | |
1594 | MeasureUnit MeasureUnit::getMegawatt() { |
1595 | return MeasureUnit(17, 3); |
1596 | } |
1597 | |
1598 | MeasureUnit *MeasureUnit::createMilliwatt(UErrorCode &status) { |
1599 | return MeasureUnit::create(17, 4, status); |
1600 | } |
1601 | |
1602 | MeasureUnit MeasureUnit::getMilliwatt() { |
1603 | return MeasureUnit(17, 4); |
1604 | } |
1605 | |
1606 | MeasureUnit *MeasureUnit::createWatt(UErrorCode &status) { |
1607 | return MeasureUnit::create(17, 5, status); |
1608 | } |
1609 | |
1610 | MeasureUnit MeasureUnit::getWatt() { |
1611 | return MeasureUnit(17, 5); |
1612 | } |
1613 | |
1614 | MeasureUnit *MeasureUnit::createAtmosphere(UErrorCode &status) { |
1615 | return MeasureUnit::create(18, 0, status); |
1616 | } |
1617 | |
1618 | MeasureUnit MeasureUnit::getAtmosphere() { |
1619 | return MeasureUnit(18, 0); |
1620 | } |
1621 | |
1622 | MeasureUnit *MeasureUnit::createBar(UErrorCode &status) { |
1623 | return MeasureUnit::create(18, 1, status); |
1624 | } |
1625 | |
1626 | MeasureUnit MeasureUnit::getBar() { |
1627 | return MeasureUnit(18, 1); |
1628 | } |
1629 | |
1630 | MeasureUnit *MeasureUnit::createHectopascal(UErrorCode &status) { |
1631 | return MeasureUnit::create(18, 2, status); |
1632 | } |
1633 | |
1634 | MeasureUnit MeasureUnit::getHectopascal() { |
1635 | return MeasureUnit(18, 2); |
1636 | } |
1637 | |
1638 | MeasureUnit *MeasureUnit::createInchHg(UErrorCode &status) { |
1639 | return MeasureUnit::create(18, 3, status); |
1640 | } |
1641 | |
1642 | MeasureUnit MeasureUnit::getInchHg() { |
1643 | return MeasureUnit(18, 3); |
1644 | } |
1645 | |
1646 | MeasureUnit *MeasureUnit::createKilopascal(UErrorCode &status) { |
1647 | return MeasureUnit::create(18, 4, status); |
1648 | } |
1649 | |
1650 | MeasureUnit MeasureUnit::getKilopascal() { |
1651 | return MeasureUnit(18, 4); |
1652 | } |
1653 | |
1654 | MeasureUnit *MeasureUnit::createMegapascal(UErrorCode &status) { |
1655 | return MeasureUnit::create(18, 5, status); |
1656 | } |
1657 | |
1658 | MeasureUnit MeasureUnit::getMegapascal() { |
1659 | return MeasureUnit(18, 5); |
1660 | } |
1661 | |
1662 | MeasureUnit *MeasureUnit::createMillibar(UErrorCode &status) { |
1663 | return MeasureUnit::create(18, 6, status); |
1664 | } |
1665 | |
1666 | MeasureUnit MeasureUnit::getMillibar() { |
1667 | return MeasureUnit(18, 6); |
1668 | } |
1669 | |
1670 | MeasureUnit *MeasureUnit::createMillimeterOfMercury(UErrorCode &status) { |
1671 | return MeasureUnit::create(18, 7, status); |
1672 | } |
1673 | |
1674 | MeasureUnit MeasureUnit::getMillimeterOfMercury() { |
1675 | return MeasureUnit(18, 7); |
1676 | } |
1677 | |
1678 | MeasureUnit *MeasureUnit::createPascal(UErrorCode &status) { |
1679 | return MeasureUnit::create(18, 8, status); |
1680 | } |
1681 | |
1682 | MeasureUnit MeasureUnit::getPascal() { |
1683 | return MeasureUnit(18, 8); |
1684 | } |
1685 | |
1686 | MeasureUnit *MeasureUnit::createPoundPerSquareInch(UErrorCode &status) { |
1687 | return MeasureUnit::create(18, 9, status); |
1688 | } |
1689 | |
1690 | MeasureUnit MeasureUnit::getPoundPerSquareInch() { |
1691 | return MeasureUnit(18, 9); |
1692 | } |
1693 | |
1694 | MeasureUnit *MeasureUnit::createKilometerPerHour(UErrorCode &status) { |
1695 | return MeasureUnit::create(19, 0, status); |
1696 | } |
1697 | |
1698 | MeasureUnit MeasureUnit::getKilometerPerHour() { |
1699 | return MeasureUnit(19, 0); |
1700 | } |
1701 | |
1702 | MeasureUnit *MeasureUnit::createKnot(UErrorCode &status) { |
1703 | return MeasureUnit::create(19, 1, status); |
1704 | } |
1705 | |
1706 | MeasureUnit MeasureUnit::getKnot() { |
1707 | return MeasureUnit(19, 1); |
1708 | } |
1709 | |
1710 | MeasureUnit *MeasureUnit::createMeterPerSecond(UErrorCode &status) { |
1711 | return MeasureUnit::create(19, 2, status); |
1712 | } |
1713 | |
1714 | MeasureUnit MeasureUnit::getMeterPerSecond() { |
1715 | return MeasureUnit(19, 2); |
1716 | } |
1717 | |
1718 | MeasureUnit *MeasureUnit::createMilePerHour(UErrorCode &status) { |
1719 | return MeasureUnit::create(19, 3, status); |
1720 | } |
1721 | |
1722 | MeasureUnit MeasureUnit::getMilePerHour() { |
1723 | return MeasureUnit(19, 3); |
1724 | } |
1725 | |
1726 | MeasureUnit *MeasureUnit::createCelsius(UErrorCode &status) { |
1727 | return MeasureUnit::create(20, 0, status); |
1728 | } |
1729 | |
1730 | MeasureUnit MeasureUnit::getCelsius() { |
1731 | return MeasureUnit(20, 0); |
1732 | } |
1733 | |
1734 | MeasureUnit *MeasureUnit::createFahrenheit(UErrorCode &status) { |
1735 | return MeasureUnit::create(20, 1, status); |
1736 | } |
1737 | |
1738 | MeasureUnit MeasureUnit::getFahrenheit() { |
1739 | return MeasureUnit(20, 1); |
1740 | } |
1741 | |
1742 | MeasureUnit *MeasureUnit::createGenericTemperature(UErrorCode &status) { |
1743 | return MeasureUnit::create(20, 2, status); |
1744 | } |
1745 | |
1746 | MeasureUnit MeasureUnit::getGenericTemperature() { |
1747 | return MeasureUnit(20, 2); |
1748 | } |
1749 | |
1750 | MeasureUnit *MeasureUnit::createKelvin(UErrorCode &status) { |
1751 | return MeasureUnit::create(20, 3, status); |
1752 | } |
1753 | |
1754 | MeasureUnit MeasureUnit::getKelvin() { |
1755 | return MeasureUnit(20, 3); |
1756 | } |
1757 | |
1758 | MeasureUnit *MeasureUnit::createNewtonMeter(UErrorCode &status) { |
1759 | return MeasureUnit::create(21, 0, status); |
1760 | } |
1761 | |
1762 | MeasureUnit MeasureUnit::getNewtonMeter() { |
1763 | return MeasureUnit(21, 0); |
1764 | } |
1765 | |
1766 | MeasureUnit *MeasureUnit::(UErrorCode &status) { |
1767 | return MeasureUnit::create(21, 1, status); |
1768 | } |
1769 | |
1770 | MeasureUnit MeasureUnit::() { |
1771 | return MeasureUnit(21, 1); |
1772 | } |
1773 | |
1774 | MeasureUnit *MeasureUnit::(UErrorCode &status) { |
1775 | return MeasureUnit::create(22, 0, status); |
1776 | } |
1777 | |
1778 | MeasureUnit MeasureUnit::() { |
1779 | return MeasureUnit(22, 0); |
1780 | } |
1781 | |
1782 | MeasureUnit *MeasureUnit::createBarrel(UErrorCode &status) { |
1783 | return MeasureUnit::create(22, 1, status); |
1784 | } |
1785 | |
1786 | MeasureUnit MeasureUnit::getBarrel() { |
1787 | return MeasureUnit(22, 1); |
1788 | } |
1789 | |
1790 | MeasureUnit *MeasureUnit::createBushel(UErrorCode &status) { |
1791 | return MeasureUnit::create(22, 2, status); |
1792 | } |
1793 | |
1794 | MeasureUnit MeasureUnit::getBushel() { |
1795 | return MeasureUnit(22, 2); |
1796 | } |
1797 | |
1798 | MeasureUnit *MeasureUnit::createCentiliter(UErrorCode &status) { |
1799 | return MeasureUnit::create(22, 3, status); |
1800 | } |
1801 | |
1802 | MeasureUnit MeasureUnit::getCentiliter() { |
1803 | return MeasureUnit(22, 3); |
1804 | } |
1805 | |
1806 | MeasureUnit *MeasureUnit::createCubicCentimeter(UErrorCode &status) { |
1807 | return MeasureUnit::create(22, 4, status); |
1808 | } |
1809 | |
1810 | MeasureUnit MeasureUnit::getCubicCentimeter() { |
1811 | return MeasureUnit(22, 4); |
1812 | } |
1813 | |
1814 | MeasureUnit *MeasureUnit::(UErrorCode &status) { |
1815 | return MeasureUnit::create(22, 5, status); |
1816 | } |
1817 | |
1818 | MeasureUnit MeasureUnit::() { |
1819 | return MeasureUnit(22, 5); |
1820 | } |
1821 | |
1822 | MeasureUnit *MeasureUnit::createCubicInch(UErrorCode &status) { |
1823 | return MeasureUnit::create(22, 6, status); |
1824 | } |
1825 | |
1826 | MeasureUnit MeasureUnit::getCubicInch() { |
1827 | return MeasureUnit(22, 6); |
1828 | } |
1829 | |
1830 | MeasureUnit *MeasureUnit::createCubicKilometer(UErrorCode &status) { |
1831 | return MeasureUnit::create(22, 7, status); |
1832 | } |
1833 | |
1834 | MeasureUnit MeasureUnit::getCubicKilometer() { |
1835 | return MeasureUnit(22, 7); |
1836 | } |
1837 | |
1838 | MeasureUnit *MeasureUnit::createCubicMeter(UErrorCode &status) { |
1839 | return MeasureUnit::create(22, 8, status); |
1840 | } |
1841 | |
1842 | MeasureUnit MeasureUnit::getCubicMeter() { |
1843 | return MeasureUnit(22, 8); |
1844 | } |
1845 | |
1846 | MeasureUnit *MeasureUnit::createCubicMile(UErrorCode &status) { |
1847 | return MeasureUnit::create(22, 9, status); |
1848 | } |
1849 | |
1850 | MeasureUnit MeasureUnit::getCubicMile() { |
1851 | return MeasureUnit(22, 9); |
1852 | } |
1853 | |
1854 | MeasureUnit *MeasureUnit::createCubicYard(UErrorCode &status) { |
1855 | return MeasureUnit::create(22, 10, status); |
1856 | } |
1857 | |
1858 | MeasureUnit MeasureUnit::getCubicYard() { |
1859 | return MeasureUnit(22, 10); |
1860 | } |
1861 | |
1862 | MeasureUnit *MeasureUnit::createCup(UErrorCode &status) { |
1863 | return MeasureUnit::create(22, 11, status); |
1864 | } |
1865 | |
1866 | MeasureUnit MeasureUnit::getCup() { |
1867 | return MeasureUnit(22, 11); |
1868 | } |
1869 | |
1870 | MeasureUnit *MeasureUnit::createCupMetric(UErrorCode &status) { |
1871 | return MeasureUnit::create(22, 12, status); |
1872 | } |
1873 | |
1874 | MeasureUnit MeasureUnit::getCupMetric() { |
1875 | return MeasureUnit(22, 12); |
1876 | } |
1877 | |
1878 | MeasureUnit *MeasureUnit::createDeciliter(UErrorCode &status) { |
1879 | return MeasureUnit::create(22, 13, status); |
1880 | } |
1881 | |
1882 | MeasureUnit MeasureUnit::getDeciliter() { |
1883 | return MeasureUnit(22, 13); |
1884 | } |
1885 | |
1886 | MeasureUnit *MeasureUnit::createFluidOunce(UErrorCode &status) { |
1887 | return MeasureUnit::create(22, 14, status); |
1888 | } |
1889 | |
1890 | MeasureUnit MeasureUnit::getFluidOunce() { |
1891 | return MeasureUnit(22, 14); |
1892 | } |
1893 | |
1894 | MeasureUnit *MeasureUnit::createFluidOunceImperial(UErrorCode &status) { |
1895 | return MeasureUnit::create(22, 15, status); |
1896 | } |
1897 | |
1898 | MeasureUnit MeasureUnit::getFluidOunceImperial() { |
1899 | return MeasureUnit(22, 15); |
1900 | } |
1901 | |
1902 | MeasureUnit *MeasureUnit::createGallon(UErrorCode &status) { |
1903 | return MeasureUnit::create(22, 16, status); |
1904 | } |
1905 | |
1906 | MeasureUnit MeasureUnit::getGallon() { |
1907 | return MeasureUnit(22, 16); |
1908 | } |
1909 | |
1910 | MeasureUnit *MeasureUnit::createGallonImperial(UErrorCode &status) { |
1911 | return MeasureUnit::create(22, 17, status); |
1912 | } |
1913 | |
1914 | MeasureUnit MeasureUnit::getGallonImperial() { |
1915 | return MeasureUnit(22, 17); |
1916 | } |
1917 | |
1918 | MeasureUnit *MeasureUnit::createHectoliter(UErrorCode &status) { |
1919 | return MeasureUnit::create(22, 18, status); |
1920 | } |
1921 | |
1922 | MeasureUnit MeasureUnit::getHectoliter() { |
1923 | return MeasureUnit(22, 18); |
1924 | } |
1925 | |
1926 | MeasureUnit *MeasureUnit::createLiter(UErrorCode &status) { |
1927 | return MeasureUnit::create(22, 19, status); |
1928 | } |
1929 | |
1930 | MeasureUnit MeasureUnit::getLiter() { |
1931 | return MeasureUnit(22, 19); |
1932 | } |
1933 | |
1934 | MeasureUnit *MeasureUnit::createMegaliter(UErrorCode &status) { |
1935 | return MeasureUnit::create(22, 20, status); |
1936 | } |
1937 | |
1938 | MeasureUnit MeasureUnit::getMegaliter() { |
1939 | return MeasureUnit(22, 20); |
1940 | } |
1941 | |
1942 | MeasureUnit *MeasureUnit::createMilliliter(UErrorCode &status) { |
1943 | return MeasureUnit::create(22, 21, status); |
1944 | } |
1945 | |
1946 | MeasureUnit MeasureUnit::getMilliliter() { |
1947 | return MeasureUnit(22, 21); |
1948 | } |
1949 | |
1950 | MeasureUnit *MeasureUnit::createPint(UErrorCode &status) { |
1951 | return MeasureUnit::create(22, 22, status); |
1952 | } |
1953 | |
1954 | MeasureUnit MeasureUnit::getPint() { |
1955 | return MeasureUnit(22, 22); |
1956 | } |
1957 | |
1958 | MeasureUnit *MeasureUnit::createPintMetric(UErrorCode &status) { |
1959 | return MeasureUnit::create(22, 23, status); |
1960 | } |
1961 | |
1962 | MeasureUnit MeasureUnit::getPintMetric() { |
1963 | return MeasureUnit(22, 23); |
1964 | } |
1965 | |
1966 | MeasureUnit *MeasureUnit::createQuart(UErrorCode &status) { |
1967 | return MeasureUnit::create(22, 24, status); |
1968 | } |
1969 | |
1970 | MeasureUnit MeasureUnit::getQuart() { |
1971 | return MeasureUnit(22, 24); |
1972 | } |
1973 | |
1974 | MeasureUnit *MeasureUnit::createTablespoon(UErrorCode &status) { |
1975 | return MeasureUnit::create(22, 25, status); |
1976 | } |
1977 | |
1978 | MeasureUnit MeasureUnit::getTablespoon() { |
1979 | return MeasureUnit(22, 25); |
1980 | } |
1981 | |
1982 | MeasureUnit *MeasureUnit::createTeaspoon(UErrorCode &status) { |
1983 | return MeasureUnit::create(22, 26, status); |
1984 | } |
1985 | |
1986 | MeasureUnit MeasureUnit::getTeaspoon() { |
1987 | return MeasureUnit(22, 26); |
1988 | } |
1989 | |
1990 | // End generated code |
1991 | |
1992 | static 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 | |
2009 | MeasureUnit::MeasureUnit() { |
2010 | fCurrency[0] = 0; |
2011 | fTypeId = kBaseTypeIdx; |
2012 | fSubTypeId = kBaseSubTypeIdx; |
2013 | } |
2014 | |
2015 | MeasureUnit::MeasureUnit(const MeasureUnit &other) |
2016 | : fTypeId(other.fTypeId), fSubTypeId(other.fSubTypeId) { |
2017 | uprv_strcpy(fCurrency, other.fCurrency); |
2018 | } |
2019 | |
2020 | MeasureUnit &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 | |
2030 | MeasureUnit *MeasureUnit::clone() const { |
2031 | return new MeasureUnit(*this); |
2032 | } |
2033 | |
2034 | MeasureUnit::~MeasureUnit() { |
2035 | } |
2036 | |
2037 | const char *MeasureUnit::getType() const { |
2038 | return gTypes[fTypeId]; |
2039 | } |
2040 | |
2041 | const char *MeasureUnit::getSubtype() const { |
2042 | return fCurrency[0] == 0 ? gSubTypes[getOffset()] : fCurrency; |
2043 | } |
2044 | |
2045 | UBool 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 | |
2059 | int32_t MeasureUnit::getIndex() const { |
2060 | return gIndexes[fTypeId] + fSubTypeId; |
2061 | } |
2062 | |
2063 | int32_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 | |
2086 | int32_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 | |
2109 | StringEnumeration* 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 | |
2125 | int32_t MeasureUnit::getIndexCount() { |
2126 | return gIndexes[UPRV_LENGTHOF(gIndexes) - 1]; |
2127 | } |
2128 | |
2129 | int32_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 | |
2141 | MeasureUnit 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 | |
2172 | MeasureUnit *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 | |
2183 | void 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 | |
2192 | void 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 | |
2206 | void 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 | |
2215 | void MeasureUnit::setTo(int32_t typeId, int32_t subTypeId) { |
2216 | fTypeId = typeId; |
2217 | fSubTypeId = subTypeId; |
2218 | fCurrency[0] = 0; |
2219 | } |
2220 | |
2221 | int32_t MeasureUnit::getOffset() const { |
2222 | return gOffsets[fTypeId] + fSubTypeId; |
2223 | } |
2224 | |
2225 | U_NAMESPACE_END |
2226 | |
2227 | #endif /* !UNCONFIG_NO_FORMATTING */ |
2228 | |