measunit.cpp 52 KB

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