measunit.h 108 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. **********************************************************************
  5. * Copyright (c) 2004-2016, International Business Machines
  6. * Corporation and others. All Rights Reserved.
  7. **********************************************************************
  8. * Author: Alan Liu
  9. * Created: April 26, 2004
  10. * Since: ICU 3.0
  11. **********************************************************************
  12. */
  13. #ifndef __MEASUREUNIT_H__
  14. #define __MEASUREUNIT_H__
  15. #include "unicode/utypes.h"
  16. #if U_SHOW_CPLUSPLUS_API
  17. #if !UCONFIG_NO_FORMATTING
  18. #include <utility>
  19. #include "unicode/unistr.h"
  20. #include "unicode/localpointer.h"
  21. /**
  22. * \file
  23. * \brief C++ API: A unit for measuring a quantity.
  24. */
  25. U_NAMESPACE_BEGIN
  26. class StringEnumeration;
  27. class MeasureUnitImpl;
  28. namespace number::impl {
  29. class LongNameHandler;
  30. } // namespace number::impl
  31. /**
  32. * Enumeration for unit complexity. There are three levels:
  33. *
  34. * - SINGLE: A single unit, optionally with a power and/or SI or binary prefix.
  35. * Examples: hectare, square-kilometer, kilojoule, per-second, mebibyte.
  36. * - COMPOUND: A unit composed of the product of multiple single units. Examples:
  37. * meter-per-second, kilowatt-hour, kilogram-meter-per-square-second.
  38. * - MIXED: A unit composed of the sum of multiple single units. Examples: foot+inch,
  39. * hour+minute+second, degree+arcminute+arcsecond.
  40. *
  41. * The complexity determines which operations are available. For example, you cannot set the power
  42. * or prefix of a compound unit.
  43. *
  44. * @stable ICU 67
  45. */
  46. enum UMeasureUnitComplexity {
  47. /**
  48. * A single unit, like kilojoule.
  49. *
  50. * @stable ICU 67
  51. */
  52. UMEASURE_UNIT_SINGLE,
  53. /**
  54. * A compound unit, like meter-per-second.
  55. *
  56. * @stable ICU 67
  57. */
  58. UMEASURE_UNIT_COMPOUND,
  59. /**
  60. * A mixed unit, like hour+minute.
  61. *
  62. * @stable ICU 67
  63. */
  64. UMEASURE_UNIT_MIXED
  65. };
  66. /**
  67. * Enumeration for SI and binary prefixes, e.g. "kilo-", "nano-", "mebi-".
  68. *
  69. * Enum values should be treated as opaque: use umeas_getPrefixPower() and
  70. * umeas_getPrefixBase() to find their corresponding values.
  71. *
  72. * @stable ICU 69
  73. * @see umeas_getPrefixBase
  74. * @see umeas_getPrefixPower
  75. */
  76. typedef enum UMeasurePrefix {
  77. /**
  78. * The absence of an SI or binary prefix.
  79. *
  80. * The integer representation of this enum value is an arbitrary
  81. * implementation detail and should not be relied upon: use
  82. * umeas_getPrefixPower() to obtain meaningful values.
  83. *
  84. * @stable ICU 69
  85. */
  86. UMEASURE_PREFIX_ONE = 30 + 0,
  87. /**
  88. * SI prefix: yotta, 10^24.
  89. *
  90. * @stable ICU 69
  91. */
  92. UMEASURE_PREFIX_YOTTA = UMEASURE_PREFIX_ONE + 24,
  93. #ifndef U_HIDE_DRAFT_API
  94. /**
  95. * SI prefix: ronna, 10^27.
  96. *
  97. * @draft ICU 75
  98. */
  99. UMEASURE_PREFIX_RONNA = UMEASURE_PREFIX_ONE + 27,
  100. /**
  101. * SI prefix: quetta, 10^30.
  102. *
  103. * @draft ICU 75
  104. */
  105. UMEASURE_PREFIX_QUETTA = UMEASURE_PREFIX_ONE + 30,
  106. #endif /* U_HIDE_DRAFT_API */
  107. #ifndef U_HIDE_INTERNAL_API
  108. /**
  109. * ICU use only.
  110. * Used to determine the set of base-10 SI prefixes.
  111. * @internal
  112. */
  113. #ifndef U_HIDE_DRAFT_API
  114. UMEASURE_PREFIX_INTERNAL_MAX_SI = UMEASURE_PREFIX_QUETTA,
  115. #else /* U_HIDE_DRAFT_API */
  116. UMEASURE_PREFIX_INTERNAL_MAX_SI = UMEASURE_PREFIX_YOTTA,
  117. #endif /* U_HIDE_DRAFT_API */
  118. #endif /* U_HIDE_INTERNAL_API */
  119. /**
  120. * SI prefix: zetta, 10^21.
  121. *
  122. * @stable ICU 69
  123. */
  124. UMEASURE_PREFIX_ZETTA = UMEASURE_PREFIX_ONE + 21,
  125. /**
  126. * SI prefix: exa, 10^18.
  127. *
  128. * @stable ICU 69
  129. */
  130. UMEASURE_PREFIX_EXA = UMEASURE_PREFIX_ONE + 18,
  131. /**
  132. * SI prefix: peta, 10^15.
  133. *
  134. * @stable ICU 69
  135. */
  136. UMEASURE_PREFIX_PETA = UMEASURE_PREFIX_ONE + 15,
  137. /**
  138. * SI prefix: tera, 10^12.
  139. *
  140. * @stable ICU 69
  141. */
  142. UMEASURE_PREFIX_TERA = UMEASURE_PREFIX_ONE + 12,
  143. /**
  144. * SI prefix: giga, 10^9.
  145. *
  146. * @stable ICU 69
  147. */
  148. UMEASURE_PREFIX_GIGA = UMEASURE_PREFIX_ONE + 9,
  149. /**
  150. * SI prefix: mega, 10^6.
  151. *
  152. * @stable ICU 69
  153. */
  154. UMEASURE_PREFIX_MEGA = UMEASURE_PREFIX_ONE + 6,
  155. /**
  156. * SI prefix: kilo, 10^3.
  157. *
  158. * @stable ICU 69
  159. */
  160. UMEASURE_PREFIX_KILO = UMEASURE_PREFIX_ONE + 3,
  161. /**
  162. * SI prefix: hecto, 10^2.
  163. *
  164. * @stable ICU 69
  165. */
  166. UMEASURE_PREFIX_HECTO = UMEASURE_PREFIX_ONE + 2,
  167. /**
  168. * SI prefix: deka, 10^1.
  169. *
  170. * @stable ICU 69
  171. */
  172. UMEASURE_PREFIX_DEKA = UMEASURE_PREFIX_ONE + 1,
  173. /**
  174. * SI prefix: deci, 10^-1.
  175. *
  176. * @stable ICU 69
  177. */
  178. UMEASURE_PREFIX_DECI = UMEASURE_PREFIX_ONE + -1,
  179. /**
  180. * SI prefix: centi, 10^-2.
  181. *
  182. * @stable ICU 69
  183. */
  184. UMEASURE_PREFIX_CENTI = UMEASURE_PREFIX_ONE + -2,
  185. /**
  186. * SI prefix: milli, 10^-3.
  187. *
  188. * @stable ICU 69
  189. */
  190. UMEASURE_PREFIX_MILLI = UMEASURE_PREFIX_ONE + -3,
  191. /**
  192. * SI prefix: micro, 10^-6.
  193. *
  194. * @stable ICU 69
  195. */
  196. UMEASURE_PREFIX_MICRO = UMEASURE_PREFIX_ONE + -6,
  197. /**
  198. * SI prefix: nano, 10^-9.
  199. *
  200. * @stable ICU 69
  201. */
  202. UMEASURE_PREFIX_NANO = UMEASURE_PREFIX_ONE + -9,
  203. /**
  204. * SI prefix: pico, 10^-12.
  205. *
  206. * @stable ICU 69
  207. */
  208. UMEASURE_PREFIX_PICO = UMEASURE_PREFIX_ONE + -12,
  209. /**
  210. * SI prefix: femto, 10^-15.
  211. *
  212. * @stable ICU 69
  213. */
  214. UMEASURE_PREFIX_FEMTO = UMEASURE_PREFIX_ONE + -15,
  215. /**
  216. * SI prefix: atto, 10^-18.
  217. *
  218. * @stable ICU 69
  219. */
  220. UMEASURE_PREFIX_ATTO = UMEASURE_PREFIX_ONE + -18,
  221. /**
  222. * SI prefix: zepto, 10^-21.
  223. *
  224. * @stable ICU 69
  225. */
  226. UMEASURE_PREFIX_ZEPTO = UMEASURE_PREFIX_ONE + -21,
  227. /**
  228. * SI prefix: yocto, 10^-24.
  229. *
  230. * @stable ICU 69
  231. */
  232. UMEASURE_PREFIX_YOCTO = UMEASURE_PREFIX_ONE + -24,
  233. #ifndef U_HIDE_DRAFT_API
  234. /**
  235. * SI prefix: ronto, 10^-27.
  236. *
  237. * @draft ICU 75
  238. */
  239. UMEASURE_PREFIX_RONTO = UMEASURE_PREFIX_ONE + -27,
  240. /**
  241. * SI prefix: quecto, 10^-30.
  242. *
  243. * @draft ICU 75
  244. */
  245. UMEASURE_PREFIX_QUECTO = UMEASURE_PREFIX_ONE + -30,
  246. #endif /* U_HIDE_DRAFT_API */
  247. #ifndef U_HIDE_INTERNAL_API
  248. /**
  249. * ICU use only.
  250. * Used to determine the set of base-10 SI prefixes.
  251. * @internal
  252. */
  253. #ifndef U_HIDE_DRAFT_API
  254. UMEASURE_PREFIX_INTERNAL_MIN_SI = UMEASURE_PREFIX_QUECTO,
  255. #else /* U_HIDE_DRAFT_API */
  256. UMEASURE_PREFIX_INTERNAL_MIN_SI = UMEASURE_PREFIX_YOCTO,
  257. #endif /* U_HIDE_DRAFT_API */
  258. #endif // U_HIDE_INTERNAL_API
  259. // Cannot conditionalize the following with #ifndef U_HIDE_INTERNAL_API,
  260. // used in definitions of non-internal enum values
  261. /**
  262. * ICU use only.
  263. * Sets the arbitrary offset of the base-1024 binary prefixes' enum values.
  264. * @internal
  265. */
  266. UMEASURE_PREFIX_INTERNAL_ONE_BIN = -60,
  267. /**
  268. * Binary prefix: kibi, 1024^1.
  269. *
  270. * @stable ICU 69
  271. */
  272. UMEASURE_PREFIX_KIBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 1,
  273. #ifndef U_HIDE_INTERNAL_API
  274. /**
  275. * ICU use only.
  276. * Used to determine the set of base-1024 binary prefixes.
  277. * @internal
  278. */
  279. UMEASURE_PREFIX_INTERNAL_MIN_BIN = UMEASURE_PREFIX_KIBI,
  280. #endif // U_HIDE_INTERNAL_API
  281. /**
  282. * Binary prefix: mebi, 1024^2.
  283. *
  284. * @stable ICU 69
  285. */
  286. UMEASURE_PREFIX_MEBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 2,
  287. /**
  288. * Binary prefix: gibi, 1024^3.
  289. *
  290. * @stable ICU 69
  291. */
  292. UMEASURE_PREFIX_GIBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 3,
  293. /**
  294. * Binary prefix: tebi, 1024^4.
  295. *
  296. * @stable ICU 69
  297. */
  298. UMEASURE_PREFIX_TEBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 4,
  299. /**
  300. * Binary prefix: pebi, 1024^5.
  301. *
  302. * @stable ICU 69
  303. */
  304. UMEASURE_PREFIX_PEBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 5,
  305. /**
  306. * Binary prefix: exbi, 1024^6.
  307. *
  308. * @stable ICU 69
  309. */
  310. UMEASURE_PREFIX_EXBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 6,
  311. /**
  312. * Binary prefix: zebi, 1024^7.
  313. *
  314. * @stable ICU 69
  315. */
  316. UMEASURE_PREFIX_ZEBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 7,
  317. /**
  318. * Binary prefix: yobi, 1024^8.
  319. *
  320. * @stable ICU 69
  321. */
  322. UMEASURE_PREFIX_YOBI = UMEASURE_PREFIX_INTERNAL_ONE_BIN + 8,
  323. #ifndef U_HIDE_INTERNAL_API
  324. /**
  325. * ICU use only.
  326. * Used to determine the set of base-1024 binary prefixes.
  327. * @internal
  328. */
  329. UMEASURE_PREFIX_INTERNAL_MAX_BIN = UMEASURE_PREFIX_YOBI,
  330. #endif // U_HIDE_INTERNAL_API
  331. } UMeasurePrefix;
  332. /**
  333. * Returns the base of the factor associated with the given unit prefix: the
  334. * base is 10 for SI prefixes (kilo, micro) and 1024 for binary prefixes (kibi,
  335. * mebi).
  336. *
  337. * @stable ICU 69
  338. */
  339. U_CAPI int32_t U_EXPORT2 umeas_getPrefixBase(UMeasurePrefix unitPrefix);
  340. /**
  341. * Returns the exponent of the factor associated with the given unit prefix, for
  342. * example 3 for kilo, -6 for micro, 1 for kibi, 2 for mebi, 3 for gibi.
  343. *
  344. * @stable ICU 69
  345. */
  346. U_CAPI int32_t U_EXPORT2 umeas_getPrefixPower(UMeasurePrefix unitPrefix);
  347. /**
  348. * A unit such as length, mass, volume, currency, etc. A unit is
  349. * coupled with a numeric amount to produce a Measure.
  350. *
  351. * @author Alan Liu
  352. * @stable ICU 3.0
  353. */
  354. class U_I18N_API MeasureUnit: public UObject {
  355. public:
  356. /**
  357. * Default constructor.
  358. * Populates the instance with the base dimensionless unit, which means that there will be
  359. * no unit on the formatted number.
  360. * @stable ICU 3.0
  361. */
  362. MeasureUnit();
  363. /**
  364. * Copy constructor.
  365. * @stable ICU 3.0
  366. */
  367. MeasureUnit(const MeasureUnit &other);
  368. /**
  369. * Move constructor.
  370. * @stable ICU 67
  371. */
  372. MeasureUnit(MeasureUnit &&other) noexcept;
  373. /**
  374. * Construct a MeasureUnit from a CLDR Core Unit Identifier, defined in UTS
  375. * 35. (Core unit identifiers and mixed unit identifiers are supported, long
  376. * unit identifiers are not.) Validates and canonicalizes the identifier.
  377. *
  378. * <pre>
  379. * MeasureUnit example = MeasureUnit::forIdentifier("furlong-per-nanosecond")
  380. * </pre>
  381. *
  382. * @param identifier The CLDR Unit Identifier.
  383. * @param status Set if the identifier is invalid.
  384. * @stable ICU 67
  385. */
  386. static MeasureUnit forIdentifier(StringPiece identifier, UErrorCode& status);
  387. /**
  388. * Copy assignment operator.
  389. * @stable ICU 3.0
  390. */
  391. MeasureUnit &operator=(const MeasureUnit &other);
  392. /**
  393. * Move assignment operator.
  394. * @stable ICU 67
  395. */
  396. MeasureUnit &operator=(MeasureUnit &&other) noexcept;
  397. /**
  398. * Returns a polymorphic clone of this object. The result will
  399. * have the same class as returned by getDynamicClassID().
  400. * @stable ICU 3.0
  401. */
  402. virtual MeasureUnit* clone() const;
  403. /**
  404. * Destructor
  405. * @stable ICU 3.0
  406. */
  407. virtual ~MeasureUnit();
  408. /**
  409. * Equality operator. Return true if this object is equal
  410. * to the given object.
  411. * @stable ICU 3.0
  412. */
  413. virtual bool operator==(const UObject& other) const;
  414. /**
  415. * Inequality operator. Return true if this object is not equal
  416. * to the given object.
  417. * @stable ICU 53
  418. */
  419. bool operator!=(const UObject& other) const {
  420. return !(*this == other);
  421. }
  422. /**
  423. * Get the type.
  424. *
  425. * If the unit does not have a type, the empty string is returned.
  426. *
  427. * @stable ICU 53
  428. */
  429. const char *getType() const;
  430. /**
  431. * Get the sub type.
  432. *
  433. * If the unit does not have a subtype, the empty string is returned.
  434. *
  435. * @stable ICU 53
  436. */
  437. const char *getSubtype() const;
  438. /**
  439. * Get CLDR Unit Identifier for this MeasureUnit, as defined in UTS 35.
  440. *
  441. * @return The string form of this unit, owned by this MeasureUnit.
  442. * @stable ICU 67
  443. */
  444. const char* getIdentifier() const;
  445. /**
  446. * Compute the complexity of the unit. See UMeasureUnitComplexity for more information.
  447. *
  448. * @param status Set if an error occurs.
  449. * @return The unit complexity.
  450. * @stable ICU 67
  451. */
  452. UMeasureUnitComplexity getComplexity(UErrorCode& status) const;
  453. /**
  454. * Creates a MeasureUnit which is this SINGLE unit augmented with the specified prefix.
  455. * For example, UMEASURE_PREFIX_KILO for "kilo", or UMEASURE_PREFIX_KIBI for "kibi".
  456. *
  457. * There is sufficient locale data to format all standard prefixes.
  458. *
  459. * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
  460. * occur. For more information, see UMeasureUnitComplexity.
  461. *
  462. * @param prefix The prefix, from UMeasurePrefix.
  463. * @param status Set if this is not a SINGLE unit or if another error occurs.
  464. * @return A new SINGLE unit.
  465. * @stable ICU 69
  466. */
  467. MeasureUnit withPrefix(UMeasurePrefix prefix, UErrorCode& status) const;
  468. /**
  469. * Returns the current SI or binary prefix of this SINGLE unit. For example,
  470. * if the unit has the prefix "kilo", then UMEASURE_PREFIX_KILO is
  471. * returned.
  472. *
  473. * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
  474. * occur. For more information, see UMeasureUnitComplexity.
  475. *
  476. * @param status Set if this is not a SINGLE unit or if another error occurs.
  477. * @return The prefix of this SINGLE unit, from UMeasurePrefix.
  478. * @see umeas_getPrefixBase
  479. * @see umeas_getPrefixPower
  480. * @stable ICU 69
  481. */
  482. UMeasurePrefix getPrefix(UErrorCode& status) const;
  483. /**
  484. * Creates a MeasureUnit which is this SINGLE unit augmented with the specified dimensionality
  485. * (power). For example, if dimensionality is 2, the unit will be squared.
  486. *
  487. * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
  488. * occur. For more information, see UMeasureUnitComplexity.
  489. *
  490. * For the base dimensionless unit, withDimensionality does nothing.
  491. *
  492. * @param dimensionality The dimensionality (power).
  493. * @param status Set if this is not a SINGLE unit or if another error occurs.
  494. * @return A new SINGLE unit.
  495. * @stable ICU 67
  496. */
  497. MeasureUnit withDimensionality(int32_t dimensionality, UErrorCode& status) const;
  498. /**
  499. * Gets the dimensionality (power) of this MeasureUnit. For example, if the unit is square,
  500. * then 2 is returned.
  501. *
  502. * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
  503. * occur. For more information, see UMeasureUnitComplexity.
  504. *
  505. * For the base dimensionless unit, getDimensionality returns 0.
  506. *
  507. * @param status Set if this is not a SINGLE unit or if another error occurs.
  508. * @return The dimensionality (power) of this simple unit.
  509. * @stable ICU 67
  510. */
  511. int32_t getDimensionality(UErrorCode& status) const;
  512. /**
  513. * Gets the reciprocal of this MeasureUnit, with the numerator and denominator flipped.
  514. *
  515. * For example, if the receiver is "meter-per-second", the unit "second-per-meter" is returned.
  516. *
  517. * NOTE: Only works on SINGLE and COMPOUND units. If this is a MIXED unit, an error will
  518. * occur. For more information, see UMeasureUnitComplexity.
  519. *
  520. * @param status Set if this is a MIXED unit or if another error occurs.
  521. * @return The reciprocal of the target unit.
  522. * @stable ICU 67
  523. */
  524. MeasureUnit reciprocal(UErrorCode& status) const;
  525. /**
  526. * Gets the product of this unit with another unit. This is a way to build units from
  527. * constituent parts.
  528. *
  529. * The numerator and denominator are preserved through this operation.
  530. *
  531. * For example, if the receiver is "kilowatt" and the argument is "hour-per-day", then the
  532. * unit "kilowatt-hour-per-day" is returned.
  533. *
  534. * NOTE: Only works on SINGLE and COMPOUND units. If either unit (receiver and argument) is a
  535. * MIXED unit, an error will occur. For more information, see UMeasureUnitComplexity.
  536. *
  537. * @param other The MeasureUnit to multiply with the target.
  538. * @param status Set if this or other is a MIXED unit or if another error occurs.
  539. * @return The product of the target unit with the provided unit.
  540. * @stable ICU 67
  541. */
  542. MeasureUnit product(const MeasureUnit& other, UErrorCode& status) const;
  543. /**
  544. * Gets the list of SINGLE units contained within a MIXED or COMPOUND unit.
  545. *
  546. * Examples:
  547. * - Given "meter-kilogram-per-second", three units will be returned: "meter",
  548. * "kilogram", and "per-second".
  549. * - Given "hour+minute+second", three units will be returned: "hour", "minute",
  550. * and "second".
  551. *
  552. * If this is a SINGLE unit, an array of length 1 will be returned.
  553. *
  554. * @param status Set if an error occurs.
  555. * @return A pair with the list of units as a LocalArray and the number of units in the list.
  556. * @stable ICU 68
  557. */
  558. inline std::pair<LocalArray<MeasureUnit>, int32_t> splitToSingleUnits(UErrorCode& status) const;
  559. /**
  560. * getAvailable gets all of the available units.
  561. * If there are too many units to fit into destCapacity then the
  562. * error code is set to U_BUFFER_OVERFLOW_ERROR.
  563. *
  564. * @param destArray destination buffer.
  565. * @param destCapacity number of MeasureUnit instances available at dest.
  566. * @param errorCode ICU error code.
  567. * @return number of available units.
  568. * @stable ICU 53
  569. */
  570. static int32_t getAvailable(
  571. MeasureUnit *destArray,
  572. int32_t destCapacity,
  573. UErrorCode &errorCode);
  574. /**
  575. * getAvailable gets all of the available units for a specific type.
  576. * If there are too many units to fit into destCapacity then the
  577. * error code is set to U_BUFFER_OVERFLOW_ERROR.
  578. *
  579. * @param type the type
  580. * @param destArray destination buffer.
  581. * @param destCapacity number of MeasureUnit instances available at dest.
  582. * @param errorCode ICU error code.
  583. * @return number of available units for type.
  584. * @stable ICU 53
  585. */
  586. static int32_t getAvailable(
  587. const char *type,
  588. MeasureUnit *destArray,
  589. int32_t destCapacity,
  590. UErrorCode &errorCode);
  591. /**
  592. * getAvailableTypes gets all of the available types. Caller owns the
  593. * returned StringEnumeration and must delete it when finished using it.
  594. *
  595. * @param errorCode ICU error code.
  596. * @return the types.
  597. * @stable ICU 53
  598. */
  599. static StringEnumeration* getAvailableTypes(UErrorCode &errorCode);
  600. /**
  601. * Return the class ID for this class. This is useful only for comparing to
  602. * a return value from getDynamicClassID(). For example:
  603. * <pre>
  604. * . Base* polymorphic_pointer = createPolymorphicObject();
  605. * . if (polymorphic_pointer->getDynamicClassID() ==
  606. * . Derived::getStaticClassID()) ...
  607. * </pre>
  608. * @return The class ID for all objects of this class.
  609. * @stable ICU 53
  610. */
  611. static UClassID U_EXPORT2 getStaticClassID();
  612. /**
  613. * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
  614. * method is to implement a simple version of RTTI, since not all C++
  615. * compilers support genuine RTTI. Polymorphic operator==() and clone()
  616. * methods call this method.
  617. *
  618. * @return The class ID for this object. All objects of a
  619. * given class have the same class ID. Objects of
  620. * other classes have different class IDs.
  621. * @stable ICU 53
  622. */
  623. virtual UClassID getDynamicClassID() const override;
  624. #ifndef U_HIDE_INTERNAL_API
  625. /**
  626. * ICU use only.
  627. * Returns associated array index for this measure unit.
  628. * @internal
  629. */
  630. int32_t getOffset() const;
  631. #endif /* U_HIDE_INTERNAL_API */
  632. // All code between the "Start generated createXXX methods" comment and
  633. // the "End generated createXXX methods" comment is auto generated code
  634. // and must not be edited manually. For instructions on how to correctly
  635. // update this code, refer to:
  636. // docs/processes/release/tasks/updating-measure-unit.md
  637. //
  638. // Start generated createXXX methods
  639. /**
  640. * Returns by pointer, unit of acceleration: g-force.
  641. * Caller owns returned value and must free it.
  642. * Also see {@link #getGForce()}.
  643. * @param status ICU error code.
  644. * @stable ICU 53
  645. */
  646. static MeasureUnit *createGForce(UErrorCode &status);
  647. /**
  648. * Returns by value, unit of acceleration: g-force.
  649. * Also see {@link #createGForce()}.
  650. * @stable ICU 64
  651. */
  652. static MeasureUnit getGForce();
  653. /**
  654. * Returns by pointer, unit of acceleration: meter-per-square-second.
  655. * Caller owns returned value and must free it.
  656. * Also see {@link #getMeterPerSecondSquared()}.
  657. * @param status ICU error code.
  658. * @stable ICU 54
  659. */
  660. static MeasureUnit *createMeterPerSecondSquared(UErrorCode &status);
  661. /**
  662. * Returns by value, unit of acceleration: meter-per-square-second.
  663. * Also see {@link #createMeterPerSecondSquared()}.
  664. * @stable ICU 64
  665. */
  666. static MeasureUnit getMeterPerSecondSquared();
  667. /**
  668. * Returns by pointer, unit of angle: arc-minute.
  669. * Caller owns returned value and must free it.
  670. * Also see {@link #getArcMinute()}.
  671. * @param status ICU error code.
  672. * @stable ICU 53
  673. */
  674. static MeasureUnit *createArcMinute(UErrorCode &status);
  675. /**
  676. * Returns by value, unit of angle: arc-minute.
  677. * Also see {@link #createArcMinute()}.
  678. * @stable ICU 64
  679. */
  680. static MeasureUnit getArcMinute();
  681. /**
  682. * Returns by pointer, unit of angle: arc-second.
  683. * Caller owns returned value and must free it.
  684. * Also see {@link #getArcSecond()}.
  685. * @param status ICU error code.
  686. * @stable ICU 53
  687. */
  688. static MeasureUnit *createArcSecond(UErrorCode &status);
  689. /**
  690. * Returns by value, unit of angle: arc-second.
  691. * Also see {@link #createArcSecond()}.
  692. * @stable ICU 64
  693. */
  694. static MeasureUnit getArcSecond();
  695. /**
  696. * Returns by pointer, unit of angle: degree.
  697. * Caller owns returned value and must free it.
  698. * Also see {@link #getDegree()}.
  699. * @param status ICU error code.
  700. * @stable ICU 53
  701. */
  702. static MeasureUnit *createDegree(UErrorCode &status);
  703. /**
  704. * Returns by value, unit of angle: degree.
  705. * Also see {@link #createDegree()}.
  706. * @stable ICU 64
  707. */
  708. static MeasureUnit getDegree();
  709. /**
  710. * Returns by pointer, unit of angle: radian.
  711. * Caller owns returned value and must free it.
  712. * Also see {@link #getRadian()}.
  713. * @param status ICU error code.
  714. * @stable ICU 54
  715. */
  716. static MeasureUnit *createRadian(UErrorCode &status);
  717. /**
  718. * Returns by value, unit of angle: radian.
  719. * Also see {@link #createRadian()}.
  720. * @stable ICU 64
  721. */
  722. static MeasureUnit getRadian();
  723. /**
  724. * Returns by pointer, unit of angle: revolution.
  725. * Caller owns returned value and must free it.
  726. * Also see {@link #getRevolutionAngle()}.
  727. * @param status ICU error code.
  728. * @stable ICU 56
  729. */
  730. static MeasureUnit *createRevolutionAngle(UErrorCode &status);
  731. /**
  732. * Returns by value, unit of angle: revolution.
  733. * Also see {@link #createRevolutionAngle()}.
  734. * @stable ICU 64
  735. */
  736. static MeasureUnit getRevolutionAngle();
  737. /**
  738. * Returns by pointer, unit of area: acre.
  739. * Caller owns returned value and must free it.
  740. * Also see {@link #getAcre()}.
  741. * @param status ICU error code.
  742. * @stable ICU 53
  743. */
  744. static MeasureUnit *createAcre(UErrorCode &status);
  745. /**
  746. * Returns by value, unit of area: acre.
  747. * Also see {@link #createAcre()}.
  748. * @stable ICU 64
  749. */
  750. static MeasureUnit getAcre();
  751. /**
  752. * Returns by pointer, unit of area: dunam.
  753. * Caller owns returned value and must free it.
  754. * Also see {@link #getDunam()}.
  755. * @param status ICU error code.
  756. * @stable ICU 64
  757. */
  758. static MeasureUnit *createDunam(UErrorCode &status);
  759. /**
  760. * Returns by value, unit of area: dunam.
  761. * Also see {@link #createDunam()}.
  762. * @stable ICU 64
  763. */
  764. static MeasureUnit getDunam();
  765. /**
  766. * Returns by pointer, unit of area: hectare.
  767. * Caller owns returned value and must free it.
  768. * Also see {@link #getHectare()}.
  769. * @param status ICU error code.
  770. * @stable ICU 53
  771. */
  772. static MeasureUnit *createHectare(UErrorCode &status);
  773. /**
  774. * Returns by value, unit of area: hectare.
  775. * Also see {@link #createHectare()}.
  776. * @stable ICU 64
  777. */
  778. static MeasureUnit getHectare();
  779. /**
  780. * Returns by pointer, unit of area: square-centimeter.
  781. * Caller owns returned value and must free it.
  782. * Also see {@link #getSquareCentimeter()}.
  783. * @param status ICU error code.
  784. * @stable ICU 54
  785. */
  786. static MeasureUnit *createSquareCentimeter(UErrorCode &status);
  787. /**
  788. * Returns by value, unit of area: square-centimeter.
  789. * Also see {@link #createSquareCentimeter()}.
  790. * @stable ICU 64
  791. */
  792. static MeasureUnit getSquareCentimeter();
  793. /**
  794. * Returns by pointer, unit of area: square-foot.
  795. * Caller owns returned value and must free it.
  796. * Also see {@link #getSquareFoot()}.
  797. * @param status ICU error code.
  798. * @stable ICU 53
  799. */
  800. static MeasureUnit *createSquareFoot(UErrorCode &status);
  801. /**
  802. * Returns by value, unit of area: square-foot.
  803. * Also see {@link #createSquareFoot()}.
  804. * @stable ICU 64
  805. */
  806. static MeasureUnit getSquareFoot();
  807. /**
  808. * Returns by pointer, unit of area: square-inch.
  809. * Caller owns returned value and must free it.
  810. * Also see {@link #getSquareInch()}.
  811. * @param status ICU error code.
  812. * @stable ICU 54
  813. */
  814. static MeasureUnit *createSquareInch(UErrorCode &status);
  815. /**
  816. * Returns by value, unit of area: square-inch.
  817. * Also see {@link #createSquareInch()}.
  818. * @stable ICU 64
  819. */
  820. static MeasureUnit getSquareInch();
  821. /**
  822. * Returns by pointer, unit of area: square-kilometer.
  823. * Caller owns returned value and must free it.
  824. * Also see {@link #getSquareKilometer()}.
  825. * @param status ICU error code.
  826. * @stable ICU 53
  827. */
  828. static MeasureUnit *createSquareKilometer(UErrorCode &status);
  829. /**
  830. * Returns by value, unit of area: square-kilometer.
  831. * Also see {@link #createSquareKilometer()}.
  832. * @stable ICU 64
  833. */
  834. static MeasureUnit getSquareKilometer();
  835. /**
  836. * Returns by pointer, unit of area: square-meter.
  837. * Caller owns returned value and must free it.
  838. * Also see {@link #getSquareMeter()}.
  839. * @param status ICU error code.
  840. * @stable ICU 53
  841. */
  842. static MeasureUnit *createSquareMeter(UErrorCode &status);
  843. /**
  844. * Returns by value, unit of area: square-meter.
  845. * Also see {@link #createSquareMeter()}.
  846. * @stable ICU 64
  847. */
  848. static MeasureUnit getSquareMeter();
  849. /**
  850. * Returns by pointer, unit of area: square-mile.
  851. * Caller owns returned value and must free it.
  852. * Also see {@link #getSquareMile()}.
  853. * @param status ICU error code.
  854. * @stable ICU 53
  855. */
  856. static MeasureUnit *createSquareMile(UErrorCode &status);
  857. /**
  858. * Returns by value, unit of area: square-mile.
  859. * Also see {@link #createSquareMile()}.
  860. * @stable ICU 64
  861. */
  862. static MeasureUnit getSquareMile();
  863. /**
  864. * Returns by pointer, unit of area: square-yard.
  865. * Caller owns returned value and must free it.
  866. * Also see {@link #getSquareYard()}.
  867. * @param status ICU error code.
  868. * @stable ICU 54
  869. */
  870. static MeasureUnit *createSquareYard(UErrorCode &status);
  871. /**
  872. * Returns by value, unit of area: square-yard.
  873. * Also see {@link #createSquareYard()}.
  874. * @stable ICU 64
  875. */
  876. static MeasureUnit getSquareYard();
  877. /**
  878. * Returns by pointer, unit of concentr: item.
  879. * Caller owns returned value and must free it.
  880. * Also see {@link #getItem()}.
  881. * @param status ICU error code.
  882. * @stable ICU 70
  883. */
  884. static MeasureUnit *createItem(UErrorCode &status);
  885. /**
  886. * Returns by value, unit of concentr: item.
  887. * Also see {@link #createItem()}.
  888. * @stable ICU 70
  889. */
  890. static MeasureUnit getItem();
  891. /**
  892. * Returns by pointer, unit of concentr: karat.
  893. * Caller owns returned value and must free it.
  894. * Also see {@link #getKarat()}.
  895. * @param status ICU error code.
  896. * @stable ICU 54
  897. */
  898. static MeasureUnit *createKarat(UErrorCode &status);
  899. /**
  900. * Returns by value, unit of concentr: karat.
  901. * Also see {@link #createKarat()}.
  902. * @stable ICU 64
  903. */
  904. static MeasureUnit getKarat();
  905. /**
  906. * Returns by pointer, unit of concentr: milligram-ofglucose-per-deciliter.
  907. * Caller owns returned value and must free it.
  908. * Also see {@link #getMilligramOfglucosePerDeciliter()}.
  909. * @param status ICU error code.
  910. * @stable ICU 69
  911. */
  912. static MeasureUnit *createMilligramOfglucosePerDeciliter(UErrorCode &status);
  913. /**
  914. * Returns by value, unit of concentr: milligram-ofglucose-per-deciliter.
  915. * Also see {@link #createMilligramOfglucosePerDeciliter()}.
  916. * @stable ICU 69
  917. */
  918. static MeasureUnit getMilligramOfglucosePerDeciliter();
  919. /**
  920. * Returns by pointer, unit of concentr: milligram-per-deciliter.
  921. * Caller owns returned value and must free it.
  922. * Also see {@link #getMilligramPerDeciliter()}.
  923. * @param status ICU error code.
  924. * @stable ICU 57
  925. */
  926. static MeasureUnit *createMilligramPerDeciliter(UErrorCode &status);
  927. /**
  928. * Returns by value, unit of concentr: milligram-per-deciliter.
  929. * Also see {@link #createMilligramPerDeciliter()}.
  930. * @stable ICU 64
  931. */
  932. static MeasureUnit getMilligramPerDeciliter();
  933. /**
  934. * Returns by pointer, unit of concentr: millimole-per-liter.
  935. * Caller owns returned value and must free it.
  936. * Also see {@link #getMillimolePerLiter()}.
  937. * @param status ICU error code.
  938. * @stable ICU 57
  939. */
  940. static MeasureUnit *createMillimolePerLiter(UErrorCode &status);
  941. /**
  942. * Returns by value, unit of concentr: millimole-per-liter.
  943. * Also see {@link #createMillimolePerLiter()}.
  944. * @stable ICU 64
  945. */
  946. static MeasureUnit getMillimolePerLiter();
  947. /**
  948. * Returns by pointer, unit of concentr: mole.
  949. * Caller owns returned value and must free it.
  950. * Also see {@link #getMole()}.
  951. * @param status ICU error code.
  952. * @stable ICU 64
  953. */
  954. static MeasureUnit *createMole(UErrorCode &status);
  955. /**
  956. * Returns by value, unit of concentr: mole.
  957. * Also see {@link #createMole()}.
  958. * @stable ICU 64
  959. */
  960. static MeasureUnit getMole();
  961. /**
  962. * Returns by pointer, unit of concentr: percent.
  963. * Caller owns returned value and must free it.
  964. * Also see {@link #getPercent()}.
  965. * @param status ICU error code.
  966. * @stable ICU 63
  967. */
  968. static MeasureUnit *createPercent(UErrorCode &status);
  969. /**
  970. * Returns by value, unit of concentr: percent.
  971. * Also see {@link #createPercent()}.
  972. * @stable ICU 64
  973. */
  974. static MeasureUnit getPercent();
  975. /**
  976. * Returns by pointer, unit of concentr: permille.
  977. * Caller owns returned value and must free it.
  978. * Also see {@link #getPermille()}.
  979. * @param status ICU error code.
  980. * @stable ICU 63
  981. */
  982. static MeasureUnit *createPermille(UErrorCode &status);
  983. /**
  984. * Returns by value, unit of concentr: permille.
  985. * Also see {@link #createPermille()}.
  986. * @stable ICU 64
  987. */
  988. static MeasureUnit getPermille();
  989. /**
  990. * Returns by pointer, unit of concentr: permillion.
  991. * Caller owns returned value and must free it.
  992. * Also see {@link #getPartPerMillion()}.
  993. * @param status ICU error code.
  994. * @stable ICU 57
  995. */
  996. static MeasureUnit *createPartPerMillion(UErrorCode &status);
  997. /**
  998. * Returns by value, unit of concentr: permillion.
  999. * Also see {@link #createPartPerMillion()}.
  1000. * @stable ICU 64
  1001. */
  1002. static MeasureUnit getPartPerMillion();
  1003. /**
  1004. * Returns by pointer, unit of concentr: permyriad.
  1005. * Caller owns returned value and must free it.
  1006. * Also see {@link #getPermyriad()}.
  1007. * @param status ICU error code.
  1008. * @stable ICU 64
  1009. */
  1010. static MeasureUnit *createPermyriad(UErrorCode &status);
  1011. /**
  1012. * Returns by value, unit of concentr: permyriad.
  1013. * Also see {@link #createPermyriad()}.
  1014. * @stable ICU 64
  1015. */
  1016. static MeasureUnit getPermyriad();
  1017. /**
  1018. * Returns by pointer, unit of consumption: liter-per-100-kilometer.
  1019. * Caller owns returned value and must free it.
  1020. * Also see {@link #getLiterPer100Kilometers()}.
  1021. * @param status ICU error code.
  1022. * @stable ICU 56
  1023. */
  1024. static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status);
  1025. /**
  1026. * Returns by value, unit of consumption: liter-per-100-kilometer.
  1027. * Also see {@link #createLiterPer100Kilometers()}.
  1028. * @stable ICU 64
  1029. */
  1030. static MeasureUnit getLiterPer100Kilometers();
  1031. /**
  1032. * Returns by pointer, unit of consumption: liter-per-kilometer.
  1033. * Caller owns returned value and must free it.
  1034. * Also see {@link #getLiterPerKilometer()}.
  1035. * @param status ICU error code.
  1036. * @stable ICU 54
  1037. */
  1038. static MeasureUnit *createLiterPerKilometer(UErrorCode &status);
  1039. /**
  1040. * Returns by value, unit of consumption: liter-per-kilometer.
  1041. * Also see {@link #createLiterPerKilometer()}.
  1042. * @stable ICU 64
  1043. */
  1044. static MeasureUnit getLiterPerKilometer();
  1045. /**
  1046. * Returns by pointer, unit of consumption: mile-per-gallon.
  1047. * Caller owns returned value and must free it.
  1048. * Also see {@link #getMilePerGallon()}.
  1049. * @param status ICU error code.
  1050. * @stable ICU 54
  1051. */
  1052. static MeasureUnit *createMilePerGallon(UErrorCode &status);
  1053. /**
  1054. * Returns by value, unit of consumption: mile-per-gallon.
  1055. * Also see {@link #createMilePerGallon()}.
  1056. * @stable ICU 64
  1057. */
  1058. static MeasureUnit getMilePerGallon();
  1059. /**
  1060. * Returns by pointer, unit of consumption: mile-per-gallon-imperial.
  1061. * Caller owns returned value and must free it.
  1062. * Also see {@link #getMilePerGallonImperial()}.
  1063. * @param status ICU error code.
  1064. * @stable ICU 57
  1065. */
  1066. static MeasureUnit *createMilePerGallonImperial(UErrorCode &status);
  1067. /**
  1068. * Returns by value, unit of consumption: mile-per-gallon-imperial.
  1069. * Also see {@link #createMilePerGallonImperial()}.
  1070. * @stable ICU 64
  1071. */
  1072. static MeasureUnit getMilePerGallonImperial();
  1073. /**
  1074. * Returns by pointer, unit of digital: bit.
  1075. * Caller owns returned value and must free it.
  1076. * Also see {@link #getBit()}.
  1077. * @param status ICU error code.
  1078. * @stable ICU 54
  1079. */
  1080. static MeasureUnit *createBit(UErrorCode &status);
  1081. /**
  1082. * Returns by value, unit of digital: bit.
  1083. * Also see {@link #createBit()}.
  1084. * @stable ICU 64
  1085. */
  1086. static MeasureUnit getBit();
  1087. /**
  1088. * Returns by pointer, unit of digital: byte.
  1089. * Caller owns returned value and must free it.
  1090. * Also see {@link #getByte()}.
  1091. * @param status ICU error code.
  1092. * @stable ICU 54
  1093. */
  1094. static MeasureUnit *createByte(UErrorCode &status);
  1095. /**
  1096. * Returns by value, unit of digital: byte.
  1097. * Also see {@link #createByte()}.
  1098. * @stable ICU 64
  1099. */
  1100. static MeasureUnit getByte();
  1101. /**
  1102. * Returns by pointer, unit of digital: gigabit.
  1103. * Caller owns returned value and must free it.
  1104. * Also see {@link #getGigabit()}.
  1105. * @param status ICU error code.
  1106. * @stable ICU 54
  1107. */
  1108. static MeasureUnit *createGigabit(UErrorCode &status);
  1109. /**
  1110. * Returns by value, unit of digital: gigabit.
  1111. * Also see {@link #createGigabit()}.
  1112. * @stable ICU 64
  1113. */
  1114. static MeasureUnit getGigabit();
  1115. /**
  1116. * Returns by pointer, unit of digital: gigabyte.
  1117. * Caller owns returned value and must free it.
  1118. * Also see {@link #getGigabyte()}.
  1119. * @param status ICU error code.
  1120. * @stable ICU 54
  1121. */
  1122. static MeasureUnit *createGigabyte(UErrorCode &status);
  1123. /**
  1124. * Returns by value, unit of digital: gigabyte.
  1125. * Also see {@link #createGigabyte()}.
  1126. * @stable ICU 64
  1127. */
  1128. static MeasureUnit getGigabyte();
  1129. /**
  1130. * Returns by pointer, unit of digital: kilobit.
  1131. * Caller owns returned value and must free it.
  1132. * Also see {@link #getKilobit()}.
  1133. * @param status ICU error code.
  1134. * @stable ICU 54
  1135. */
  1136. static MeasureUnit *createKilobit(UErrorCode &status);
  1137. /**
  1138. * Returns by value, unit of digital: kilobit.
  1139. * Also see {@link #createKilobit()}.
  1140. * @stable ICU 64
  1141. */
  1142. static MeasureUnit getKilobit();
  1143. /**
  1144. * Returns by pointer, unit of digital: kilobyte.
  1145. * Caller owns returned value and must free it.
  1146. * Also see {@link #getKilobyte()}.
  1147. * @param status ICU error code.
  1148. * @stable ICU 54
  1149. */
  1150. static MeasureUnit *createKilobyte(UErrorCode &status);
  1151. /**
  1152. * Returns by value, unit of digital: kilobyte.
  1153. * Also see {@link #createKilobyte()}.
  1154. * @stable ICU 64
  1155. */
  1156. static MeasureUnit getKilobyte();
  1157. /**
  1158. * Returns by pointer, unit of digital: megabit.
  1159. * Caller owns returned value and must free it.
  1160. * Also see {@link #getMegabit()}.
  1161. * @param status ICU error code.
  1162. * @stable ICU 54
  1163. */
  1164. static MeasureUnit *createMegabit(UErrorCode &status);
  1165. /**
  1166. * Returns by value, unit of digital: megabit.
  1167. * Also see {@link #createMegabit()}.
  1168. * @stable ICU 64
  1169. */
  1170. static MeasureUnit getMegabit();
  1171. /**
  1172. * Returns by pointer, unit of digital: megabyte.
  1173. * Caller owns returned value and must free it.
  1174. * Also see {@link #getMegabyte()}.
  1175. * @param status ICU error code.
  1176. * @stable ICU 54
  1177. */
  1178. static MeasureUnit *createMegabyte(UErrorCode &status);
  1179. /**
  1180. * Returns by value, unit of digital: megabyte.
  1181. * Also see {@link #createMegabyte()}.
  1182. * @stable ICU 64
  1183. */
  1184. static MeasureUnit getMegabyte();
  1185. /**
  1186. * Returns by pointer, unit of digital: petabyte.
  1187. * Caller owns returned value and must free it.
  1188. * Also see {@link #getPetabyte()}.
  1189. * @param status ICU error code.
  1190. * @stable ICU 63
  1191. */
  1192. static MeasureUnit *createPetabyte(UErrorCode &status);
  1193. /**
  1194. * Returns by value, unit of digital: petabyte.
  1195. * Also see {@link #createPetabyte()}.
  1196. * @stable ICU 64
  1197. */
  1198. static MeasureUnit getPetabyte();
  1199. /**
  1200. * Returns by pointer, unit of digital: terabit.
  1201. * Caller owns returned value and must free it.
  1202. * Also see {@link #getTerabit()}.
  1203. * @param status ICU error code.
  1204. * @stable ICU 54
  1205. */
  1206. static MeasureUnit *createTerabit(UErrorCode &status);
  1207. /**
  1208. * Returns by value, unit of digital: terabit.
  1209. * Also see {@link #createTerabit()}.
  1210. * @stable ICU 64
  1211. */
  1212. static MeasureUnit getTerabit();
  1213. /**
  1214. * Returns by pointer, unit of digital: terabyte.
  1215. * Caller owns returned value and must free it.
  1216. * Also see {@link #getTerabyte()}.
  1217. * @param status ICU error code.
  1218. * @stable ICU 54
  1219. */
  1220. static MeasureUnit *createTerabyte(UErrorCode &status);
  1221. /**
  1222. * Returns by value, unit of digital: terabyte.
  1223. * Also see {@link #createTerabyte()}.
  1224. * @stable ICU 64
  1225. */
  1226. static MeasureUnit getTerabyte();
  1227. /**
  1228. * Returns by pointer, unit of duration: century.
  1229. * Caller owns returned value and must free it.
  1230. * Also see {@link #getCentury()}.
  1231. * @param status ICU error code.
  1232. * @stable ICU 56
  1233. */
  1234. static MeasureUnit *createCentury(UErrorCode &status);
  1235. /**
  1236. * Returns by value, unit of duration: century.
  1237. * Also see {@link #createCentury()}.
  1238. * @stable ICU 64
  1239. */
  1240. static MeasureUnit getCentury();
  1241. /**
  1242. * Returns by pointer, unit of duration: day.
  1243. * Caller owns returned value and must free it.
  1244. * Also see {@link #getDay()}.
  1245. * @param status ICU error code.
  1246. * @stable ICU 53
  1247. */
  1248. static MeasureUnit *createDay(UErrorCode &status);
  1249. /**
  1250. * Returns by value, unit of duration: day.
  1251. * Also see {@link #createDay()}.
  1252. * @stable ICU 64
  1253. */
  1254. static MeasureUnit getDay();
  1255. /**
  1256. * Returns by pointer, unit of duration: day-person.
  1257. * Caller owns returned value and must free it.
  1258. * Also see {@link #getDayPerson()}.
  1259. * @param status ICU error code.
  1260. * @stable ICU 64
  1261. */
  1262. static MeasureUnit *createDayPerson(UErrorCode &status);
  1263. /**
  1264. * Returns by value, unit of duration: day-person.
  1265. * Also see {@link #createDayPerson()}.
  1266. * @stable ICU 64
  1267. */
  1268. static MeasureUnit getDayPerson();
  1269. /**
  1270. * Returns by pointer, unit of duration: decade.
  1271. * Caller owns returned value and must free it.
  1272. * Also see {@link #getDecade()}.
  1273. * @param status ICU error code.
  1274. * @stable ICU 65
  1275. */
  1276. static MeasureUnit *createDecade(UErrorCode &status);
  1277. /**
  1278. * Returns by value, unit of duration: decade.
  1279. * Also see {@link #createDecade()}.
  1280. * @stable ICU 65
  1281. */
  1282. static MeasureUnit getDecade();
  1283. /**
  1284. * Returns by pointer, unit of duration: hour.
  1285. * Caller owns returned value and must free it.
  1286. * Also see {@link #getHour()}.
  1287. * @param status ICU error code.
  1288. * @stable ICU 53
  1289. */
  1290. static MeasureUnit *createHour(UErrorCode &status);
  1291. /**
  1292. * Returns by value, unit of duration: hour.
  1293. * Also see {@link #createHour()}.
  1294. * @stable ICU 64
  1295. */
  1296. static MeasureUnit getHour();
  1297. /**
  1298. * Returns by pointer, unit of duration: microsecond.
  1299. * Caller owns returned value and must free it.
  1300. * Also see {@link #getMicrosecond()}.
  1301. * @param status ICU error code.
  1302. * @stable ICU 54
  1303. */
  1304. static MeasureUnit *createMicrosecond(UErrorCode &status);
  1305. /**
  1306. * Returns by value, unit of duration: microsecond.
  1307. * Also see {@link #createMicrosecond()}.
  1308. * @stable ICU 64
  1309. */
  1310. static MeasureUnit getMicrosecond();
  1311. /**
  1312. * Returns by pointer, unit of duration: millisecond.
  1313. * Caller owns returned value and must free it.
  1314. * Also see {@link #getMillisecond()}.
  1315. * @param status ICU error code.
  1316. * @stable ICU 53
  1317. */
  1318. static MeasureUnit *createMillisecond(UErrorCode &status);
  1319. /**
  1320. * Returns by value, unit of duration: millisecond.
  1321. * Also see {@link #createMillisecond()}.
  1322. * @stable ICU 64
  1323. */
  1324. static MeasureUnit getMillisecond();
  1325. /**
  1326. * Returns by pointer, unit of duration: minute.
  1327. * Caller owns returned value and must free it.
  1328. * Also see {@link #getMinute()}.
  1329. * @param status ICU error code.
  1330. * @stable ICU 53
  1331. */
  1332. static MeasureUnit *createMinute(UErrorCode &status);
  1333. /**
  1334. * Returns by value, unit of duration: minute.
  1335. * Also see {@link #createMinute()}.
  1336. * @stable ICU 64
  1337. */
  1338. static MeasureUnit getMinute();
  1339. /**
  1340. * Returns by pointer, unit of duration: month.
  1341. * Caller owns returned value and must free it.
  1342. * Also see {@link #getMonth()}.
  1343. * @param status ICU error code.
  1344. * @stable ICU 53
  1345. */
  1346. static MeasureUnit *createMonth(UErrorCode &status);
  1347. /**
  1348. * Returns by value, unit of duration: month.
  1349. * Also see {@link #createMonth()}.
  1350. * @stable ICU 64
  1351. */
  1352. static MeasureUnit getMonth();
  1353. /**
  1354. * Returns by pointer, unit of duration: month-person.
  1355. * Caller owns returned value and must free it.
  1356. * Also see {@link #getMonthPerson()}.
  1357. * @param status ICU error code.
  1358. * @stable ICU 64
  1359. */
  1360. static MeasureUnit *createMonthPerson(UErrorCode &status);
  1361. /**
  1362. * Returns by value, unit of duration: month-person.
  1363. * Also see {@link #createMonthPerson()}.
  1364. * @stable ICU 64
  1365. */
  1366. static MeasureUnit getMonthPerson();
  1367. /**
  1368. * Returns by pointer, unit of duration: nanosecond.
  1369. * Caller owns returned value and must free it.
  1370. * Also see {@link #getNanosecond()}.
  1371. * @param status ICU error code.
  1372. * @stable ICU 54
  1373. */
  1374. static MeasureUnit *createNanosecond(UErrorCode &status);
  1375. /**
  1376. * Returns by value, unit of duration: nanosecond.
  1377. * Also see {@link #createNanosecond()}.
  1378. * @stable ICU 64
  1379. */
  1380. static MeasureUnit getNanosecond();
  1381. /**
  1382. * Returns by pointer, unit of duration: quarter.
  1383. * Caller owns returned value and must free it.
  1384. * Also see {@link #getQuarter()}.
  1385. * @param status ICU error code.
  1386. * @stable ICU 72
  1387. */
  1388. static MeasureUnit *createQuarter(UErrorCode &status);
  1389. /**
  1390. * Returns by value, unit of duration: quarter.
  1391. * Also see {@link #createQuarter()}.
  1392. * @stable ICU 72
  1393. */
  1394. static MeasureUnit getQuarter();
  1395. /**
  1396. * Returns by pointer, unit of duration: second.
  1397. * Caller owns returned value and must free it.
  1398. * Also see {@link #getSecond()}.
  1399. * @param status ICU error code.
  1400. * @stable ICU 53
  1401. */
  1402. static MeasureUnit *createSecond(UErrorCode &status);
  1403. /**
  1404. * Returns by value, unit of duration: second.
  1405. * Also see {@link #createSecond()}.
  1406. * @stable ICU 64
  1407. */
  1408. static MeasureUnit getSecond();
  1409. /**
  1410. * Returns by pointer, unit of duration: week.
  1411. * Caller owns returned value and must free it.
  1412. * Also see {@link #getWeek()}.
  1413. * @param status ICU error code.
  1414. * @stable ICU 53
  1415. */
  1416. static MeasureUnit *createWeek(UErrorCode &status);
  1417. /**
  1418. * Returns by value, unit of duration: week.
  1419. * Also see {@link #createWeek()}.
  1420. * @stable ICU 64
  1421. */
  1422. static MeasureUnit getWeek();
  1423. /**
  1424. * Returns by pointer, unit of duration: week-person.
  1425. * Caller owns returned value and must free it.
  1426. * Also see {@link #getWeekPerson()}.
  1427. * @param status ICU error code.
  1428. * @stable ICU 64
  1429. */
  1430. static MeasureUnit *createWeekPerson(UErrorCode &status);
  1431. /**
  1432. * Returns by value, unit of duration: week-person.
  1433. * Also see {@link #createWeekPerson()}.
  1434. * @stable ICU 64
  1435. */
  1436. static MeasureUnit getWeekPerson();
  1437. /**
  1438. * Returns by pointer, unit of duration: year.
  1439. * Caller owns returned value and must free it.
  1440. * Also see {@link #getYear()}.
  1441. * @param status ICU error code.
  1442. * @stable ICU 53
  1443. */
  1444. static MeasureUnit *createYear(UErrorCode &status);
  1445. /**
  1446. * Returns by value, unit of duration: year.
  1447. * Also see {@link #createYear()}.
  1448. * @stable ICU 64
  1449. */
  1450. static MeasureUnit getYear();
  1451. /**
  1452. * Returns by pointer, unit of duration: year-person.
  1453. * Caller owns returned value and must free it.
  1454. * Also see {@link #getYearPerson()}.
  1455. * @param status ICU error code.
  1456. * @stable ICU 64
  1457. */
  1458. static MeasureUnit *createYearPerson(UErrorCode &status);
  1459. /**
  1460. * Returns by value, unit of duration: year-person.
  1461. * Also see {@link #createYearPerson()}.
  1462. * @stable ICU 64
  1463. */
  1464. static MeasureUnit getYearPerson();
  1465. /**
  1466. * Returns by pointer, unit of electric: ampere.
  1467. * Caller owns returned value and must free it.
  1468. * Also see {@link #getAmpere()}.
  1469. * @param status ICU error code.
  1470. * @stable ICU 54
  1471. */
  1472. static MeasureUnit *createAmpere(UErrorCode &status);
  1473. /**
  1474. * Returns by value, unit of electric: ampere.
  1475. * Also see {@link #createAmpere()}.
  1476. * @stable ICU 64
  1477. */
  1478. static MeasureUnit getAmpere();
  1479. /**
  1480. * Returns by pointer, unit of electric: milliampere.
  1481. * Caller owns returned value and must free it.
  1482. * Also see {@link #getMilliampere()}.
  1483. * @param status ICU error code.
  1484. * @stable ICU 54
  1485. */
  1486. static MeasureUnit *createMilliampere(UErrorCode &status);
  1487. /**
  1488. * Returns by value, unit of electric: milliampere.
  1489. * Also see {@link #createMilliampere()}.
  1490. * @stable ICU 64
  1491. */
  1492. static MeasureUnit getMilliampere();
  1493. /**
  1494. * Returns by pointer, unit of electric: ohm.
  1495. * Caller owns returned value and must free it.
  1496. * Also see {@link #getOhm()}.
  1497. * @param status ICU error code.
  1498. * @stable ICU 54
  1499. */
  1500. static MeasureUnit *createOhm(UErrorCode &status);
  1501. /**
  1502. * Returns by value, unit of electric: ohm.
  1503. * Also see {@link #createOhm()}.
  1504. * @stable ICU 64
  1505. */
  1506. static MeasureUnit getOhm();
  1507. /**
  1508. * Returns by pointer, unit of electric: volt.
  1509. * Caller owns returned value and must free it.
  1510. * Also see {@link #getVolt()}.
  1511. * @param status ICU error code.
  1512. * @stable ICU 54
  1513. */
  1514. static MeasureUnit *createVolt(UErrorCode &status);
  1515. /**
  1516. * Returns by value, unit of electric: volt.
  1517. * Also see {@link #createVolt()}.
  1518. * @stable ICU 64
  1519. */
  1520. static MeasureUnit getVolt();
  1521. /**
  1522. * Returns by pointer, unit of energy: british-thermal-unit.
  1523. * Caller owns returned value and must free it.
  1524. * Also see {@link #getBritishThermalUnit()}.
  1525. * @param status ICU error code.
  1526. * @stable ICU 64
  1527. */
  1528. static MeasureUnit *createBritishThermalUnit(UErrorCode &status);
  1529. /**
  1530. * Returns by value, unit of energy: british-thermal-unit.
  1531. * Also see {@link #createBritishThermalUnit()}.
  1532. * @stable ICU 64
  1533. */
  1534. static MeasureUnit getBritishThermalUnit();
  1535. /**
  1536. * Returns by pointer, unit of energy: calorie.
  1537. * Caller owns returned value and must free it.
  1538. * Also see {@link #getCalorie()}.
  1539. * @param status ICU error code.
  1540. * @stable ICU 54
  1541. */
  1542. static MeasureUnit *createCalorie(UErrorCode &status);
  1543. /**
  1544. * Returns by value, unit of energy: calorie.
  1545. * Also see {@link #createCalorie()}.
  1546. * @stable ICU 64
  1547. */
  1548. static MeasureUnit getCalorie();
  1549. /**
  1550. * Returns by pointer, unit of energy: electronvolt.
  1551. * Caller owns returned value and must free it.
  1552. * Also see {@link #getElectronvolt()}.
  1553. * @param status ICU error code.
  1554. * @stable ICU 64
  1555. */
  1556. static MeasureUnit *createElectronvolt(UErrorCode &status);
  1557. /**
  1558. * Returns by value, unit of energy: electronvolt.
  1559. * Also see {@link #createElectronvolt()}.
  1560. * @stable ICU 64
  1561. */
  1562. static MeasureUnit getElectronvolt();
  1563. /**
  1564. * Returns by pointer, unit of energy: foodcalorie.
  1565. * Caller owns returned value and must free it.
  1566. * Also see {@link #getFoodcalorie()}.
  1567. * @param status ICU error code.
  1568. * @stable ICU 54
  1569. */
  1570. static MeasureUnit *createFoodcalorie(UErrorCode &status);
  1571. /**
  1572. * Returns by value, unit of energy: foodcalorie.
  1573. * Also see {@link #createFoodcalorie()}.
  1574. * @stable ICU 64
  1575. */
  1576. static MeasureUnit getFoodcalorie();
  1577. /**
  1578. * Returns by pointer, unit of energy: joule.
  1579. * Caller owns returned value and must free it.
  1580. * Also see {@link #getJoule()}.
  1581. * @param status ICU error code.
  1582. * @stable ICU 54
  1583. */
  1584. static MeasureUnit *createJoule(UErrorCode &status);
  1585. /**
  1586. * Returns by value, unit of energy: joule.
  1587. * Also see {@link #createJoule()}.
  1588. * @stable ICU 64
  1589. */
  1590. static MeasureUnit getJoule();
  1591. /**
  1592. * Returns by pointer, unit of energy: kilocalorie.
  1593. * Caller owns returned value and must free it.
  1594. * Also see {@link #getKilocalorie()}.
  1595. * @param status ICU error code.
  1596. * @stable ICU 54
  1597. */
  1598. static MeasureUnit *createKilocalorie(UErrorCode &status);
  1599. /**
  1600. * Returns by value, unit of energy: kilocalorie.
  1601. * Also see {@link #createKilocalorie()}.
  1602. * @stable ICU 64
  1603. */
  1604. static MeasureUnit getKilocalorie();
  1605. /**
  1606. * Returns by pointer, unit of energy: kilojoule.
  1607. * Caller owns returned value and must free it.
  1608. * Also see {@link #getKilojoule()}.
  1609. * @param status ICU error code.
  1610. * @stable ICU 54
  1611. */
  1612. static MeasureUnit *createKilojoule(UErrorCode &status);
  1613. /**
  1614. * Returns by value, unit of energy: kilojoule.
  1615. * Also see {@link #createKilojoule()}.
  1616. * @stable ICU 64
  1617. */
  1618. static MeasureUnit getKilojoule();
  1619. /**
  1620. * Returns by pointer, unit of energy: kilowatt-hour.
  1621. * Caller owns returned value and must free it.
  1622. * Also see {@link #getKilowattHour()}.
  1623. * @param status ICU error code.
  1624. * @stable ICU 54
  1625. */
  1626. static MeasureUnit *createKilowattHour(UErrorCode &status);
  1627. /**
  1628. * Returns by value, unit of energy: kilowatt-hour.
  1629. * Also see {@link #createKilowattHour()}.
  1630. * @stable ICU 64
  1631. */
  1632. static MeasureUnit getKilowattHour();
  1633. /**
  1634. * Returns by pointer, unit of energy: therm-us.
  1635. * Caller owns returned value and must free it.
  1636. * Also see {@link #getThermUs()}.
  1637. * @param status ICU error code.
  1638. * @stable ICU 65
  1639. */
  1640. static MeasureUnit *createThermUs(UErrorCode &status);
  1641. /**
  1642. * Returns by value, unit of energy: therm-us.
  1643. * Also see {@link #createThermUs()}.
  1644. * @stable ICU 65
  1645. */
  1646. static MeasureUnit getThermUs();
  1647. /**
  1648. * Returns by pointer, unit of force: kilowatt-hour-per-100-kilometer.
  1649. * Caller owns returned value and must free it.
  1650. * Also see {@link #getKilowattHourPer100Kilometer()}.
  1651. * @param status ICU error code.
  1652. * @stable ICU 70
  1653. */
  1654. static MeasureUnit *createKilowattHourPer100Kilometer(UErrorCode &status);
  1655. /**
  1656. * Returns by value, unit of force: kilowatt-hour-per-100-kilometer.
  1657. * Also see {@link #createKilowattHourPer100Kilometer()}.
  1658. * @stable ICU 70
  1659. */
  1660. static MeasureUnit getKilowattHourPer100Kilometer();
  1661. /**
  1662. * Returns by pointer, unit of force: newton.
  1663. * Caller owns returned value and must free it.
  1664. * Also see {@link #getNewton()}.
  1665. * @param status ICU error code.
  1666. * @stable ICU 64
  1667. */
  1668. static MeasureUnit *createNewton(UErrorCode &status);
  1669. /**
  1670. * Returns by value, unit of force: newton.
  1671. * Also see {@link #createNewton()}.
  1672. * @stable ICU 64
  1673. */
  1674. static MeasureUnit getNewton();
  1675. /**
  1676. * Returns by pointer, unit of force: pound-force.
  1677. * Caller owns returned value and must free it.
  1678. * Also see {@link #getPoundForce()}.
  1679. * @param status ICU error code.
  1680. * @stable ICU 64
  1681. */
  1682. static MeasureUnit *createPoundForce(UErrorCode &status);
  1683. /**
  1684. * Returns by value, unit of force: pound-force.
  1685. * Also see {@link #createPoundForce()}.
  1686. * @stable ICU 64
  1687. */
  1688. static MeasureUnit getPoundForce();
  1689. /**
  1690. * Returns by pointer, unit of frequency: gigahertz.
  1691. * Caller owns returned value and must free it.
  1692. * Also see {@link #getGigahertz()}.
  1693. * @param status ICU error code.
  1694. * @stable ICU 54
  1695. */
  1696. static MeasureUnit *createGigahertz(UErrorCode &status);
  1697. /**
  1698. * Returns by value, unit of frequency: gigahertz.
  1699. * Also see {@link #createGigahertz()}.
  1700. * @stable ICU 64
  1701. */
  1702. static MeasureUnit getGigahertz();
  1703. /**
  1704. * Returns by pointer, unit of frequency: hertz.
  1705. * Caller owns returned value and must free it.
  1706. * Also see {@link #getHertz()}.
  1707. * @param status ICU error code.
  1708. * @stable ICU 54
  1709. */
  1710. static MeasureUnit *createHertz(UErrorCode &status);
  1711. /**
  1712. * Returns by value, unit of frequency: hertz.
  1713. * Also see {@link #createHertz()}.
  1714. * @stable ICU 64
  1715. */
  1716. static MeasureUnit getHertz();
  1717. /**
  1718. * Returns by pointer, unit of frequency: kilohertz.
  1719. * Caller owns returned value and must free it.
  1720. * Also see {@link #getKilohertz()}.
  1721. * @param status ICU error code.
  1722. * @stable ICU 54
  1723. */
  1724. static MeasureUnit *createKilohertz(UErrorCode &status);
  1725. /**
  1726. * Returns by value, unit of frequency: kilohertz.
  1727. * Also see {@link #createKilohertz()}.
  1728. * @stable ICU 64
  1729. */
  1730. static MeasureUnit getKilohertz();
  1731. /**
  1732. * Returns by pointer, unit of frequency: megahertz.
  1733. * Caller owns returned value and must free it.
  1734. * Also see {@link #getMegahertz()}.
  1735. * @param status ICU error code.
  1736. * @stable ICU 54
  1737. */
  1738. static MeasureUnit *createMegahertz(UErrorCode &status);
  1739. /**
  1740. * Returns by value, unit of frequency: megahertz.
  1741. * Also see {@link #createMegahertz()}.
  1742. * @stable ICU 64
  1743. */
  1744. static MeasureUnit getMegahertz();
  1745. /**
  1746. * Returns by pointer, unit of graphics: dot.
  1747. * Caller owns returned value and must free it.
  1748. * Also see {@link #getDot()}.
  1749. * @param status ICU error code.
  1750. * @stable ICU 68
  1751. */
  1752. static MeasureUnit *createDot(UErrorCode &status);
  1753. /**
  1754. * Returns by value, unit of graphics: dot.
  1755. * Also see {@link #createDot()}.
  1756. * @stable ICU 68
  1757. */
  1758. static MeasureUnit getDot();
  1759. /**
  1760. * Returns by pointer, unit of graphics: dot-per-centimeter.
  1761. * Caller owns returned value and must free it.
  1762. * Also see {@link #getDotPerCentimeter()}.
  1763. * @param status ICU error code.
  1764. * @stable ICU 65
  1765. */
  1766. static MeasureUnit *createDotPerCentimeter(UErrorCode &status);
  1767. /**
  1768. * Returns by value, unit of graphics: dot-per-centimeter.
  1769. * Also see {@link #createDotPerCentimeter()}.
  1770. * @stable ICU 65
  1771. */
  1772. static MeasureUnit getDotPerCentimeter();
  1773. /**
  1774. * Returns by pointer, unit of graphics: dot-per-inch.
  1775. * Caller owns returned value and must free it.
  1776. * Also see {@link #getDotPerInch()}.
  1777. * @param status ICU error code.
  1778. * @stable ICU 65
  1779. */
  1780. static MeasureUnit *createDotPerInch(UErrorCode &status);
  1781. /**
  1782. * Returns by value, unit of graphics: dot-per-inch.
  1783. * Also see {@link #createDotPerInch()}.
  1784. * @stable ICU 65
  1785. */
  1786. static MeasureUnit getDotPerInch();
  1787. /**
  1788. * Returns by pointer, unit of graphics: em.
  1789. * Caller owns returned value and must free it.
  1790. * Also see {@link #getEm()}.
  1791. * @param status ICU error code.
  1792. * @stable ICU 65
  1793. */
  1794. static MeasureUnit *createEm(UErrorCode &status);
  1795. /**
  1796. * Returns by value, unit of graphics: em.
  1797. * Also see {@link #createEm()}.
  1798. * @stable ICU 65
  1799. */
  1800. static MeasureUnit getEm();
  1801. /**
  1802. * Returns by pointer, unit of graphics: megapixel.
  1803. * Caller owns returned value and must free it.
  1804. * Also see {@link #getMegapixel()}.
  1805. * @param status ICU error code.
  1806. * @stable ICU 65
  1807. */
  1808. static MeasureUnit *createMegapixel(UErrorCode &status);
  1809. /**
  1810. * Returns by value, unit of graphics: megapixel.
  1811. * Also see {@link #createMegapixel()}.
  1812. * @stable ICU 65
  1813. */
  1814. static MeasureUnit getMegapixel();
  1815. /**
  1816. * Returns by pointer, unit of graphics: pixel.
  1817. * Caller owns returned value and must free it.
  1818. * Also see {@link #getPixel()}.
  1819. * @param status ICU error code.
  1820. * @stable ICU 65
  1821. */
  1822. static MeasureUnit *createPixel(UErrorCode &status);
  1823. /**
  1824. * Returns by value, unit of graphics: pixel.
  1825. * Also see {@link #createPixel()}.
  1826. * @stable ICU 65
  1827. */
  1828. static MeasureUnit getPixel();
  1829. /**
  1830. * Returns by pointer, unit of graphics: pixel-per-centimeter.
  1831. * Caller owns returned value and must free it.
  1832. * Also see {@link #getPixelPerCentimeter()}.
  1833. * @param status ICU error code.
  1834. * @stable ICU 65
  1835. */
  1836. static MeasureUnit *createPixelPerCentimeter(UErrorCode &status);
  1837. /**
  1838. * Returns by value, unit of graphics: pixel-per-centimeter.
  1839. * Also see {@link #createPixelPerCentimeter()}.
  1840. * @stable ICU 65
  1841. */
  1842. static MeasureUnit getPixelPerCentimeter();
  1843. /**
  1844. * Returns by pointer, unit of graphics: pixel-per-inch.
  1845. * Caller owns returned value and must free it.
  1846. * Also see {@link #getPixelPerInch()}.
  1847. * @param status ICU error code.
  1848. * @stable ICU 65
  1849. */
  1850. static MeasureUnit *createPixelPerInch(UErrorCode &status);
  1851. /**
  1852. * Returns by value, unit of graphics: pixel-per-inch.
  1853. * Also see {@link #createPixelPerInch()}.
  1854. * @stable ICU 65
  1855. */
  1856. static MeasureUnit getPixelPerInch();
  1857. /**
  1858. * Returns by pointer, unit of length: astronomical-unit.
  1859. * Caller owns returned value and must free it.
  1860. * Also see {@link #getAstronomicalUnit()}.
  1861. * @param status ICU error code.
  1862. * @stable ICU 54
  1863. */
  1864. static MeasureUnit *createAstronomicalUnit(UErrorCode &status);
  1865. /**
  1866. * Returns by value, unit of length: astronomical-unit.
  1867. * Also see {@link #createAstronomicalUnit()}.
  1868. * @stable ICU 64
  1869. */
  1870. static MeasureUnit getAstronomicalUnit();
  1871. /**
  1872. * Returns by pointer, unit of length: centimeter.
  1873. * Caller owns returned value and must free it.
  1874. * Also see {@link #getCentimeter()}.
  1875. * @param status ICU error code.
  1876. * @stable ICU 53
  1877. */
  1878. static MeasureUnit *createCentimeter(UErrorCode &status);
  1879. /**
  1880. * Returns by value, unit of length: centimeter.
  1881. * Also see {@link #createCentimeter()}.
  1882. * @stable ICU 64
  1883. */
  1884. static MeasureUnit getCentimeter();
  1885. /**
  1886. * Returns by pointer, unit of length: decimeter.
  1887. * Caller owns returned value and must free it.
  1888. * Also see {@link #getDecimeter()}.
  1889. * @param status ICU error code.
  1890. * @stable ICU 54
  1891. */
  1892. static MeasureUnit *createDecimeter(UErrorCode &status);
  1893. /**
  1894. * Returns by value, unit of length: decimeter.
  1895. * Also see {@link #createDecimeter()}.
  1896. * @stable ICU 64
  1897. */
  1898. static MeasureUnit getDecimeter();
  1899. /**
  1900. * Returns by pointer, unit of length: earth-radius.
  1901. * Caller owns returned value and must free it.
  1902. * Also see {@link #getEarthRadius()}.
  1903. * @param status ICU error code.
  1904. * @stable ICU 68
  1905. */
  1906. static MeasureUnit *createEarthRadius(UErrorCode &status);
  1907. /**
  1908. * Returns by value, unit of length: earth-radius.
  1909. * Also see {@link #createEarthRadius()}.
  1910. * @stable ICU 68
  1911. */
  1912. static MeasureUnit getEarthRadius();
  1913. /**
  1914. * Returns by pointer, unit of length: fathom.
  1915. * Caller owns returned value and must free it.
  1916. * Also see {@link #getFathom()}.
  1917. * @param status ICU error code.
  1918. * @stable ICU 54
  1919. */
  1920. static MeasureUnit *createFathom(UErrorCode &status);
  1921. /**
  1922. * Returns by value, unit of length: fathom.
  1923. * Also see {@link #createFathom()}.
  1924. * @stable ICU 64
  1925. */
  1926. static MeasureUnit getFathom();
  1927. /**
  1928. * Returns by pointer, unit of length: foot.
  1929. * Caller owns returned value and must free it.
  1930. * Also see {@link #getFoot()}.
  1931. * @param status ICU error code.
  1932. * @stable ICU 53
  1933. */
  1934. static MeasureUnit *createFoot(UErrorCode &status);
  1935. /**
  1936. * Returns by value, unit of length: foot.
  1937. * Also see {@link #createFoot()}.
  1938. * @stable ICU 64
  1939. */
  1940. static MeasureUnit getFoot();
  1941. /**
  1942. * Returns by pointer, unit of length: furlong.
  1943. * Caller owns returned value and must free it.
  1944. * Also see {@link #getFurlong()}.
  1945. * @param status ICU error code.
  1946. * @stable ICU 54
  1947. */
  1948. static MeasureUnit *createFurlong(UErrorCode &status);
  1949. /**
  1950. * Returns by value, unit of length: furlong.
  1951. * Also see {@link #createFurlong()}.
  1952. * @stable ICU 64
  1953. */
  1954. static MeasureUnit getFurlong();
  1955. /**
  1956. * Returns by pointer, unit of length: inch.
  1957. * Caller owns returned value and must free it.
  1958. * Also see {@link #getInch()}.
  1959. * @param status ICU error code.
  1960. * @stable ICU 53
  1961. */
  1962. static MeasureUnit *createInch(UErrorCode &status);
  1963. /**
  1964. * Returns by value, unit of length: inch.
  1965. * Also see {@link #createInch()}.
  1966. * @stable ICU 64
  1967. */
  1968. static MeasureUnit getInch();
  1969. /**
  1970. * Returns by pointer, unit of length: kilometer.
  1971. * Caller owns returned value and must free it.
  1972. * Also see {@link #getKilometer()}.
  1973. * @param status ICU error code.
  1974. * @stable ICU 53
  1975. */
  1976. static MeasureUnit *createKilometer(UErrorCode &status);
  1977. /**
  1978. * Returns by value, unit of length: kilometer.
  1979. * Also see {@link #createKilometer()}.
  1980. * @stable ICU 64
  1981. */
  1982. static MeasureUnit getKilometer();
  1983. /**
  1984. * Returns by pointer, unit of length: light-year.
  1985. * Caller owns returned value and must free it.
  1986. * Also see {@link #getLightYear()}.
  1987. * @param status ICU error code.
  1988. * @stable ICU 53
  1989. */
  1990. static MeasureUnit *createLightYear(UErrorCode &status);
  1991. /**
  1992. * Returns by value, unit of length: light-year.
  1993. * Also see {@link #createLightYear()}.
  1994. * @stable ICU 64
  1995. */
  1996. static MeasureUnit getLightYear();
  1997. /**
  1998. * Returns by pointer, unit of length: meter.
  1999. * Caller owns returned value and must free it.
  2000. * Also see {@link #getMeter()}.
  2001. * @param status ICU error code.
  2002. * @stable ICU 53
  2003. */
  2004. static MeasureUnit *createMeter(UErrorCode &status);
  2005. /**
  2006. * Returns by value, unit of length: meter.
  2007. * Also see {@link #createMeter()}.
  2008. * @stable ICU 64
  2009. */
  2010. static MeasureUnit getMeter();
  2011. /**
  2012. * Returns by pointer, unit of length: micrometer.
  2013. * Caller owns returned value and must free it.
  2014. * Also see {@link #getMicrometer()}.
  2015. * @param status ICU error code.
  2016. * @stable ICU 54
  2017. */
  2018. static MeasureUnit *createMicrometer(UErrorCode &status);
  2019. /**
  2020. * Returns by value, unit of length: micrometer.
  2021. * Also see {@link #createMicrometer()}.
  2022. * @stable ICU 64
  2023. */
  2024. static MeasureUnit getMicrometer();
  2025. /**
  2026. * Returns by pointer, unit of length: mile.
  2027. * Caller owns returned value and must free it.
  2028. * Also see {@link #getMile()}.
  2029. * @param status ICU error code.
  2030. * @stable ICU 53
  2031. */
  2032. static MeasureUnit *createMile(UErrorCode &status);
  2033. /**
  2034. * Returns by value, unit of length: mile.
  2035. * Also see {@link #createMile()}.
  2036. * @stable ICU 64
  2037. */
  2038. static MeasureUnit getMile();
  2039. /**
  2040. * Returns by pointer, unit of length: mile-scandinavian.
  2041. * Caller owns returned value and must free it.
  2042. * Also see {@link #getMileScandinavian()}.
  2043. * @param status ICU error code.
  2044. * @stable ICU 56
  2045. */
  2046. static MeasureUnit *createMileScandinavian(UErrorCode &status);
  2047. /**
  2048. * Returns by value, unit of length: mile-scandinavian.
  2049. * Also see {@link #createMileScandinavian()}.
  2050. * @stable ICU 64
  2051. */
  2052. static MeasureUnit getMileScandinavian();
  2053. /**
  2054. * Returns by pointer, unit of length: millimeter.
  2055. * Caller owns returned value and must free it.
  2056. * Also see {@link #getMillimeter()}.
  2057. * @param status ICU error code.
  2058. * @stable ICU 53
  2059. */
  2060. static MeasureUnit *createMillimeter(UErrorCode &status);
  2061. /**
  2062. * Returns by value, unit of length: millimeter.
  2063. * Also see {@link #createMillimeter()}.
  2064. * @stable ICU 64
  2065. */
  2066. static MeasureUnit getMillimeter();
  2067. /**
  2068. * Returns by pointer, unit of length: nanometer.
  2069. * Caller owns returned value and must free it.
  2070. * Also see {@link #getNanometer()}.
  2071. * @param status ICU error code.
  2072. * @stable ICU 54
  2073. */
  2074. static MeasureUnit *createNanometer(UErrorCode &status);
  2075. /**
  2076. * Returns by value, unit of length: nanometer.
  2077. * Also see {@link #createNanometer()}.
  2078. * @stable ICU 64
  2079. */
  2080. static MeasureUnit getNanometer();
  2081. /**
  2082. * Returns by pointer, unit of length: nautical-mile.
  2083. * Caller owns returned value and must free it.
  2084. * Also see {@link #getNauticalMile()}.
  2085. * @param status ICU error code.
  2086. * @stable ICU 54
  2087. */
  2088. static MeasureUnit *createNauticalMile(UErrorCode &status);
  2089. /**
  2090. * Returns by value, unit of length: nautical-mile.
  2091. * Also see {@link #createNauticalMile()}.
  2092. * @stable ICU 64
  2093. */
  2094. static MeasureUnit getNauticalMile();
  2095. /**
  2096. * Returns by pointer, unit of length: parsec.
  2097. * Caller owns returned value and must free it.
  2098. * Also see {@link #getParsec()}.
  2099. * @param status ICU error code.
  2100. * @stable ICU 54
  2101. */
  2102. static MeasureUnit *createParsec(UErrorCode &status);
  2103. /**
  2104. * Returns by value, unit of length: parsec.
  2105. * Also see {@link #createParsec()}.
  2106. * @stable ICU 64
  2107. */
  2108. static MeasureUnit getParsec();
  2109. /**
  2110. * Returns by pointer, unit of length: picometer.
  2111. * Caller owns returned value and must free it.
  2112. * Also see {@link #getPicometer()}.
  2113. * @param status ICU error code.
  2114. * @stable ICU 53
  2115. */
  2116. static MeasureUnit *createPicometer(UErrorCode &status);
  2117. /**
  2118. * Returns by value, unit of length: picometer.
  2119. * Also see {@link #createPicometer()}.
  2120. * @stable ICU 64
  2121. */
  2122. static MeasureUnit getPicometer();
  2123. /**
  2124. * Returns by pointer, unit of length: point.
  2125. * Caller owns returned value and must free it.
  2126. * Also see {@link #getPoint()}.
  2127. * @param status ICU error code.
  2128. * @stable ICU 59
  2129. */
  2130. static MeasureUnit *createPoint(UErrorCode &status);
  2131. /**
  2132. * Returns by value, unit of length: point.
  2133. * Also see {@link #createPoint()}.
  2134. * @stable ICU 64
  2135. */
  2136. static MeasureUnit getPoint();
  2137. /**
  2138. * Returns by pointer, unit of length: solar-radius.
  2139. * Caller owns returned value and must free it.
  2140. * Also see {@link #getSolarRadius()}.
  2141. * @param status ICU error code.
  2142. * @stable ICU 64
  2143. */
  2144. static MeasureUnit *createSolarRadius(UErrorCode &status);
  2145. /**
  2146. * Returns by value, unit of length: solar-radius.
  2147. * Also see {@link #createSolarRadius()}.
  2148. * @stable ICU 64
  2149. */
  2150. static MeasureUnit getSolarRadius();
  2151. /**
  2152. * Returns by pointer, unit of length: yard.
  2153. * Caller owns returned value and must free it.
  2154. * Also see {@link #getYard()}.
  2155. * @param status ICU error code.
  2156. * @stable ICU 53
  2157. */
  2158. static MeasureUnit *createYard(UErrorCode &status);
  2159. /**
  2160. * Returns by value, unit of length: yard.
  2161. * Also see {@link #createYard()}.
  2162. * @stable ICU 64
  2163. */
  2164. static MeasureUnit getYard();
  2165. /**
  2166. * Returns by pointer, unit of light: candela.
  2167. * Caller owns returned value and must free it.
  2168. * Also see {@link #getCandela()}.
  2169. * @param status ICU error code.
  2170. * @stable ICU 68
  2171. */
  2172. static MeasureUnit *createCandela(UErrorCode &status);
  2173. /**
  2174. * Returns by value, unit of light: candela.
  2175. * Also see {@link #createCandela()}.
  2176. * @stable ICU 68
  2177. */
  2178. static MeasureUnit getCandela();
  2179. /**
  2180. * Returns by pointer, unit of light: lumen.
  2181. * Caller owns returned value and must free it.
  2182. * Also see {@link #getLumen()}.
  2183. * @param status ICU error code.
  2184. * @stable ICU 68
  2185. */
  2186. static MeasureUnit *createLumen(UErrorCode &status);
  2187. /**
  2188. * Returns by value, unit of light: lumen.
  2189. * Also see {@link #createLumen()}.
  2190. * @stable ICU 68
  2191. */
  2192. static MeasureUnit getLumen();
  2193. /**
  2194. * Returns by pointer, unit of light: lux.
  2195. * Caller owns returned value and must free it.
  2196. * Also see {@link #getLux()}.
  2197. * @param status ICU error code.
  2198. * @stable ICU 54
  2199. */
  2200. static MeasureUnit *createLux(UErrorCode &status);
  2201. /**
  2202. * Returns by value, unit of light: lux.
  2203. * Also see {@link #createLux()}.
  2204. * @stable ICU 64
  2205. */
  2206. static MeasureUnit getLux();
  2207. /**
  2208. * Returns by pointer, unit of light: solar-luminosity.
  2209. * Caller owns returned value and must free it.
  2210. * Also see {@link #getSolarLuminosity()}.
  2211. * @param status ICU error code.
  2212. * @stable ICU 64
  2213. */
  2214. static MeasureUnit *createSolarLuminosity(UErrorCode &status);
  2215. /**
  2216. * Returns by value, unit of light: solar-luminosity.
  2217. * Also see {@link #createSolarLuminosity()}.
  2218. * @stable ICU 64
  2219. */
  2220. static MeasureUnit getSolarLuminosity();
  2221. /**
  2222. * Returns by pointer, unit of mass: carat.
  2223. * Caller owns returned value and must free it.
  2224. * Also see {@link #getCarat()}.
  2225. * @param status ICU error code.
  2226. * @stable ICU 54
  2227. */
  2228. static MeasureUnit *createCarat(UErrorCode &status);
  2229. /**
  2230. * Returns by value, unit of mass: carat.
  2231. * Also see {@link #createCarat()}.
  2232. * @stable ICU 64
  2233. */
  2234. static MeasureUnit getCarat();
  2235. /**
  2236. * Returns by pointer, unit of mass: dalton.
  2237. * Caller owns returned value and must free it.
  2238. * Also see {@link #getDalton()}.
  2239. * @param status ICU error code.
  2240. * @stable ICU 64
  2241. */
  2242. static MeasureUnit *createDalton(UErrorCode &status);
  2243. /**
  2244. * Returns by value, unit of mass: dalton.
  2245. * Also see {@link #createDalton()}.
  2246. * @stable ICU 64
  2247. */
  2248. static MeasureUnit getDalton();
  2249. /**
  2250. * Returns by pointer, unit of mass: earth-mass.
  2251. * Caller owns returned value and must free it.
  2252. * Also see {@link #getEarthMass()}.
  2253. * @param status ICU error code.
  2254. * @stable ICU 64
  2255. */
  2256. static MeasureUnit *createEarthMass(UErrorCode &status);
  2257. /**
  2258. * Returns by value, unit of mass: earth-mass.
  2259. * Also see {@link #createEarthMass()}.
  2260. * @stable ICU 64
  2261. */
  2262. static MeasureUnit getEarthMass();
  2263. /**
  2264. * Returns by pointer, unit of mass: grain.
  2265. * Caller owns returned value and must free it.
  2266. * Also see {@link #getGrain()}.
  2267. * @param status ICU error code.
  2268. * @stable ICU 68
  2269. */
  2270. static MeasureUnit *createGrain(UErrorCode &status);
  2271. /**
  2272. * Returns by value, unit of mass: grain.
  2273. * Also see {@link #createGrain()}.
  2274. * @stable ICU 68
  2275. */
  2276. static MeasureUnit getGrain();
  2277. /**
  2278. * Returns by pointer, unit of mass: gram.
  2279. * Caller owns returned value and must free it.
  2280. * Also see {@link #getGram()}.
  2281. * @param status ICU error code.
  2282. * @stable ICU 53
  2283. */
  2284. static MeasureUnit *createGram(UErrorCode &status);
  2285. /**
  2286. * Returns by value, unit of mass: gram.
  2287. * Also see {@link #createGram()}.
  2288. * @stable ICU 64
  2289. */
  2290. static MeasureUnit getGram();
  2291. /**
  2292. * Returns by pointer, unit of mass: kilogram.
  2293. * Caller owns returned value and must free it.
  2294. * Also see {@link #getKilogram()}.
  2295. * @param status ICU error code.
  2296. * @stable ICU 53
  2297. */
  2298. static MeasureUnit *createKilogram(UErrorCode &status);
  2299. /**
  2300. * Returns by value, unit of mass: kilogram.
  2301. * Also see {@link #createKilogram()}.
  2302. * @stable ICU 64
  2303. */
  2304. static MeasureUnit getKilogram();
  2305. /**
  2306. * Returns by pointer, unit of mass: metric-ton
  2307. * (renamed to tonne in CLDR 42 / ICU 72).
  2308. * Caller owns returned value and must free it.
  2309. * Note: In ICU 74 this will be deprecated in favor of
  2310. * createTonne(), which is currently draft but will
  2311. * become stable in ICU 74, and which uses the preferred naming.
  2312. * Also see {@link #getMetricTon()} and {@link #createTonne()}.
  2313. * @param status ICU error code.
  2314. * @stable ICU 54
  2315. */
  2316. static MeasureUnit *createMetricTon(UErrorCode &status);
  2317. /**
  2318. * Returns by value, unit of mass: metric-ton
  2319. * (renamed to tonne in CLDR 42 / ICU 72).
  2320. * Note: In ICU 74 this will be deprecated in favor of
  2321. * getTonne(), which is currently draft but will
  2322. * become stable in ICU 74, and which uses the preferred naming.
  2323. * Also see {@link #createMetricTon()} and {@link #getTonne()}.
  2324. * @stable ICU 64
  2325. */
  2326. static MeasureUnit getMetricTon();
  2327. /**
  2328. * Returns by pointer, unit of mass: microgram.
  2329. * Caller owns returned value and must free it.
  2330. * Also see {@link #getMicrogram()}.
  2331. * @param status ICU error code.
  2332. * @stable ICU 54
  2333. */
  2334. static MeasureUnit *createMicrogram(UErrorCode &status);
  2335. /**
  2336. * Returns by value, unit of mass: microgram.
  2337. * Also see {@link #createMicrogram()}.
  2338. * @stable ICU 64
  2339. */
  2340. static MeasureUnit getMicrogram();
  2341. /**
  2342. * Returns by pointer, unit of mass: milligram.
  2343. * Caller owns returned value and must free it.
  2344. * Also see {@link #getMilligram()}.
  2345. * @param status ICU error code.
  2346. * @stable ICU 54
  2347. */
  2348. static MeasureUnit *createMilligram(UErrorCode &status);
  2349. /**
  2350. * Returns by value, unit of mass: milligram.
  2351. * Also see {@link #createMilligram()}.
  2352. * @stable ICU 64
  2353. */
  2354. static MeasureUnit getMilligram();
  2355. /**
  2356. * Returns by pointer, unit of mass: ounce.
  2357. * Caller owns returned value and must free it.
  2358. * Also see {@link #getOunce()}.
  2359. * @param status ICU error code.
  2360. * @stable ICU 53
  2361. */
  2362. static MeasureUnit *createOunce(UErrorCode &status);
  2363. /**
  2364. * Returns by value, unit of mass: ounce.
  2365. * Also see {@link #createOunce()}.
  2366. * @stable ICU 64
  2367. */
  2368. static MeasureUnit getOunce();
  2369. /**
  2370. * Returns by pointer, unit of mass: ounce-troy.
  2371. * Caller owns returned value and must free it.
  2372. * Also see {@link #getOunceTroy()}.
  2373. * @param status ICU error code.
  2374. * @stable ICU 54
  2375. */
  2376. static MeasureUnit *createOunceTroy(UErrorCode &status);
  2377. /**
  2378. * Returns by value, unit of mass: ounce-troy.
  2379. * Also see {@link #createOunceTroy()}.
  2380. * @stable ICU 64
  2381. */
  2382. static MeasureUnit getOunceTroy();
  2383. /**
  2384. * Returns by pointer, unit of mass: pound.
  2385. * Caller owns returned value and must free it.
  2386. * Also see {@link #getPound()}.
  2387. * @param status ICU error code.
  2388. * @stable ICU 53
  2389. */
  2390. static MeasureUnit *createPound(UErrorCode &status);
  2391. /**
  2392. * Returns by value, unit of mass: pound.
  2393. * Also see {@link #createPound()}.
  2394. * @stable ICU 64
  2395. */
  2396. static MeasureUnit getPound();
  2397. /**
  2398. * Returns by pointer, unit of mass: solar-mass.
  2399. * Caller owns returned value and must free it.
  2400. * Also see {@link #getSolarMass()}.
  2401. * @param status ICU error code.
  2402. * @stable ICU 64
  2403. */
  2404. static MeasureUnit *createSolarMass(UErrorCode &status);
  2405. /**
  2406. * Returns by value, unit of mass: solar-mass.
  2407. * Also see {@link #createSolarMass()}.
  2408. * @stable ICU 64
  2409. */
  2410. static MeasureUnit getSolarMass();
  2411. /**
  2412. * Returns by pointer, unit of mass: stone.
  2413. * Caller owns returned value and must free it.
  2414. * Also see {@link #getStone()}.
  2415. * @param status ICU error code.
  2416. * @stable ICU 54
  2417. */
  2418. static MeasureUnit *createStone(UErrorCode &status);
  2419. /**
  2420. * Returns by value, unit of mass: stone.
  2421. * Also see {@link #createStone()}.
  2422. * @stable ICU 64
  2423. */
  2424. static MeasureUnit getStone();
  2425. /**
  2426. * Returns by pointer, unit of mass: ton.
  2427. * Caller owns returned value and must free it.
  2428. * Also see {@link #getTon()}.
  2429. * @param status ICU error code.
  2430. * @stable ICU 54
  2431. */
  2432. static MeasureUnit *createTon(UErrorCode &status);
  2433. /**
  2434. * Returns by value, unit of mass: ton.
  2435. * Also see {@link #createTon()}.
  2436. * @stable ICU 64
  2437. */
  2438. static MeasureUnit getTon();
  2439. /**
  2440. * Returns by pointer, unit of mass: tonne.
  2441. * Caller owns returned value and must free it.
  2442. * Also see {@link #getTonne()}.
  2443. * @param status ICU error code.
  2444. * @stable ICU 72
  2445. */
  2446. static MeasureUnit *createTonne(UErrorCode &status);
  2447. /**
  2448. * Returns by value, unit of mass: tonne.
  2449. * Also see {@link #createTonne()}.
  2450. * @stable ICU 72
  2451. */
  2452. static MeasureUnit getTonne();
  2453. /**
  2454. * Returns by pointer, unit of power: gigawatt.
  2455. * Caller owns returned value and must free it.
  2456. * Also see {@link #getGigawatt()}.
  2457. * @param status ICU error code.
  2458. * @stable ICU 54
  2459. */
  2460. static MeasureUnit *createGigawatt(UErrorCode &status);
  2461. /**
  2462. * Returns by value, unit of power: gigawatt.
  2463. * Also see {@link #createGigawatt()}.
  2464. * @stable ICU 64
  2465. */
  2466. static MeasureUnit getGigawatt();
  2467. /**
  2468. * Returns by pointer, unit of power: horsepower.
  2469. * Caller owns returned value and must free it.
  2470. * Also see {@link #getHorsepower()}.
  2471. * @param status ICU error code.
  2472. * @stable ICU 53
  2473. */
  2474. static MeasureUnit *createHorsepower(UErrorCode &status);
  2475. /**
  2476. * Returns by value, unit of power: horsepower.
  2477. * Also see {@link #createHorsepower()}.
  2478. * @stable ICU 64
  2479. */
  2480. static MeasureUnit getHorsepower();
  2481. /**
  2482. * Returns by pointer, unit of power: kilowatt.
  2483. * Caller owns returned value and must free it.
  2484. * Also see {@link #getKilowatt()}.
  2485. * @param status ICU error code.
  2486. * @stable ICU 53
  2487. */
  2488. static MeasureUnit *createKilowatt(UErrorCode &status);
  2489. /**
  2490. * Returns by value, unit of power: kilowatt.
  2491. * Also see {@link #createKilowatt()}.
  2492. * @stable ICU 64
  2493. */
  2494. static MeasureUnit getKilowatt();
  2495. /**
  2496. * Returns by pointer, unit of power: megawatt.
  2497. * Caller owns returned value and must free it.
  2498. * Also see {@link #getMegawatt()}.
  2499. * @param status ICU error code.
  2500. * @stable ICU 54
  2501. */
  2502. static MeasureUnit *createMegawatt(UErrorCode &status);
  2503. /**
  2504. * Returns by value, unit of power: megawatt.
  2505. * Also see {@link #createMegawatt()}.
  2506. * @stable ICU 64
  2507. */
  2508. static MeasureUnit getMegawatt();
  2509. /**
  2510. * Returns by pointer, unit of power: milliwatt.
  2511. * Caller owns returned value and must free it.
  2512. * Also see {@link #getMilliwatt()}.
  2513. * @param status ICU error code.
  2514. * @stable ICU 54
  2515. */
  2516. static MeasureUnit *createMilliwatt(UErrorCode &status);
  2517. /**
  2518. * Returns by value, unit of power: milliwatt.
  2519. * Also see {@link #createMilliwatt()}.
  2520. * @stable ICU 64
  2521. */
  2522. static MeasureUnit getMilliwatt();
  2523. /**
  2524. * Returns by pointer, unit of power: watt.
  2525. * Caller owns returned value and must free it.
  2526. * Also see {@link #getWatt()}.
  2527. * @param status ICU error code.
  2528. * @stable ICU 53
  2529. */
  2530. static MeasureUnit *createWatt(UErrorCode &status);
  2531. /**
  2532. * Returns by value, unit of power: watt.
  2533. * Also see {@link #createWatt()}.
  2534. * @stable ICU 64
  2535. */
  2536. static MeasureUnit getWatt();
  2537. /**
  2538. * Returns by pointer, unit of pressure: atmosphere.
  2539. * Caller owns returned value and must free it.
  2540. * Also see {@link #getAtmosphere()}.
  2541. * @param status ICU error code.
  2542. * @stable ICU 63
  2543. */
  2544. static MeasureUnit *createAtmosphere(UErrorCode &status);
  2545. /**
  2546. * Returns by value, unit of pressure: atmosphere.
  2547. * Also see {@link #createAtmosphere()}.
  2548. * @stable ICU 64
  2549. */
  2550. static MeasureUnit getAtmosphere();
  2551. /**
  2552. * Returns by pointer, unit of pressure: bar.
  2553. * Caller owns returned value and must free it.
  2554. * Also see {@link #getBar()}.
  2555. * @param status ICU error code.
  2556. * @stable ICU 65
  2557. */
  2558. static MeasureUnit *createBar(UErrorCode &status);
  2559. /**
  2560. * Returns by value, unit of pressure: bar.
  2561. * Also see {@link #createBar()}.
  2562. * @stable ICU 65
  2563. */
  2564. static MeasureUnit getBar();
  2565. #ifndef U_HIDE_DRAFT_API
  2566. /**
  2567. * Returns by pointer, unit of pressure: gasoline-energy-density.
  2568. * Caller owns returned value and must free it.
  2569. * Also see {@link #getGasolineEnergyDensity()}.
  2570. * @param status ICU error code.
  2571. * @draft ICU 74
  2572. */
  2573. static MeasureUnit *createGasolineEnergyDensity(UErrorCode &status);
  2574. /**
  2575. * Returns by value, unit of pressure: gasoline-energy-density.
  2576. * Also see {@link #createGasolineEnergyDensity()}.
  2577. * @draft ICU 74
  2578. */
  2579. static MeasureUnit getGasolineEnergyDensity();
  2580. #endif /* U_HIDE_DRAFT_API */
  2581. /**
  2582. * Returns by pointer, unit of pressure: hectopascal.
  2583. * Caller owns returned value and must free it.
  2584. * Also see {@link #getHectopascal()}.
  2585. * @param status ICU error code.
  2586. * @stable ICU 53
  2587. */
  2588. static MeasureUnit *createHectopascal(UErrorCode &status);
  2589. /**
  2590. * Returns by value, unit of pressure: hectopascal.
  2591. * Also see {@link #createHectopascal()}.
  2592. * @stable ICU 64
  2593. */
  2594. static MeasureUnit getHectopascal();
  2595. /**
  2596. * Returns by pointer, unit of pressure: inch-ofhg.
  2597. * Caller owns returned value and must free it.
  2598. * Also see {@link #getInchHg()}.
  2599. * @param status ICU error code.
  2600. * @stable ICU 53
  2601. */
  2602. static MeasureUnit *createInchHg(UErrorCode &status);
  2603. /**
  2604. * Returns by value, unit of pressure: inch-ofhg.
  2605. * Also see {@link #createInchHg()}.
  2606. * @stable ICU 64
  2607. */
  2608. static MeasureUnit getInchHg();
  2609. /**
  2610. * Returns by pointer, unit of pressure: kilopascal.
  2611. * Caller owns returned value and must free it.
  2612. * Also see {@link #getKilopascal()}.
  2613. * @param status ICU error code.
  2614. * @stable ICU 64
  2615. */
  2616. static MeasureUnit *createKilopascal(UErrorCode &status);
  2617. /**
  2618. * Returns by value, unit of pressure: kilopascal.
  2619. * Also see {@link #createKilopascal()}.
  2620. * @stable ICU 64
  2621. */
  2622. static MeasureUnit getKilopascal();
  2623. /**
  2624. * Returns by pointer, unit of pressure: megapascal.
  2625. * Caller owns returned value and must free it.
  2626. * Also see {@link #getMegapascal()}.
  2627. * @param status ICU error code.
  2628. * @stable ICU 64
  2629. */
  2630. static MeasureUnit *createMegapascal(UErrorCode &status);
  2631. /**
  2632. * Returns by value, unit of pressure: megapascal.
  2633. * Also see {@link #createMegapascal()}.
  2634. * @stable ICU 64
  2635. */
  2636. static MeasureUnit getMegapascal();
  2637. /**
  2638. * Returns by pointer, unit of pressure: millibar.
  2639. * Caller owns returned value and must free it.
  2640. * Also see {@link #getMillibar()}.
  2641. * @param status ICU error code.
  2642. * @stable ICU 53
  2643. */
  2644. static MeasureUnit *createMillibar(UErrorCode &status);
  2645. /**
  2646. * Returns by value, unit of pressure: millibar.
  2647. * Also see {@link #createMillibar()}.
  2648. * @stable ICU 64
  2649. */
  2650. static MeasureUnit getMillibar();
  2651. /**
  2652. * Returns by pointer, unit of pressure: millimeter-ofhg.
  2653. * Caller owns returned value and must free it.
  2654. * Also see {@link #getMillimeterOfMercury()}.
  2655. * @param status ICU error code.
  2656. * @stable ICU 54
  2657. */
  2658. static MeasureUnit *createMillimeterOfMercury(UErrorCode &status);
  2659. /**
  2660. * Returns by value, unit of pressure: millimeter-ofhg.
  2661. * Also see {@link #createMillimeterOfMercury()}.
  2662. * @stable ICU 64
  2663. */
  2664. static MeasureUnit getMillimeterOfMercury();
  2665. /**
  2666. * Returns by pointer, unit of pressure: pascal.
  2667. * Caller owns returned value and must free it.
  2668. * Also see {@link #getPascal()}.
  2669. * @param status ICU error code.
  2670. * @stable ICU 65
  2671. */
  2672. static MeasureUnit *createPascal(UErrorCode &status);
  2673. /**
  2674. * Returns by value, unit of pressure: pascal.
  2675. * Also see {@link #createPascal()}.
  2676. * @stable ICU 65
  2677. */
  2678. static MeasureUnit getPascal();
  2679. /**
  2680. * Returns by pointer, unit of pressure: pound-force-per-square-inch.
  2681. * Caller owns returned value and must free it.
  2682. * Also see {@link #getPoundPerSquareInch()}.
  2683. * @param status ICU error code.
  2684. * @stable ICU 54
  2685. */
  2686. static MeasureUnit *createPoundPerSquareInch(UErrorCode &status);
  2687. /**
  2688. * Returns by value, unit of pressure: pound-force-per-square-inch.
  2689. * Also see {@link #createPoundPerSquareInch()}.
  2690. * @stable ICU 64
  2691. */
  2692. static MeasureUnit getPoundPerSquareInch();
  2693. /**
  2694. * Returns by pointer, unit of speed: beaufort.
  2695. * Caller owns returned value and must free it.
  2696. * Also see {@link #getBeaufort()}.
  2697. * @param status ICU error code.
  2698. * @stable ICU 73
  2699. */
  2700. static MeasureUnit *createBeaufort(UErrorCode &status);
  2701. /**
  2702. * Returns by value, unit of speed: beaufort.
  2703. * Also see {@link #createBeaufort()}.
  2704. * @stable ICU 73
  2705. */
  2706. static MeasureUnit getBeaufort();
  2707. /**
  2708. * Returns by pointer, unit of speed: kilometer-per-hour.
  2709. * Caller owns returned value and must free it.
  2710. * Also see {@link #getKilometerPerHour()}.
  2711. * @param status ICU error code.
  2712. * @stable ICU 53
  2713. */
  2714. static MeasureUnit *createKilometerPerHour(UErrorCode &status);
  2715. /**
  2716. * Returns by value, unit of speed: kilometer-per-hour.
  2717. * Also see {@link #createKilometerPerHour()}.
  2718. * @stable ICU 64
  2719. */
  2720. static MeasureUnit getKilometerPerHour();
  2721. /**
  2722. * Returns by pointer, unit of speed: knot.
  2723. * Caller owns returned value and must free it.
  2724. * Also see {@link #getKnot()}.
  2725. * @param status ICU error code.
  2726. * @stable ICU 56
  2727. */
  2728. static MeasureUnit *createKnot(UErrorCode &status);
  2729. /**
  2730. * Returns by value, unit of speed: knot.
  2731. * Also see {@link #createKnot()}.
  2732. * @stable ICU 64
  2733. */
  2734. static MeasureUnit getKnot();
  2735. /**
  2736. * Returns by pointer, unit of speed: meter-per-second.
  2737. * Caller owns returned value and must free it.
  2738. * Also see {@link #getMeterPerSecond()}.
  2739. * @param status ICU error code.
  2740. * @stable ICU 53
  2741. */
  2742. static MeasureUnit *createMeterPerSecond(UErrorCode &status);
  2743. /**
  2744. * Returns by value, unit of speed: meter-per-second.
  2745. * Also see {@link #createMeterPerSecond()}.
  2746. * @stable ICU 64
  2747. */
  2748. static MeasureUnit getMeterPerSecond();
  2749. /**
  2750. * Returns by pointer, unit of speed: mile-per-hour.
  2751. * Caller owns returned value and must free it.
  2752. * Also see {@link #getMilePerHour()}.
  2753. * @param status ICU error code.
  2754. * @stable ICU 53
  2755. */
  2756. static MeasureUnit *createMilePerHour(UErrorCode &status);
  2757. /**
  2758. * Returns by value, unit of speed: mile-per-hour.
  2759. * Also see {@link #createMilePerHour()}.
  2760. * @stable ICU 64
  2761. */
  2762. static MeasureUnit getMilePerHour();
  2763. /**
  2764. * Returns by pointer, unit of temperature: celsius.
  2765. * Caller owns returned value and must free it.
  2766. * Also see {@link #getCelsius()}.
  2767. * @param status ICU error code.
  2768. * @stable ICU 53
  2769. */
  2770. static MeasureUnit *createCelsius(UErrorCode &status);
  2771. /**
  2772. * Returns by value, unit of temperature: celsius.
  2773. * Also see {@link #createCelsius()}.
  2774. * @stable ICU 64
  2775. */
  2776. static MeasureUnit getCelsius();
  2777. /**
  2778. * Returns by pointer, unit of temperature: fahrenheit.
  2779. * Caller owns returned value and must free it.
  2780. * Also see {@link #getFahrenheit()}.
  2781. * @param status ICU error code.
  2782. * @stable ICU 53
  2783. */
  2784. static MeasureUnit *createFahrenheit(UErrorCode &status);
  2785. /**
  2786. * Returns by value, unit of temperature: fahrenheit.
  2787. * Also see {@link #createFahrenheit()}.
  2788. * @stable ICU 64
  2789. */
  2790. static MeasureUnit getFahrenheit();
  2791. /**
  2792. * Returns by pointer, unit of temperature: generic.
  2793. * Caller owns returned value and must free it.
  2794. * Also see {@link #getGenericTemperature()}.
  2795. * @param status ICU error code.
  2796. * @stable ICU 56
  2797. */
  2798. static MeasureUnit *createGenericTemperature(UErrorCode &status);
  2799. /**
  2800. * Returns by value, unit of temperature: generic.
  2801. * Also see {@link #createGenericTemperature()}.
  2802. * @stable ICU 64
  2803. */
  2804. static MeasureUnit getGenericTemperature();
  2805. /**
  2806. * Returns by pointer, unit of temperature: kelvin.
  2807. * Caller owns returned value and must free it.
  2808. * Also see {@link #getKelvin()}.
  2809. * @param status ICU error code.
  2810. * @stable ICU 54
  2811. */
  2812. static MeasureUnit *createKelvin(UErrorCode &status);
  2813. /**
  2814. * Returns by value, unit of temperature: kelvin.
  2815. * Also see {@link #createKelvin()}.
  2816. * @stable ICU 64
  2817. */
  2818. static MeasureUnit getKelvin();
  2819. /**
  2820. * Returns by pointer, unit of torque: newton-meter.
  2821. * Caller owns returned value and must free it.
  2822. * Also see {@link #getNewtonMeter()}.
  2823. * @param status ICU error code.
  2824. * @stable ICU 64
  2825. */
  2826. static MeasureUnit *createNewtonMeter(UErrorCode &status);
  2827. /**
  2828. * Returns by value, unit of torque: newton-meter.
  2829. * Also see {@link #createNewtonMeter()}.
  2830. * @stable ICU 64
  2831. */
  2832. static MeasureUnit getNewtonMeter();
  2833. /**
  2834. * Returns by pointer, unit of torque: pound-force-foot.
  2835. * Caller owns returned value and must free it.
  2836. * Also see {@link #getPoundFoot()}.
  2837. * @param status ICU error code.
  2838. * @stable ICU 64
  2839. */
  2840. static MeasureUnit *createPoundFoot(UErrorCode &status);
  2841. /**
  2842. * Returns by value, unit of torque: pound-force-foot.
  2843. * Also see {@link #createPoundFoot()}.
  2844. * @stable ICU 64
  2845. */
  2846. static MeasureUnit getPoundFoot();
  2847. /**
  2848. * Returns by pointer, unit of volume: acre-foot.
  2849. * Caller owns returned value and must free it.
  2850. * Also see {@link #getAcreFoot()}.
  2851. * @param status ICU error code.
  2852. * @stable ICU 54
  2853. */
  2854. static MeasureUnit *createAcreFoot(UErrorCode &status);
  2855. /**
  2856. * Returns by value, unit of volume: acre-foot.
  2857. * Also see {@link #createAcreFoot()}.
  2858. * @stable ICU 64
  2859. */
  2860. static MeasureUnit getAcreFoot();
  2861. /**
  2862. * Returns by pointer, unit of volume: barrel.
  2863. * Caller owns returned value and must free it.
  2864. * Also see {@link #getBarrel()}.
  2865. * @param status ICU error code.
  2866. * @stable ICU 64
  2867. */
  2868. static MeasureUnit *createBarrel(UErrorCode &status);
  2869. /**
  2870. * Returns by value, unit of volume: barrel.
  2871. * Also see {@link #createBarrel()}.
  2872. * @stable ICU 64
  2873. */
  2874. static MeasureUnit getBarrel();
  2875. /**
  2876. * Returns by pointer, unit of volume: bushel.
  2877. * Caller owns returned value and must free it.
  2878. * Also see {@link #getBushel()}.
  2879. * @param status ICU error code.
  2880. * @stable ICU 54
  2881. */
  2882. static MeasureUnit *createBushel(UErrorCode &status);
  2883. /**
  2884. * Returns by value, unit of volume: bushel.
  2885. * Also see {@link #createBushel()}.
  2886. * @stable ICU 64
  2887. */
  2888. static MeasureUnit getBushel();
  2889. /**
  2890. * Returns by pointer, unit of volume: centiliter.
  2891. * Caller owns returned value and must free it.
  2892. * Also see {@link #getCentiliter()}.
  2893. * @param status ICU error code.
  2894. * @stable ICU 54
  2895. */
  2896. static MeasureUnit *createCentiliter(UErrorCode &status);
  2897. /**
  2898. * Returns by value, unit of volume: centiliter.
  2899. * Also see {@link #createCentiliter()}.
  2900. * @stable ICU 64
  2901. */
  2902. static MeasureUnit getCentiliter();
  2903. /**
  2904. * Returns by pointer, unit of volume: cubic-centimeter.
  2905. * Caller owns returned value and must free it.
  2906. * Also see {@link #getCubicCentimeter()}.
  2907. * @param status ICU error code.
  2908. * @stable ICU 54
  2909. */
  2910. static MeasureUnit *createCubicCentimeter(UErrorCode &status);
  2911. /**
  2912. * Returns by value, unit of volume: cubic-centimeter.
  2913. * Also see {@link #createCubicCentimeter()}.
  2914. * @stable ICU 64
  2915. */
  2916. static MeasureUnit getCubicCentimeter();
  2917. /**
  2918. * Returns by pointer, unit of volume: cubic-foot.
  2919. * Caller owns returned value and must free it.
  2920. * Also see {@link #getCubicFoot()}.
  2921. * @param status ICU error code.
  2922. * @stable ICU 54
  2923. */
  2924. static MeasureUnit *createCubicFoot(UErrorCode &status);
  2925. /**
  2926. * Returns by value, unit of volume: cubic-foot.
  2927. * Also see {@link #createCubicFoot()}.
  2928. * @stable ICU 64
  2929. */
  2930. static MeasureUnit getCubicFoot();
  2931. /**
  2932. * Returns by pointer, unit of volume: cubic-inch.
  2933. * Caller owns returned value and must free it.
  2934. * Also see {@link #getCubicInch()}.
  2935. * @param status ICU error code.
  2936. * @stable ICU 54
  2937. */
  2938. static MeasureUnit *createCubicInch(UErrorCode &status);
  2939. /**
  2940. * Returns by value, unit of volume: cubic-inch.
  2941. * Also see {@link #createCubicInch()}.
  2942. * @stable ICU 64
  2943. */
  2944. static MeasureUnit getCubicInch();
  2945. /**
  2946. * Returns by pointer, unit of volume: cubic-kilometer.
  2947. * Caller owns returned value and must free it.
  2948. * Also see {@link #getCubicKilometer()}.
  2949. * @param status ICU error code.
  2950. * @stable ICU 53
  2951. */
  2952. static MeasureUnit *createCubicKilometer(UErrorCode &status);
  2953. /**
  2954. * Returns by value, unit of volume: cubic-kilometer.
  2955. * Also see {@link #createCubicKilometer()}.
  2956. * @stable ICU 64
  2957. */
  2958. static MeasureUnit getCubicKilometer();
  2959. /**
  2960. * Returns by pointer, unit of volume: cubic-meter.
  2961. * Caller owns returned value and must free it.
  2962. * Also see {@link #getCubicMeter()}.
  2963. * @param status ICU error code.
  2964. * @stable ICU 54
  2965. */
  2966. static MeasureUnit *createCubicMeter(UErrorCode &status);
  2967. /**
  2968. * Returns by value, unit of volume: cubic-meter.
  2969. * Also see {@link #createCubicMeter()}.
  2970. * @stable ICU 64
  2971. */
  2972. static MeasureUnit getCubicMeter();
  2973. /**
  2974. * Returns by pointer, unit of volume: cubic-mile.
  2975. * Caller owns returned value and must free it.
  2976. * Also see {@link #getCubicMile()}.
  2977. * @param status ICU error code.
  2978. * @stable ICU 53
  2979. */
  2980. static MeasureUnit *createCubicMile(UErrorCode &status);
  2981. /**
  2982. * Returns by value, unit of volume: cubic-mile.
  2983. * Also see {@link #createCubicMile()}.
  2984. * @stable ICU 64
  2985. */
  2986. static MeasureUnit getCubicMile();
  2987. /**
  2988. * Returns by pointer, unit of volume: cubic-yard.
  2989. * Caller owns returned value and must free it.
  2990. * Also see {@link #getCubicYard()}.
  2991. * @param status ICU error code.
  2992. * @stable ICU 54
  2993. */
  2994. static MeasureUnit *createCubicYard(UErrorCode &status);
  2995. /**
  2996. * Returns by value, unit of volume: cubic-yard.
  2997. * Also see {@link #createCubicYard()}.
  2998. * @stable ICU 64
  2999. */
  3000. static MeasureUnit getCubicYard();
  3001. /**
  3002. * Returns by pointer, unit of volume: cup.
  3003. * Caller owns returned value and must free it.
  3004. * Also see {@link #getCup()}.
  3005. * @param status ICU error code.
  3006. * @stable ICU 54
  3007. */
  3008. static MeasureUnit *createCup(UErrorCode &status);
  3009. /**
  3010. * Returns by value, unit of volume: cup.
  3011. * Also see {@link #createCup()}.
  3012. * @stable ICU 64
  3013. */
  3014. static MeasureUnit getCup();
  3015. /**
  3016. * Returns by pointer, unit of volume: cup-metric.
  3017. * Caller owns returned value and must free it.
  3018. * Also see {@link #getCupMetric()}.
  3019. * @param status ICU error code.
  3020. * @stable ICU 56
  3021. */
  3022. static MeasureUnit *createCupMetric(UErrorCode &status);
  3023. /**
  3024. * Returns by value, unit of volume: cup-metric.
  3025. * Also see {@link #createCupMetric()}.
  3026. * @stable ICU 64
  3027. */
  3028. static MeasureUnit getCupMetric();
  3029. /**
  3030. * Returns by pointer, unit of volume: deciliter.
  3031. * Caller owns returned value and must free it.
  3032. * Also see {@link #getDeciliter()}.
  3033. * @param status ICU error code.
  3034. * @stable ICU 54
  3035. */
  3036. static MeasureUnit *createDeciliter(UErrorCode &status);
  3037. /**
  3038. * Returns by value, unit of volume: deciliter.
  3039. * Also see {@link #createDeciliter()}.
  3040. * @stable ICU 64
  3041. */
  3042. static MeasureUnit getDeciliter();
  3043. /**
  3044. * Returns by pointer, unit of volume: dessert-spoon.
  3045. * Caller owns returned value and must free it.
  3046. * Also see {@link #getDessertSpoon()}.
  3047. * @param status ICU error code.
  3048. * @stable ICU 68
  3049. */
  3050. static MeasureUnit *createDessertSpoon(UErrorCode &status);
  3051. /**
  3052. * Returns by value, unit of volume: dessert-spoon.
  3053. * Also see {@link #createDessertSpoon()}.
  3054. * @stable ICU 68
  3055. */
  3056. static MeasureUnit getDessertSpoon();
  3057. /**
  3058. * Returns by pointer, unit of volume: dessert-spoon-imperial.
  3059. * Caller owns returned value and must free it.
  3060. * Also see {@link #getDessertSpoonImperial()}.
  3061. * @param status ICU error code.
  3062. * @stable ICU 68
  3063. */
  3064. static MeasureUnit *createDessertSpoonImperial(UErrorCode &status);
  3065. /**
  3066. * Returns by value, unit of volume: dessert-spoon-imperial.
  3067. * Also see {@link #createDessertSpoonImperial()}.
  3068. * @stable ICU 68
  3069. */
  3070. static MeasureUnit getDessertSpoonImperial();
  3071. /**
  3072. * Returns by pointer, unit of volume: dram.
  3073. * Caller owns returned value and must free it.
  3074. * Also see {@link #getDram()}.
  3075. * @param status ICU error code.
  3076. * @stable ICU 68
  3077. */
  3078. static MeasureUnit *createDram(UErrorCode &status);
  3079. /**
  3080. * Returns by value, unit of volume: dram.
  3081. * Also see {@link #createDram()}.
  3082. * @stable ICU 68
  3083. */
  3084. static MeasureUnit getDram();
  3085. /**
  3086. * Returns by pointer, unit of volume: drop.
  3087. * Caller owns returned value and must free it.
  3088. * Also see {@link #getDrop()}.
  3089. * @param status ICU error code.
  3090. * @stable ICU 68
  3091. */
  3092. static MeasureUnit *createDrop(UErrorCode &status);
  3093. /**
  3094. * Returns by value, unit of volume: drop.
  3095. * Also see {@link #createDrop()}.
  3096. * @stable ICU 68
  3097. */
  3098. static MeasureUnit getDrop();
  3099. /**
  3100. * Returns by pointer, unit of volume: fluid-ounce.
  3101. * Caller owns returned value and must free it.
  3102. * Also see {@link #getFluidOunce()}.
  3103. * @param status ICU error code.
  3104. * @stable ICU 54
  3105. */
  3106. static MeasureUnit *createFluidOunce(UErrorCode &status);
  3107. /**
  3108. * Returns by value, unit of volume: fluid-ounce.
  3109. * Also see {@link #createFluidOunce()}.
  3110. * @stable ICU 64
  3111. */
  3112. static MeasureUnit getFluidOunce();
  3113. /**
  3114. * Returns by pointer, unit of volume: fluid-ounce-imperial.
  3115. * Caller owns returned value and must free it.
  3116. * Also see {@link #getFluidOunceImperial()}.
  3117. * @param status ICU error code.
  3118. * @stable ICU 64
  3119. */
  3120. static MeasureUnit *createFluidOunceImperial(UErrorCode &status);
  3121. /**
  3122. * Returns by value, unit of volume: fluid-ounce-imperial.
  3123. * Also see {@link #createFluidOunceImperial()}.
  3124. * @stable ICU 64
  3125. */
  3126. static MeasureUnit getFluidOunceImperial();
  3127. /**
  3128. * Returns by pointer, unit of volume: gallon.
  3129. * Caller owns returned value and must free it.
  3130. * Also see {@link #getGallon()}.
  3131. * @param status ICU error code.
  3132. * @stable ICU 54
  3133. */
  3134. static MeasureUnit *createGallon(UErrorCode &status);
  3135. /**
  3136. * Returns by value, unit of volume: gallon.
  3137. * Also see {@link #createGallon()}.
  3138. * @stable ICU 64
  3139. */
  3140. static MeasureUnit getGallon();
  3141. /**
  3142. * Returns by pointer, unit of volume: gallon-imperial.
  3143. * Caller owns returned value and must free it.
  3144. * Also see {@link #getGallonImperial()}.
  3145. * @param status ICU error code.
  3146. * @stable ICU 57
  3147. */
  3148. static MeasureUnit *createGallonImperial(UErrorCode &status);
  3149. /**
  3150. * Returns by value, unit of volume: gallon-imperial.
  3151. * Also see {@link #createGallonImperial()}.
  3152. * @stable ICU 64
  3153. */
  3154. static MeasureUnit getGallonImperial();
  3155. /**
  3156. * Returns by pointer, unit of volume: hectoliter.
  3157. * Caller owns returned value and must free it.
  3158. * Also see {@link #getHectoliter()}.
  3159. * @param status ICU error code.
  3160. * @stable ICU 54
  3161. */
  3162. static MeasureUnit *createHectoliter(UErrorCode &status);
  3163. /**
  3164. * Returns by value, unit of volume: hectoliter.
  3165. * Also see {@link #createHectoliter()}.
  3166. * @stable ICU 64
  3167. */
  3168. static MeasureUnit getHectoliter();
  3169. /**
  3170. * Returns by pointer, unit of volume: jigger.
  3171. * Caller owns returned value and must free it.
  3172. * Also see {@link #getJigger()}.
  3173. * @param status ICU error code.
  3174. * @stable ICU 68
  3175. */
  3176. static MeasureUnit *createJigger(UErrorCode &status);
  3177. /**
  3178. * Returns by value, unit of volume: jigger.
  3179. * Also see {@link #createJigger()}.
  3180. * @stable ICU 68
  3181. */
  3182. static MeasureUnit getJigger();
  3183. /**
  3184. * Returns by pointer, unit of volume: liter.
  3185. * Caller owns returned value and must free it.
  3186. * Also see {@link #getLiter()}.
  3187. * @param status ICU error code.
  3188. * @stable ICU 53
  3189. */
  3190. static MeasureUnit *createLiter(UErrorCode &status);
  3191. /**
  3192. * Returns by value, unit of volume: liter.
  3193. * Also see {@link #createLiter()}.
  3194. * @stable ICU 64
  3195. */
  3196. static MeasureUnit getLiter();
  3197. /**
  3198. * Returns by pointer, unit of volume: megaliter.
  3199. * Caller owns returned value and must free it.
  3200. * Also see {@link #getMegaliter()}.
  3201. * @param status ICU error code.
  3202. * @stable ICU 54
  3203. */
  3204. static MeasureUnit *createMegaliter(UErrorCode &status);
  3205. /**
  3206. * Returns by value, unit of volume: megaliter.
  3207. * Also see {@link #createMegaliter()}.
  3208. * @stable ICU 64
  3209. */
  3210. static MeasureUnit getMegaliter();
  3211. /**
  3212. * Returns by pointer, unit of volume: milliliter.
  3213. * Caller owns returned value and must free it.
  3214. * Also see {@link #getMilliliter()}.
  3215. * @param status ICU error code.
  3216. * @stable ICU 54
  3217. */
  3218. static MeasureUnit *createMilliliter(UErrorCode &status);
  3219. /**
  3220. * Returns by value, unit of volume: milliliter.
  3221. * Also see {@link #createMilliliter()}.
  3222. * @stable ICU 64
  3223. */
  3224. static MeasureUnit getMilliliter();
  3225. /**
  3226. * Returns by pointer, unit of volume: pinch.
  3227. * Caller owns returned value and must free it.
  3228. * Also see {@link #getPinch()}.
  3229. * @param status ICU error code.
  3230. * @stable ICU 68
  3231. */
  3232. static MeasureUnit *createPinch(UErrorCode &status);
  3233. /**
  3234. * Returns by value, unit of volume: pinch.
  3235. * Also see {@link #createPinch()}.
  3236. * @stable ICU 68
  3237. */
  3238. static MeasureUnit getPinch();
  3239. /**
  3240. * Returns by pointer, unit of volume: pint.
  3241. * Caller owns returned value and must free it.
  3242. * Also see {@link #getPint()}.
  3243. * @param status ICU error code.
  3244. * @stable ICU 54
  3245. */
  3246. static MeasureUnit *createPint(UErrorCode &status);
  3247. /**
  3248. * Returns by value, unit of volume: pint.
  3249. * Also see {@link #createPint()}.
  3250. * @stable ICU 64
  3251. */
  3252. static MeasureUnit getPint();
  3253. /**
  3254. * Returns by pointer, unit of volume: pint-metric.
  3255. * Caller owns returned value and must free it.
  3256. * Also see {@link #getPintMetric()}.
  3257. * @param status ICU error code.
  3258. * @stable ICU 56
  3259. */
  3260. static MeasureUnit *createPintMetric(UErrorCode &status);
  3261. /**
  3262. * Returns by value, unit of volume: pint-metric.
  3263. * Also see {@link #createPintMetric()}.
  3264. * @stable ICU 64
  3265. */
  3266. static MeasureUnit getPintMetric();
  3267. /**
  3268. * Returns by pointer, unit of volume: quart.
  3269. * Caller owns returned value and must free it.
  3270. * Also see {@link #getQuart()}.
  3271. * @param status ICU error code.
  3272. * @stable ICU 54
  3273. */
  3274. static MeasureUnit *createQuart(UErrorCode &status);
  3275. /**
  3276. * Returns by value, unit of volume: quart.
  3277. * Also see {@link #createQuart()}.
  3278. * @stable ICU 64
  3279. */
  3280. static MeasureUnit getQuart();
  3281. /**
  3282. * Returns by pointer, unit of volume: quart-imperial.
  3283. * Caller owns returned value and must free it.
  3284. * Also see {@link #getQuartImperial()}.
  3285. * @param status ICU error code.
  3286. * @stable ICU 68
  3287. */
  3288. static MeasureUnit *createQuartImperial(UErrorCode &status);
  3289. /**
  3290. * Returns by value, unit of volume: quart-imperial.
  3291. * Also see {@link #createQuartImperial()}.
  3292. * @stable ICU 68
  3293. */
  3294. static MeasureUnit getQuartImperial();
  3295. /**
  3296. * Returns by pointer, unit of volume: tablespoon.
  3297. * Caller owns returned value and must free it.
  3298. * Also see {@link #getTablespoon()}.
  3299. * @param status ICU error code.
  3300. * @stable ICU 54
  3301. */
  3302. static MeasureUnit *createTablespoon(UErrorCode &status);
  3303. /**
  3304. * Returns by value, unit of volume: tablespoon.
  3305. * Also see {@link #createTablespoon()}.
  3306. * @stable ICU 64
  3307. */
  3308. static MeasureUnit getTablespoon();
  3309. /**
  3310. * Returns by pointer, unit of volume: teaspoon.
  3311. * Caller owns returned value and must free it.
  3312. * Also see {@link #getTeaspoon()}.
  3313. * @param status ICU error code.
  3314. * @stable ICU 54
  3315. */
  3316. static MeasureUnit *createTeaspoon(UErrorCode &status);
  3317. /**
  3318. * Returns by value, unit of volume: teaspoon.
  3319. * Also see {@link #createTeaspoon()}.
  3320. * @stable ICU 64
  3321. */
  3322. static MeasureUnit getTeaspoon();
  3323. // End generated createXXX methods
  3324. protected:
  3325. #ifndef U_HIDE_INTERNAL_API
  3326. /**
  3327. * For ICU use only.
  3328. * @internal
  3329. */
  3330. void initTime(const char *timeId);
  3331. /**
  3332. * For ICU use only.
  3333. * @internal
  3334. */
  3335. void initCurrency(StringPiece isoCurrency);
  3336. #endif /* U_HIDE_INTERNAL_API */
  3337. private:
  3338. // Used by new draft APIs in ICU 67. If non-null, fImpl is owned by the
  3339. // MeasureUnit.
  3340. MeasureUnitImpl* fImpl;
  3341. // An index into a static string list in measunit.cpp. If set to -1, fImpl
  3342. // is in use instead of fTypeId and fSubTypeId.
  3343. int16_t fSubTypeId;
  3344. // An index into a static string list in measunit.cpp. If set to -1, fImpl
  3345. // is in use instead of fTypeId and fSubTypeId.
  3346. int8_t fTypeId;
  3347. MeasureUnit(int32_t typeId, int32_t subTypeId);
  3348. MeasureUnit(MeasureUnitImpl&& impl);
  3349. void setTo(int32_t typeId, int32_t subTypeId);
  3350. static MeasureUnit *create(int typeId, int subTypeId, UErrorCode &status);
  3351. /**
  3352. * Sets output's typeId and subTypeId according to subType, if subType is a
  3353. * valid/known identifier.
  3354. *
  3355. * @return Whether subType is known to ICU. If false, output was not
  3356. * modified.
  3357. */
  3358. static bool findBySubType(StringPiece subType, MeasureUnit* output);
  3359. /** Internal version of public API */
  3360. LocalArray<MeasureUnit> splitToSingleUnitsImpl(int32_t& outCount, UErrorCode& status) const;
  3361. friend class MeasureUnitImpl;
  3362. // For access to findBySubType
  3363. friend class number::impl::LongNameHandler;
  3364. };
  3365. // inline impl of @stable ICU 68 method
  3366. inline std::pair<LocalArray<MeasureUnit>, int32_t>
  3367. MeasureUnit::splitToSingleUnits(UErrorCode& status) const {
  3368. int32_t length;
  3369. auto array = splitToSingleUnitsImpl(length, status);
  3370. return std::make_pair(std::move(array), length);
  3371. }
  3372. U_NAMESPACE_END
  3373. #endif // !UNCONFIG_NO_FORMATTING
  3374. #endif /* U_SHOW_CPLUSPLUS_API */
  3375. #endif // __MEASUREUNIT_H__