measunit.h 109 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892
  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. #ifndef U_HIDE_DRAFT_API
  1382. /**
  1383. * Returns by pointer, unit of duration: night.
  1384. * Caller owns returned value and must free it.
  1385. * Also see {@link #getNight()}.
  1386. * @param status ICU error code.
  1387. * @draft ICU 76
  1388. */
  1389. static MeasureUnit *createNight(UErrorCode &status);
  1390. /**
  1391. * Returns by value, unit of duration: night.
  1392. * Also see {@link #createNight()}.
  1393. * @draft ICU 76
  1394. */
  1395. static MeasureUnit getNight();
  1396. #endif /* U_HIDE_DRAFT_API */
  1397. /**
  1398. * Returns by pointer, unit of duration: quarter.
  1399. * Caller owns returned value and must free it.
  1400. * Also see {@link #getQuarter()}.
  1401. * @param status ICU error code.
  1402. * @stable ICU 72
  1403. */
  1404. static MeasureUnit *createQuarter(UErrorCode &status);
  1405. /**
  1406. * Returns by value, unit of duration: quarter.
  1407. * Also see {@link #createQuarter()}.
  1408. * @stable ICU 72
  1409. */
  1410. static MeasureUnit getQuarter();
  1411. /**
  1412. * Returns by pointer, unit of duration: second.
  1413. * Caller owns returned value and must free it.
  1414. * Also see {@link #getSecond()}.
  1415. * @param status ICU error code.
  1416. * @stable ICU 53
  1417. */
  1418. static MeasureUnit *createSecond(UErrorCode &status);
  1419. /**
  1420. * Returns by value, unit of duration: second.
  1421. * Also see {@link #createSecond()}.
  1422. * @stable ICU 64
  1423. */
  1424. static MeasureUnit getSecond();
  1425. /**
  1426. * Returns by pointer, unit of duration: week.
  1427. * Caller owns returned value and must free it.
  1428. * Also see {@link #getWeek()}.
  1429. * @param status ICU error code.
  1430. * @stable ICU 53
  1431. */
  1432. static MeasureUnit *createWeek(UErrorCode &status);
  1433. /**
  1434. * Returns by value, unit of duration: week.
  1435. * Also see {@link #createWeek()}.
  1436. * @stable ICU 64
  1437. */
  1438. static MeasureUnit getWeek();
  1439. /**
  1440. * Returns by pointer, unit of duration: week-person.
  1441. * Caller owns returned value and must free it.
  1442. * Also see {@link #getWeekPerson()}.
  1443. * @param status ICU error code.
  1444. * @stable ICU 64
  1445. */
  1446. static MeasureUnit *createWeekPerson(UErrorCode &status);
  1447. /**
  1448. * Returns by value, unit of duration: week-person.
  1449. * Also see {@link #createWeekPerson()}.
  1450. * @stable ICU 64
  1451. */
  1452. static MeasureUnit getWeekPerson();
  1453. /**
  1454. * Returns by pointer, unit of duration: year.
  1455. * Caller owns returned value and must free it.
  1456. * Also see {@link #getYear()}.
  1457. * @param status ICU error code.
  1458. * @stable ICU 53
  1459. */
  1460. static MeasureUnit *createYear(UErrorCode &status);
  1461. /**
  1462. * Returns by value, unit of duration: year.
  1463. * Also see {@link #createYear()}.
  1464. * @stable ICU 64
  1465. */
  1466. static MeasureUnit getYear();
  1467. /**
  1468. * Returns by pointer, unit of duration: year-person.
  1469. * Caller owns returned value and must free it.
  1470. * Also see {@link #getYearPerson()}.
  1471. * @param status ICU error code.
  1472. * @stable ICU 64
  1473. */
  1474. static MeasureUnit *createYearPerson(UErrorCode &status);
  1475. /**
  1476. * Returns by value, unit of duration: year-person.
  1477. * Also see {@link #createYearPerson()}.
  1478. * @stable ICU 64
  1479. */
  1480. static MeasureUnit getYearPerson();
  1481. /**
  1482. * Returns by pointer, unit of electric: ampere.
  1483. * Caller owns returned value and must free it.
  1484. * Also see {@link #getAmpere()}.
  1485. * @param status ICU error code.
  1486. * @stable ICU 54
  1487. */
  1488. static MeasureUnit *createAmpere(UErrorCode &status);
  1489. /**
  1490. * Returns by value, unit of electric: ampere.
  1491. * Also see {@link #createAmpere()}.
  1492. * @stable ICU 64
  1493. */
  1494. static MeasureUnit getAmpere();
  1495. /**
  1496. * Returns by pointer, unit of electric: milliampere.
  1497. * Caller owns returned value and must free it.
  1498. * Also see {@link #getMilliampere()}.
  1499. * @param status ICU error code.
  1500. * @stable ICU 54
  1501. */
  1502. static MeasureUnit *createMilliampere(UErrorCode &status);
  1503. /**
  1504. * Returns by value, unit of electric: milliampere.
  1505. * Also see {@link #createMilliampere()}.
  1506. * @stable ICU 64
  1507. */
  1508. static MeasureUnit getMilliampere();
  1509. /**
  1510. * Returns by pointer, unit of electric: ohm.
  1511. * Caller owns returned value and must free it.
  1512. * Also see {@link #getOhm()}.
  1513. * @param status ICU error code.
  1514. * @stable ICU 54
  1515. */
  1516. static MeasureUnit *createOhm(UErrorCode &status);
  1517. /**
  1518. * Returns by value, unit of electric: ohm.
  1519. * Also see {@link #createOhm()}.
  1520. * @stable ICU 64
  1521. */
  1522. static MeasureUnit getOhm();
  1523. /**
  1524. * Returns by pointer, unit of electric: volt.
  1525. * Caller owns returned value and must free it.
  1526. * Also see {@link #getVolt()}.
  1527. * @param status ICU error code.
  1528. * @stable ICU 54
  1529. */
  1530. static MeasureUnit *createVolt(UErrorCode &status);
  1531. /**
  1532. * Returns by value, unit of electric: volt.
  1533. * Also see {@link #createVolt()}.
  1534. * @stable ICU 64
  1535. */
  1536. static MeasureUnit getVolt();
  1537. /**
  1538. * Returns by pointer, unit of energy: british-thermal-unit.
  1539. * Caller owns returned value and must free it.
  1540. * Also see {@link #getBritishThermalUnit()}.
  1541. * @param status ICU error code.
  1542. * @stable ICU 64
  1543. */
  1544. static MeasureUnit *createBritishThermalUnit(UErrorCode &status);
  1545. /**
  1546. * Returns by value, unit of energy: british-thermal-unit.
  1547. * Also see {@link #createBritishThermalUnit()}.
  1548. * @stable ICU 64
  1549. */
  1550. static MeasureUnit getBritishThermalUnit();
  1551. /**
  1552. * Returns by pointer, unit of energy: calorie.
  1553. * Caller owns returned value and must free it.
  1554. * Also see {@link #getCalorie()}.
  1555. * @param status ICU error code.
  1556. * @stable ICU 54
  1557. */
  1558. static MeasureUnit *createCalorie(UErrorCode &status);
  1559. /**
  1560. * Returns by value, unit of energy: calorie.
  1561. * Also see {@link #createCalorie()}.
  1562. * @stable ICU 64
  1563. */
  1564. static MeasureUnit getCalorie();
  1565. /**
  1566. * Returns by pointer, unit of energy: electronvolt.
  1567. * Caller owns returned value and must free it.
  1568. * Also see {@link #getElectronvolt()}.
  1569. * @param status ICU error code.
  1570. * @stable ICU 64
  1571. */
  1572. static MeasureUnit *createElectronvolt(UErrorCode &status);
  1573. /**
  1574. * Returns by value, unit of energy: electronvolt.
  1575. * Also see {@link #createElectronvolt()}.
  1576. * @stable ICU 64
  1577. */
  1578. static MeasureUnit getElectronvolt();
  1579. /**
  1580. * Returns by pointer, unit of energy: foodcalorie.
  1581. * Caller owns returned value and must free it.
  1582. * Also see {@link #getFoodcalorie()}.
  1583. * @param status ICU error code.
  1584. * @stable ICU 54
  1585. */
  1586. static MeasureUnit *createFoodcalorie(UErrorCode &status);
  1587. /**
  1588. * Returns by value, unit of energy: foodcalorie.
  1589. * Also see {@link #createFoodcalorie()}.
  1590. * @stable ICU 64
  1591. */
  1592. static MeasureUnit getFoodcalorie();
  1593. /**
  1594. * Returns by pointer, unit of energy: joule.
  1595. * Caller owns returned value and must free it.
  1596. * Also see {@link #getJoule()}.
  1597. * @param status ICU error code.
  1598. * @stable ICU 54
  1599. */
  1600. static MeasureUnit *createJoule(UErrorCode &status);
  1601. /**
  1602. * Returns by value, unit of energy: joule.
  1603. * Also see {@link #createJoule()}.
  1604. * @stable ICU 64
  1605. */
  1606. static MeasureUnit getJoule();
  1607. /**
  1608. * Returns by pointer, unit of energy: kilocalorie.
  1609. * Caller owns returned value and must free it.
  1610. * Also see {@link #getKilocalorie()}.
  1611. * @param status ICU error code.
  1612. * @stable ICU 54
  1613. */
  1614. static MeasureUnit *createKilocalorie(UErrorCode &status);
  1615. /**
  1616. * Returns by value, unit of energy: kilocalorie.
  1617. * Also see {@link #createKilocalorie()}.
  1618. * @stable ICU 64
  1619. */
  1620. static MeasureUnit getKilocalorie();
  1621. /**
  1622. * Returns by pointer, unit of energy: kilojoule.
  1623. * Caller owns returned value and must free it.
  1624. * Also see {@link #getKilojoule()}.
  1625. * @param status ICU error code.
  1626. * @stable ICU 54
  1627. */
  1628. static MeasureUnit *createKilojoule(UErrorCode &status);
  1629. /**
  1630. * Returns by value, unit of energy: kilojoule.
  1631. * Also see {@link #createKilojoule()}.
  1632. * @stable ICU 64
  1633. */
  1634. static MeasureUnit getKilojoule();
  1635. /**
  1636. * Returns by pointer, unit of energy: kilowatt-hour.
  1637. * Caller owns returned value and must free it.
  1638. * Also see {@link #getKilowattHour()}.
  1639. * @param status ICU error code.
  1640. * @stable ICU 54
  1641. */
  1642. static MeasureUnit *createKilowattHour(UErrorCode &status);
  1643. /**
  1644. * Returns by value, unit of energy: kilowatt-hour.
  1645. * Also see {@link #createKilowattHour()}.
  1646. * @stable ICU 64
  1647. */
  1648. static MeasureUnit getKilowattHour();
  1649. /**
  1650. * Returns by pointer, unit of energy: therm-us.
  1651. * Caller owns returned value and must free it.
  1652. * Also see {@link #getThermUs()}.
  1653. * @param status ICU error code.
  1654. * @stable ICU 65
  1655. */
  1656. static MeasureUnit *createThermUs(UErrorCode &status);
  1657. /**
  1658. * Returns by value, unit of energy: therm-us.
  1659. * Also see {@link #createThermUs()}.
  1660. * @stable ICU 65
  1661. */
  1662. static MeasureUnit getThermUs();
  1663. /**
  1664. * Returns by pointer, unit of force: kilowatt-hour-per-100-kilometer.
  1665. * Caller owns returned value and must free it.
  1666. * Also see {@link #getKilowattHourPer100Kilometer()}.
  1667. * @param status ICU error code.
  1668. * @stable ICU 70
  1669. */
  1670. static MeasureUnit *createKilowattHourPer100Kilometer(UErrorCode &status);
  1671. /**
  1672. * Returns by value, unit of force: kilowatt-hour-per-100-kilometer.
  1673. * Also see {@link #createKilowattHourPer100Kilometer()}.
  1674. * @stable ICU 70
  1675. */
  1676. static MeasureUnit getKilowattHourPer100Kilometer();
  1677. /**
  1678. * Returns by pointer, unit of force: newton.
  1679. * Caller owns returned value and must free it.
  1680. * Also see {@link #getNewton()}.
  1681. * @param status ICU error code.
  1682. * @stable ICU 64
  1683. */
  1684. static MeasureUnit *createNewton(UErrorCode &status);
  1685. /**
  1686. * Returns by value, unit of force: newton.
  1687. * Also see {@link #createNewton()}.
  1688. * @stable ICU 64
  1689. */
  1690. static MeasureUnit getNewton();
  1691. /**
  1692. * Returns by pointer, unit of force: pound-force.
  1693. * Caller owns returned value and must free it.
  1694. * Also see {@link #getPoundForce()}.
  1695. * @param status ICU error code.
  1696. * @stable ICU 64
  1697. */
  1698. static MeasureUnit *createPoundForce(UErrorCode &status);
  1699. /**
  1700. * Returns by value, unit of force: pound-force.
  1701. * Also see {@link #createPoundForce()}.
  1702. * @stable ICU 64
  1703. */
  1704. static MeasureUnit getPoundForce();
  1705. /**
  1706. * Returns by pointer, unit of frequency: gigahertz.
  1707. * Caller owns returned value and must free it.
  1708. * Also see {@link #getGigahertz()}.
  1709. * @param status ICU error code.
  1710. * @stable ICU 54
  1711. */
  1712. static MeasureUnit *createGigahertz(UErrorCode &status);
  1713. /**
  1714. * Returns by value, unit of frequency: gigahertz.
  1715. * Also see {@link #createGigahertz()}.
  1716. * @stable ICU 64
  1717. */
  1718. static MeasureUnit getGigahertz();
  1719. /**
  1720. * Returns by pointer, unit of frequency: hertz.
  1721. * Caller owns returned value and must free it.
  1722. * Also see {@link #getHertz()}.
  1723. * @param status ICU error code.
  1724. * @stable ICU 54
  1725. */
  1726. static MeasureUnit *createHertz(UErrorCode &status);
  1727. /**
  1728. * Returns by value, unit of frequency: hertz.
  1729. * Also see {@link #createHertz()}.
  1730. * @stable ICU 64
  1731. */
  1732. static MeasureUnit getHertz();
  1733. /**
  1734. * Returns by pointer, unit of frequency: kilohertz.
  1735. * Caller owns returned value and must free it.
  1736. * Also see {@link #getKilohertz()}.
  1737. * @param status ICU error code.
  1738. * @stable ICU 54
  1739. */
  1740. static MeasureUnit *createKilohertz(UErrorCode &status);
  1741. /**
  1742. * Returns by value, unit of frequency: kilohertz.
  1743. * Also see {@link #createKilohertz()}.
  1744. * @stable ICU 64
  1745. */
  1746. static MeasureUnit getKilohertz();
  1747. /**
  1748. * Returns by pointer, unit of frequency: megahertz.
  1749. * Caller owns returned value and must free it.
  1750. * Also see {@link #getMegahertz()}.
  1751. * @param status ICU error code.
  1752. * @stable ICU 54
  1753. */
  1754. static MeasureUnit *createMegahertz(UErrorCode &status);
  1755. /**
  1756. * Returns by value, unit of frequency: megahertz.
  1757. * Also see {@link #createMegahertz()}.
  1758. * @stable ICU 64
  1759. */
  1760. static MeasureUnit getMegahertz();
  1761. /**
  1762. * Returns by pointer, unit of graphics: dot.
  1763. * Caller owns returned value and must free it.
  1764. * Also see {@link #getDot()}.
  1765. * @param status ICU error code.
  1766. * @stable ICU 68
  1767. */
  1768. static MeasureUnit *createDot(UErrorCode &status);
  1769. /**
  1770. * Returns by value, unit of graphics: dot.
  1771. * Also see {@link #createDot()}.
  1772. * @stable ICU 68
  1773. */
  1774. static MeasureUnit getDot();
  1775. /**
  1776. * Returns by pointer, unit of graphics: dot-per-centimeter.
  1777. * Caller owns returned value and must free it.
  1778. * Also see {@link #getDotPerCentimeter()}.
  1779. * @param status ICU error code.
  1780. * @stable ICU 65
  1781. */
  1782. static MeasureUnit *createDotPerCentimeter(UErrorCode &status);
  1783. /**
  1784. * Returns by value, unit of graphics: dot-per-centimeter.
  1785. * Also see {@link #createDotPerCentimeter()}.
  1786. * @stable ICU 65
  1787. */
  1788. static MeasureUnit getDotPerCentimeter();
  1789. /**
  1790. * Returns by pointer, unit of graphics: dot-per-inch.
  1791. * Caller owns returned value and must free it.
  1792. * Also see {@link #getDotPerInch()}.
  1793. * @param status ICU error code.
  1794. * @stable ICU 65
  1795. */
  1796. static MeasureUnit *createDotPerInch(UErrorCode &status);
  1797. /**
  1798. * Returns by value, unit of graphics: dot-per-inch.
  1799. * Also see {@link #createDotPerInch()}.
  1800. * @stable ICU 65
  1801. */
  1802. static MeasureUnit getDotPerInch();
  1803. /**
  1804. * Returns by pointer, unit of graphics: em.
  1805. * Caller owns returned value and must free it.
  1806. * Also see {@link #getEm()}.
  1807. * @param status ICU error code.
  1808. * @stable ICU 65
  1809. */
  1810. static MeasureUnit *createEm(UErrorCode &status);
  1811. /**
  1812. * Returns by value, unit of graphics: em.
  1813. * Also see {@link #createEm()}.
  1814. * @stable ICU 65
  1815. */
  1816. static MeasureUnit getEm();
  1817. /**
  1818. * Returns by pointer, unit of graphics: megapixel.
  1819. * Caller owns returned value and must free it.
  1820. * Also see {@link #getMegapixel()}.
  1821. * @param status ICU error code.
  1822. * @stable ICU 65
  1823. */
  1824. static MeasureUnit *createMegapixel(UErrorCode &status);
  1825. /**
  1826. * Returns by value, unit of graphics: megapixel.
  1827. * Also see {@link #createMegapixel()}.
  1828. * @stable ICU 65
  1829. */
  1830. static MeasureUnit getMegapixel();
  1831. /**
  1832. * Returns by pointer, unit of graphics: pixel.
  1833. * Caller owns returned value and must free it.
  1834. * Also see {@link #getPixel()}.
  1835. * @param status ICU error code.
  1836. * @stable ICU 65
  1837. */
  1838. static MeasureUnit *createPixel(UErrorCode &status);
  1839. /**
  1840. * Returns by value, unit of graphics: pixel.
  1841. * Also see {@link #createPixel()}.
  1842. * @stable ICU 65
  1843. */
  1844. static MeasureUnit getPixel();
  1845. /**
  1846. * Returns by pointer, unit of graphics: pixel-per-centimeter.
  1847. * Caller owns returned value and must free it.
  1848. * Also see {@link #getPixelPerCentimeter()}.
  1849. * @param status ICU error code.
  1850. * @stable ICU 65
  1851. */
  1852. static MeasureUnit *createPixelPerCentimeter(UErrorCode &status);
  1853. /**
  1854. * Returns by value, unit of graphics: pixel-per-centimeter.
  1855. * Also see {@link #createPixelPerCentimeter()}.
  1856. * @stable ICU 65
  1857. */
  1858. static MeasureUnit getPixelPerCentimeter();
  1859. /**
  1860. * Returns by pointer, unit of graphics: pixel-per-inch.
  1861. * Caller owns returned value and must free it.
  1862. * Also see {@link #getPixelPerInch()}.
  1863. * @param status ICU error code.
  1864. * @stable ICU 65
  1865. */
  1866. static MeasureUnit *createPixelPerInch(UErrorCode &status);
  1867. /**
  1868. * Returns by value, unit of graphics: pixel-per-inch.
  1869. * Also see {@link #createPixelPerInch()}.
  1870. * @stable ICU 65
  1871. */
  1872. static MeasureUnit getPixelPerInch();
  1873. /**
  1874. * Returns by pointer, unit of length: astronomical-unit.
  1875. * Caller owns returned value and must free it.
  1876. * Also see {@link #getAstronomicalUnit()}.
  1877. * @param status ICU error code.
  1878. * @stable ICU 54
  1879. */
  1880. static MeasureUnit *createAstronomicalUnit(UErrorCode &status);
  1881. /**
  1882. * Returns by value, unit of length: astronomical-unit.
  1883. * Also see {@link #createAstronomicalUnit()}.
  1884. * @stable ICU 64
  1885. */
  1886. static MeasureUnit getAstronomicalUnit();
  1887. /**
  1888. * Returns by pointer, unit of length: centimeter.
  1889. * Caller owns returned value and must free it.
  1890. * Also see {@link #getCentimeter()}.
  1891. * @param status ICU error code.
  1892. * @stable ICU 53
  1893. */
  1894. static MeasureUnit *createCentimeter(UErrorCode &status);
  1895. /**
  1896. * Returns by value, unit of length: centimeter.
  1897. * Also see {@link #createCentimeter()}.
  1898. * @stable ICU 64
  1899. */
  1900. static MeasureUnit getCentimeter();
  1901. /**
  1902. * Returns by pointer, unit of length: decimeter.
  1903. * Caller owns returned value and must free it.
  1904. * Also see {@link #getDecimeter()}.
  1905. * @param status ICU error code.
  1906. * @stable ICU 54
  1907. */
  1908. static MeasureUnit *createDecimeter(UErrorCode &status);
  1909. /**
  1910. * Returns by value, unit of length: decimeter.
  1911. * Also see {@link #createDecimeter()}.
  1912. * @stable ICU 64
  1913. */
  1914. static MeasureUnit getDecimeter();
  1915. /**
  1916. * Returns by pointer, unit of length: earth-radius.
  1917. * Caller owns returned value and must free it.
  1918. * Also see {@link #getEarthRadius()}.
  1919. * @param status ICU error code.
  1920. * @stable ICU 68
  1921. */
  1922. static MeasureUnit *createEarthRadius(UErrorCode &status);
  1923. /**
  1924. * Returns by value, unit of length: earth-radius.
  1925. * Also see {@link #createEarthRadius()}.
  1926. * @stable ICU 68
  1927. */
  1928. static MeasureUnit getEarthRadius();
  1929. /**
  1930. * Returns by pointer, unit of length: fathom.
  1931. * Caller owns returned value and must free it.
  1932. * Also see {@link #getFathom()}.
  1933. * @param status ICU error code.
  1934. * @stable ICU 54
  1935. */
  1936. static MeasureUnit *createFathom(UErrorCode &status);
  1937. /**
  1938. * Returns by value, unit of length: fathom.
  1939. * Also see {@link #createFathom()}.
  1940. * @stable ICU 64
  1941. */
  1942. static MeasureUnit getFathom();
  1943. /**
  1944. * Returns by pointer, unit of length: foot.
  1945. * Caller owns returned value and must free it.
  1946. * Also see {@link #getFoot()}.
  1947. * @param status ICU error code.
  1948. * @stable ICU 53
  1949. */
  1950. static MeasureUnit *createFoot(UErrorCode &status);
  1951. /**
  1952. * Returns by value, unit of length: foot.
  1953. * Also see {@link #createFoot()}.
  1954. * @stable ICU 64
  1955. */
  1956. static MeasureUnit getFoot();
  1957. /**
  1958. * Returns by pointer, unit of length: furlong.
  1959. * Caller owns returned value and must free it.
  1960. * Also see {@link #getFurlong()}.
  1961. * @param status ICU error code.
  1962. * @stable ICU 54
  1963. */
  1964. static MeasureUnit *createFurlong(UErrorCode &status);
  1965. /**
  1966. * Returns by value, unit of length: furlong.
  1967. * Also see {@link #createFurlong()}.
  1968. * @stable ICU 64
  1969. */
  1970. static MeasureUnit getFurlong();
  1971. /**
  1972. * Returns by pointer, unit of length: inch.
  1973. * Caller owns returned value and must free it.
  1974. * Also see {@link #getInch()}.
  1975. * @param status ICU error code.
  1976. * @stable ICU 53
  1977. */
  1978. static MeasureUnit *createInch(UErrorCode &status);
  1979. /**
  1980. * Returns by value, unit of length: inch.
  1981. * Also see {@link #createInch()}.
  1982. * @stable ICU 64
  1983. */
  1984. static MeasureUnit getInch();
  1985. /**
  1986. * Returns by pointer, unit of length: kilometer.
  1987. * Caller owns returned value and must free it.
  1988. * Also see {@link #getKilometer()}.
  1989. * @param status ICU error code.
  1990. * @stable ICU 53
  1991. */
  1992. static MeasureUnit *createKilometer(UErrorCode &status);
  1993. /**
  1994. * Returns by value, unit of length: kilometer.
  1995. * Also see {@link #createKilometer()}.
  1996. * @stable ICU 64
  1997. */
  1998. static MeasureUnit getKilometer();
  1999. /**
  2000. * Returns by pointer, unit of length: light-year.
  2001. * Caller owns returned value and must free it.
  2002. * Also see {@link #getLightYear()}.
  2003. * @param status ICU error code.
  2004. * @stable ICU 53
  2005. */
  2006. static MeasureUnit *createLightYear(UErrorCode &status);
  2007. /**
  2008. * Returns by value, unit of length: light-year.
  2009. * Also see {@link #createLightYear()}.
  2010. * @stable ICU 64
  2011. */
  2012. static MeasureUnit getLightYear();
  2013. /**
  2014. * Returns by pointer, unit of length: meter.
  2015. * Caller owns returned value and must free it.
  2016. * Also see {@link #getMeter()}.
  2017. * @param status ICU error code.
  2018. * @stable ICU 53
  2019. */
  2020. static MeasureUnit *createMeter(UErrorCode &status);
  2021. /**
  2022. * Returns by value, unit of length: meter.
  2023. * Also see {@link #createMeter()}.
  2024. * @stable ICU 64
  2025. */
  2026. static MeasureUnit getMeter();
  2027. /**
  2028. * Returns by pointer, unit of length: micrometer.
  2029. * Caller owns returned value and must free it.
  2030. * Also see {@link #getMicrometer()}.
  2031. * @param status ICU error code.
  2032. * @stable ICU 54
  2033. */
  2034. static MeasureUnit *createMicrometer(UErrorCode &status);
  2035. /**
  2036. * Returns by value, unit of length: micrometer.
  2037. * Also see {@link #createMicrometer()}.
  2038. * @stable ICU 64
  2039. */
  2040. static MeasureUnit getMicrometer();
  2041. /**
  2042. * Returns by pointer, unit of length: mile.
  2043. * Caller owns returned value and must free it.
  2044. * Also see {@link #getMile()}.
  2045. * @param status ICU error code.
  2046. * @stable ICU 53
  2047. */
  2048. static MeasureUnit *createMile(UErrorCode &status);
  2049. /**
  2050. * Returns by value, unit of length: mile.
  2051. * Also see {@link #createMile()}.
  2052. * @stable ICU 64
  2053. */
  2054. static MeasureUnit getMile();
  2055. /**
  2056. * Returns by pointer, unit of length: mile-scandinavian.
  2057. * Caller owns returned value and must free it.
  2058. * Also see {@link #getMileScandinavian()}.
  2059. * @param status ICU error code.
  2060. * @stable ICU 56
  2061. */
  2062. static MeasureUnit *createMileScandinavian(UErrorCode &status);
  2063. /**
  2064. * Returns by value, unit of length: mile-scandinavian.
  2065. * Also see {@link #createMileScandinavian()}.
  2066. * @stable ICU 64
  2067. */
  2068. static MeasureUnit getMileScandinavian();
  2069. /**
  2070. * Returns by pointer, unit of length: millimeter.
  2071. * Caller owns returned value and must free it.
  2072. * Also see {@link #getMillimeter()}.
  2073. * @param status ICU error code.
  2074. * @stable ICU 53
  2075. */
  2076. static MeasureUnit *createMillimeter(UErrorCode &status);
  2077. /**
  2078. * Returns by value, unit of length: millimeter.
  2079. * Also see {@link #createMillimeter()}.
  2080. * @stable ICU 64
  2081. */
  2082. static MeasureUnit getMillimeter();
  2083. /**
  2084. * Returns by pointer, unit of length: nanometer.
  2085. * Caller owns returned value and must free it.
  2086. * Also see {@link #getNanometer()}.
  2087. * @param status ICU error code.
  2088. * @stable ICU 54
  2089. */
  2090. static MeasureUnit *createNanometer(UErrorCode &status);
  2091. /**
  2092. * Returns by value, unit of length: nanometer.
  2093. * Also see {@link #createNanometer()}.
  2094. * @stable ICU 64
  2095. */
  2096. static MeasureUnit getNanometer();
  2097. /**
  2098. * Returns by pointer, unit of length: nautical-mile.
  2099. * Caller owns returned value and must free it.
  2100. * Also see {@link #getNauticalMile()}.
  2101. * @param status ICU error code.
  2102. * @stable ICU 54
  2103. */
  2104. static MeasureUnit *createNauticalMile(UErrorCode &status);
  2105. /**
  2106. * Returns by value, unit of length: nautical-mile.
  2107. * Also see {@link #createNauticalMile()}.
  2108. * @stable ICU 64
  2109. */
  2110. static MeasureUnit getNauticalMile();
  2111. /**
  2112. * Returns by pointer, unit of length: parsec.
  2113. * Caller owns returned value and must free it.
  2114. * Also see {@link #getParsec()}.
  2115. * @param status ICU error code.
  2116. * @stable ICU 54
  2117. */
  2118. static MeasureUnit *createParsec(UErrorCode &status);
  2119. /**
  2120. * Returns by value, unit of length: parsec.
  2121. * Also see {@link #createParsec()}.
  2122. * @stable ICU 64
  2123. */
  2124. static MeasureUnit getParsec();
  2125. /**
  2126. * Returns by pointer, unit of length: picometer.
  2127. * Caller owns returned value and must free it.
  2128. * Also see {@link #getPicometer()}.
  2129. * @param status ICU error code.
  2130. * @stable ICU 53
  2131. */
  2132. static MeasureUnit *createPicometer(UErrorCode &status);
  2133. /**
  2134. * Returns by value, unit of length: picometer.
  2135. * Also see {@link #createPicometer()}.
  2136. * @stable ICU 64
  2137. */
  2138. static MeasureUnit getPicometer();
  2139. /**
  2140. * Returns by pointer, unit of length: point.
  2141. * Caller owns returned value and must free it.
  2142. * Also see {@link #getPoint()}.
  2143. * @param status ICU error code.
  2144. * @stable ICU 59
  2145. */
  2146. static MeasureUnit *createPoint(UErrorCode &status);
  2147. /**
  2148. * Returns by value, unit of length: point.
  2149. * Also see {@link #createPoint()}.
  2150. * @stable ICU 64
  2151. */
  2152. static MeasureUnit getPoint();
  2153. /**
  2154. * Returns by pointer, unit of length: solar-radius.
  2155. * Caller owns returned value and must free it.
  2156. * Also see {@link #getSolarRadius()}.
  2157. * @param status ICU error code.
  2158. * @stable ICU 64
  2159. */
  2160. static MeasureUnit *createSolarRadius(UErrorCode &status);
  2161. /**
  2162. * Returns by value, unit of length: solar-radius.
  2163. * Also see {@link #createSolarRadius()}.
  2164. * @stable ICU 64
  2165. */
  2166. static MeasureUnit getSolarRadius();
  2167. /**
  2168. * Returns by pointer, unit of length: yard.
  2169. * Caller owns returned value and must free it.
  2170. * Also see {@link #getYard()}.
  2171. * @param status ICU error code.
  2172. * @stable ICU 53
  2173. */
  2174. static MeasureUnit *createYard(UErrorCode &status);
  2175. /**
  2176. * Returns by value, unit of length: yard.
  2177. * Also see {@link #createYard()}.
  2178. * @stable ICU 64
  2179. */
  2180. static MeasureUnit getYard();
  2181. /**
  2182. * Returns by pointer, unit of light: candela.
  2183. * Caller owns returned value and must free it.
  2184. * Also see {@link #getCandela()}.
  2185. * @param status ICU error code.
  2186. * @stable ICU 68
  2187. */
  2188. static MeasureUnit *createCandela(UErrorCode &status);
  2189. /**
  2190. * Returns by value, unit of light: candela.
  2191. * Also see {@link #createCandela()}.
  2192. * @stable ICU 68
  2193. */
  2194. static MeasureUnit getCandela();
  2195. /**
  2196. * Returns by pointer, unit of light: lumen.
  2197. * Caller owns returned value and must free it.
  2198. * Also see {@link #getLumen()}.
  2199. * @param status ICU error code.
  2200. * @stable ICU 68
  2201. */
  2202. static MeasureUnit *createLumen(UErrorCode &status);
  2203. /**
  2204. * Returns by value, unit of light: lumen.
  2205. * Also see {@link #createLumen()}.
  2206. * @stable ICU 68
  2207. */
  2208. static MeasureUnit getLumen();
  2209. /**
  2210. * Returns by pointer, unit of light: lux.
  2211. * Caller owns returned value and must free it.
  2212. * Also see {@link #getLux()}.
  2213. * @param status ICU error code.
  2214. * @stable ICU 54
  2215. */
  2216. static MeasureUnit *createLux(UErrorCode &status);
  2217. /**
  2218. * Returns by value, unit of light: lux.
  2219. * Also see {@link #createLux()}.
  2220. * @stable ICU 64
  2221. */
  2222. static MeasureUnit getLux();
  2223. /**
  2224. * Returns by pointer, unit of light: solar-luminosity.
  2225. * Caller owns returned value and must free it.
  2226. * Also see {@link #getSolarLuminosity()}.
  2227. * @param status ICU error code.
  2228. * @stable ICU 64
  2229. */
  2230. static MeasureUnit *createSolarLuminosity(UErrorCode &status);
  2231. /**
  2232. * Returns by value, unit of light: solar-luminosity.
  2233. * Also see {@link #createSolarLuminosity()}.
  2234. * @stable ICU 64
  2235. */
  2236. static MeasureUnit getSolarLuminosity();
  2237. /**
  2238. * Returns by pointer, unit of mass: carat.
  2239. * Caller owns returned value and must free it.
  2240. * Also see {@link #getCarat()}.
  2241. * @param status ICU error code.
  2242. * @stable ICU 54
  2243. */
  2244. static MeasureUnit *createCarat(UErrorCode &status);
  2245. /**
  2246. * Returns by value, unit of mass: carat.
  2247. * Also see {@link #createCarat()}.
  2248. * @stable ICU 64
  2249. */
  2250. static MeasureUnit getCarat();
  2251. /**
  2252. * Returns by pointer, unit of mass: dalton.
  2253. * Caller owns returned value and must free it.
  2254. * Also see {@link #getDalton()}.
  2255. * @param status ICU error code.
  2256. * @stable ICU 64
  2257. */
  2258. static MeasureUnit *createDalton(UErrorCode &status);
  2259. /**
  2260. * Returns by value, unit of mass: dalton.
  2261. * Also see {@link #createDalton()}.
  2262. * @stable ICU 64
  2263. */
  2264. static MeasureUnit getDalton();
  2265. /**
  2266. * Returns by pointer, unit of mass: earth-mass.
  2267. * Caller owns returned value and must free it.
  2268. * Also see {@link #getEarthMass()}.
  2269. * @param status ICU error code.
  2270. * @stable ICU 64
  2271. */
  2272. static MeasureUnit *createEarthMass(UErrorCode &status);
  2273. /**
  2274. * Returns by value, unit of mass: earth-mass.
  2275. * Also see {@link #createEarthMass()}.
  2276. * @stable ICU 64
  2277. */
  2278. static MeasureUnit getEarthMass();
  2279. /**
  2280. * Returns by pointer, unit of mass: grain.
  2281. * Caller owns returned value and must free it.
  2282. * Also see {@link #getGrain()}.
  2283. * @param status ICU error code.
  2284. * @stable ICU 68
  2285. */
  2286. static MeasureUnit *createGrain(UErrorCode &status);
  2287. /**
  2288. * Returns by value, unit of mass: grain.
  2289. * Also see {@link #createGrain()}.
  2290. * @stable ICU 68
  2291. */
  2292. static MeasureUnit getGrain();
  2293. /**
  2294. * Returns by pointer, unit of mass: gram.
  2295. * Caller owns returned value and must free it.
  2296. * Also see {@link #getGram()}.
  2297. * @param status ICU error code.
  2298. * @stable ICU 53
  2299. */
  2300. static MeasureUnit *createGram(UErrorCode &status);
  2301. /**
  2302. * Returns by value, unit of mass: gram.
  2303. * Also see {@link #createGram()}.
  2304. * @stable ICU 64
  2305. */
  2306. static MeasureUnit getGram();
  2307. /**
  2308. * Returns by pointer, unit of mass: kilogram.
  2309. * Caller owns returned value and must free it.
  2310. * Also see {@link #getKilogram()}.
  2311. * @param status ICU error code.
  2312. * @stable ICU 53
  2313. */
  2314. static MeasureUnit *createKilogram(UErrorCode &status);
  2315. /**
  2316. * Returns by value, unit of mass: kilogram.
  2317. * Also see {@link #createKilogram()}.
  2318. * @stable ICU 64
  2319. */
  2320. static MeasureUnit getKilogram();
  2321. /**
  2322. * Returns by pointer, unit of mass: microgram.
  2323. * Caller owns returned value and must free it.
  2324. * Also see {@link #getMicrogram()}.
  2325. * @param status ICU error code.
  2326. * @stable ICU 54
  2327. */
  2328. static MeasureUnit *createMicrogram(UErrorCode &status);
  2329. /**
  2330. * Returns by value, unit of mass: microgram.
  2331. * Also see {@link #createMicrogram()}.
  2332. * @stable ICU 64
  2333. */
  2334. static MeasureUnit getMicrogram();
  2335. /**
  2336. * Returns by pointer, unit of mass: milligram.
  2337. * Caller owns returned value and must free it.
  2338. * Also see {@link #getMilligram()}.
  2339. * @param status ICU error code.
  2340. * @stable ICU 54
  2341. */
  2342. static MeasureUnit *createMilligram(UErrorCode &status);
  2343. /**
  2344. * Returns by value, unit of mass: milligram.
  2345. * Also see {@link #createMilligram()}.
  2346. * @stable ICU 64
  2347. */
  2348. static MeasureUnit getMilligram();
  2349. /**
  2350. * Returns by pointer, unit of mass: ounce.
  2351. * Caller owns returned value and must free it.
  2352. * Also see {@link #getOunce()}.
  2353. * @param status ICU error code.
  2354. * @stable ICU 53
  2355. */
  2356. static MeasureUnit *createOunce(UErrorCode &status);
  2357. /**
  2358. * Returns by value, unit of mass: ounce.
  2359. * Also see {@link #createOunce()}.
  2360. * @stable ICU 64
  2361. */
  2362. static MeasureUnit getOunce();
  2363. /**
  2364. * Returns by pointer, unit of mass: ounce-troy.
  2365. * Caller owns returned value and must free it.
  2366. * Also see {@link #getOunceTroy()}.
  2367. * @param status ICU error code.
  2368. * @stable ICU 54
  2369. */
  2370. static MeasureUnit *createOunceTroy(UErrorCode &status);
  2371. /**
  2372. * Returns by value, unit of mass: ounce-troy.
  2373. * Also see {@link #createOunceTroy()}.
  2374. * @stable ICU 64
  2375. */
  2376. static MeasureUnit getOunceTroy();
  2377. /**
  2378. * Returns by pointer, unit of mass: pound.
  2379. * Caller owns returned value and must free it.
  2380. * Also see {@link #getPound()}.
  2381. * @param status ICU error code.
  2382. * @stable ICU 53
  2383. */
  2384. static MeasureUnit *createPound(UErrorCode &status);
  2385. /**
  2386. * Returns by value, unit of mass: pound.
  2387. * Also see {@link #createPound()}.
  2388. * @stable ICU 64
  2389. */
  2390. static MeasureUnit getPound();
  2391. /**
  2392. * Returns by pointer, unit of mass: solar-mass.
  2393. * Caller owns returned value and must free it.
  2394. * Also see {@link #getSolarMass()}.
  2395. * @param status ICU error code.
  2396. * @stable ICU 64
  2397. */
  2398. static MeasureUnit *createSolarMass(UErrorCode &status);
  2399. /**
  2400. * Returns by value, unit of mass: solar-mass.
  2401. * Also see {@link #createSolarMass()}.
  2402. * @stable ICU 64
  2403. */
  2404. static MeasureUnit getSolarMass();
  2405. /**
  2406. * Returns by pointer, unit of mass: stone.
  2407. * Caller owns returned value and must free it.
  2408. * Also see {@link #getStone()}.
  2409. * @param status ICU error code.
  2410. * @stable ICU 54
  2411. */
  2412. static MeasureUnit *createStone(UErrorCode &status);
  2413. /**
  2414. * Returns by value, unit of mass: stone.
  2415. * Also see {@link #createStone()}.
  2416. * @stable ICU 64
  2417. */
  2418. static MeasureUnit getStone();
  2419. /**
  2420. * Returns by pointer, unit of mass: ton.
  2421. * Caller owns returned value and must free it.
  2422. * Also see {@link #getTon()}.
  2423. * @param status ICU error code.
  2424. * @stable ICU 54
  2425. */
  2426. static MeasureUnit *createTon(UErrorCode &status);
  2427. /**
  2428. * Returns by value, unit of mass: ton.
  2429. * Also see {@link #createTon()}.
  2430. * @stable ICU 64
  2431. */
  2432. static MeasureUnit getTon();
  2433. /**
  2434. * Returns by pointer, unit of mass: tonne.
  2435. * Caller owns returned value and must free it.
  2436. * Also see {@link #getTonne()}.
  2437. * @param status ICU error code.
  2438. * @stable ICU 72
  2439. */
  2440. static MeasureUnit *createTonne(UErrorCode &status);
  2441. /**
  2442. * Returns by value, unit of mass: tonne.
  2443. * Also see {@link #createTonne()}.
  2444. * @stable ICU 72
  2445. */
  2446. static MeasureUnit getTonne();
  2447. /**
  2448. * Returns by pointer, unit of mass: metric-ton
  2449. * (renamed to tonne in CLDR 42 / ICU 72).
  2450. * Caller owns returned value and must free it.
  2451. * Note: In ICU 74 this will be deprecated in favor of
  2452. * createTonne(), which is currently draft but will
  2453. * become stable in ICU 74, and which uses the preferred naming.
  2454. * Also see {@link #getMetricTon()} and {@link #createTonne()}.
  2455. * @param status ICU error code.
  2456. * @stable ICU 54
  2457. */
  2458. static MeasureUnit *createMetricTon(UErrorCode &status);
  2459. /**
  2460. * Returns by value, unit of mass: metric-ton
  2461. * (renamed to tonne in CLDR 42 / ICU 72).
  2462. * Note: In ICU 74 this will be deprecated in favor of
  2463. * getTonne(), which is currently draft but will
  2464. * become stable in ICU 74, and which uses the preferred naming.
  2465. * Also see {@link #createMetricTon()} and {@link #getTonne()}.
  2466. * @stable ICU 64
  2467. */
  2468. static MeasureUnit getMetricTon();
  2469. /**
  2470. * Returns by pointer, unit of power: gigawatt.
  2471. * Caller owns returned value and must free it.
  2472. * Also see {@link #getGigawatt()}.
  2473. * @param status ICU error code.
  2474. * @stable ICU 54
  2475. */
  2476. static MeasureUnit *createGigawatt(UErrorCode &status);
  2477. /**
  2478. * Returns by value, unit of power: gigawatt.
  2479. * Also see {@link #createGigawatt()}.
  2480. * @stable ICU 64
  2481. */
  2482. static MeasureUnit getGigawatt();
  2483. /**
  2484. * Returns by pointer, unit of power: horsepower.
  2485. * Caller owns returned value and must free it.
  2486. * Also see {@link #getHorsepower()}.
  2487. * @param status ICU error code.
  2488. * @stable ICU 53
  2489. */
  2490. static MeasureUnit *createHorsepower(UErrorCode &status);
  2491. /**
  2492. * Returns by value, unit of power: horsepower.
  2493. * Also see {@link #createHorsepower()}.
  2494. * @stable ICU 64
  2495. */
  2496. static MeasureUnit getHorsepower();
  2497. /**
  2498. * Returns by pointer, unit of power: kilowatt.
  2499. * Caller owns returned value and must free it.
  2500. * Also see {@link #getKilowatt()}.
  2501. * @param status ICU error code.
  2502. * @stable ICU 53
  2503. */
  2504. static MeasureUnit *createKilowatt(UErrorCode &status);
  2505. /**
  2506. * Returns by value, unit of power: kilowatt.
  2507. * Also see {@link #createKilowatt()}.
  2508. * @stable ICU 64
  2509. */
  2510. static MeasureUnit getKilowatt();
  2511. /**
  2512. * Returns by pointer, unit of power: megawatt.
  2513. * Caller owns returned value and must free it.
  2514. * Also see {@link #getMegawatt()}.
  2515. * @param status ICU error code.
  2516. * @stable ICU 54
  2517. */
  2518. static MeasureUnit *createMegawatt(UErrorCode &status);
  2519. /**
  2520. * Returns by value, unit of power: megawatt.
  2521. * Also see {@link #createMegawatt()}.
  2522. * @stable ICU 64
  2523. */
  2524. static MeasureUnit getMegawatt();
  2525. /**
  2526. * Returns by pointer, unit of power: milliwatt.
  2527. * Caller owns returned value and must free it.
  2528. * Also see {@link #getMilliwatt()}.
  2529. * @param status ICU error code.
  2530. * @stable ICU 54
  2531. */
  2532. static MeasureUnit *createMilliwatt(UErrorCode &status);
  2533. /**
  2534. * Returns by value, unit of power: milliwatt.
  2535. * Also see {@link #createMilliwatt()}.
  2536. * @stable ICU 64
  2537. */
  2538. static MeasureUnit getMilliwatt();
  2539. /**
  2540. * Returns by pointer, unit of power: watt.
  2541. * Caller owns returned value and must free it.
  2542. * Also see {@link #getWatt()}.
  2543. * @param status ICU error code.
  2544. * @stable ICU 53
  2545. */
  2546. static MeasureUnit *createWatt(UErrorCode &status);
  2547. /**
  2548. * Returns by value, unit of power: watt.
  2549. * Also see {@link #createWatt()}.
  2550. * @stable ICU 64
  2551. */
  2552. static MeasureUnit getWatt();
  2553. /**
  2554. * Returns by pointer, unit of pressure: atmosphere.
  2555. * Caller owns returned value and must free it.
  2556. * Also see {@link #getAtmosphere()}.
  2557. * @param status ICU error code.
  2558. * @stable ICU 63
  2559. */
  2560. static MeasureUnit *createAtmosphere(UErrorCode &status);
  2561. /**
  2562. * Returns by value, unit of pressure: atmosphere.
  2563. * Also see {@link #createAtmosphere()}.
  2564. * @stable ICU 64
  2565. */
  2566. static MeasureUnit getAtmosphere();
  2567. /**
  2568. * Returns by pointer, unit of pressure: bar.
  2569. * Caller owns returned value and must free it.
  2570. * Also see {@link #getBar()}.
  2571. * @param status ICU error code.
  2572. * @stable ICU 65
  2573. */
  2574. static MeasureUnit *createBar(UErrorCode &status);
  2575. /**
  2576. * Returns by value, unit of pressure: bar.
  2577. * Also see {@link #createBar()}.
  2578. * @stable ICU 65
  2579. */
  2580. static MeasureUnit getBar();
  2581. /**
  2582. * Returns by pointer, unit of pressure: gasoline-energy-density.
  2583. * Caller owns returned value and must free it.
  2584. * Also see {@link #getGasolineEnergyDensity()}.
  2585. * @param status ICU error code.
  2586. * @stable ICU 74
  2587. */
  2588. static MeasureUnit *createGasolineEnergyDensity(UErrorCode &status);
  2589. /**
  2590. * Returns by value, unit of pressure: gasoline-energy-density.
  2591. * Also see {@link #createGasolineEnergyDensity()}.
  2592. * @stable ICU 74
  2593. */
  2594. static MeasureUnit getGasolineEnergyDensity();
  2595. /**
  2596. * Returns by pointer, unit of pressure: hectopascal.
  2597. * Caller owns returned value and must free it.
  2598. * Also see {@link #getHectopascal()}.
  2599. * @param status ICU error code.
  2600. * @stable ICU 53
  2601. */
  2602. static MeasureUnit *createHectopascal(UErrorCode &status);
  2603. /**
  2604. * Returns by value, unit of pressure: hectopascal.
  2605. * Also see {@link #createHectopascal()}.
  2606. * @stable ICU 64
  2607. */
  2608. static MeasureUnit getHectopascal();
  2609. /**
  2610. * Returns by pointer, unit of pressure: inch-ofhg.
  2611. * Caller owns returned value and must free it.
  2612. * Also see {@link #getInchHg()}.
  2613. * @param status ICU error code.
  2614. * @stable ICU 53
  2615. */
  2616. static MeasureUnit *createInchHg(UErrorCode &status);
  2617. /**
  2618. * Returns by value, unit of pressure: inch-ofhg.
  2619. * Also see {@link #createInchHg()}.
  2620. * @stable ICU 64
  2621. */
  2622. static MeasureUnit getInchHg();
  2623. /**
  2624. * Returns by pointer, unit of pressure: kilopascal.
  2625. * Caller owns returned value and must free it.
  2626. * Also see {@link #getKilopascal()}.
  2627. * @param status ICU error code.
  2628. * @stable ICU 64
  2629. */
  2630. static MeasureUnit *createKilopascal(UErrorCode &status);
  2631. /**
  2632. * Returns by value, unit of pressure: kilopascal.
  2633. * Also see {@link #createKilopascal()}.
  2634. * @stable ICU 64
  2635. */
  2636. static MeasureUnit getKilopascal();
  2637. /**
  2638. * Returns by pointer, unit of pressure: megapascal.
  2639. * Caller owns returned value and must free it.
  2640. * Also see {@link #getMegapascal()}.
  2641. * @param status ICU error code.
  2642. * @stable ICU 64
  2643. */
  2644. static MeasureUnit *createMegapascal(UErrorCode &status);
  2645. /**
  2646. * Returns by value, unit of pressure: megapascal.
  2647. * Also see {@link #createMegapascal()}.
  2648. * @stable ICU 64
  2649. */
  2650. static MeasureUnit getMegapascal();
  2651. /**
  2652. * Returns by pointer, unit of pressure: millibar.
  2653. * Caller owns returned value and must free it.
  2654. * Also see {@link #getMillibar()}.
  2655. * @param status ICU error code.
  2656. * @stable ICU 53
  2657. */
  2658. static MeasureUnit *createMillibar(UErrorCode &status);
  2659. /**
  2660. * Returns by value, unit of pressure: millibar.
  2661. * Also see {@link #createMillibar()}.
  2662. * @stable ICU 64
  2663. */
  2664. static MeasureUnit getMillibar();
  2665. /**
  2666. * Returns by pointer, unit of pressure: millimeter-ofhg.
  2667. * Caller owns returned value and must free it.
  2668. * Also see {@link #getMillimeterOfMercury()}.
  2669. * @param status ICU error code.
  2670. * @stable ICU 54
  2671. */
  2672. static MeasureUnit *createMillimeterOfMercury(UErrorCode &status);
  2673. /**
  2674. * Returns by value, unit of pressure: millimeter-ofhg.
  2675. * Also see {@link #createMillimeterOfMercury()}.
  2676. * @stable ICU 64
  2677. */
  2678. static MeasureUnit getMillimeterOfMercury();
  2679. /**
  2680. * Returns by pointer, unit of pressure: pascal.
  2681. * Caller owns returned value and must free it.
  2682. * Also see {@link #getPascal()}.
  2683. * @param status ICU error code.
  2684. * @stable ICU 65
  2685. */
  2686. static MeasureUnit *createPascal(UErrorCode &status);
  2687. /**
  2688. * Returns by value, unit of pressure: pascal.
  2689. * Also see {@link #createPascal()}.
  2690. * @stable ICU 65
  2691. */
  2692. static MeasureUnit getPascal();
  2693. /**
  2694. * Returns by pointer, unit of pressure: pound-force-per-square-inch.
  2695. * Caller owns returned value and must free it.
  2696. * Also see {@link #getPoundPerSquareInch()}.
  2697. * @param status ICU error code.
  2698. * @stable ICU 54
  2699. */
  2700. static MeasureUnit *createPoundPerSquareInch(UErrorCode &status);
  2701. /**
  2702. * Returns by value, unit of pressure: pound-force-per-square-inch.
  2703. * Also see {@link #createPoundPerSquareInch()}.
  2704. * @stable ICU 64
  2705. */
  2706. static MeasureUnit getPoundPerSquareInch();
  2707. /**
  2708. * Returns by pointer, unit of speed: beaufort.
  2709. * Caller owns returned value and must free it.
  2710. * Also see {@link #getBeaufort()}.
  2711. * @param status ICU error code.
  2712. * @stable ICU 73
  2713. */
  2714. static MeasureUnit *createBeaufort(UErrorCode &status);
  2715. /**
  2716. * Returns by value, unit of speed: beaufort.
  2717. * Also see {@link #createBeaufort()}.
  2718. * @stable ICU 73
  2719. */
  2720. static MeasureUnit getBeaufort();
  2721. /**
  2722. * Returns by pointer, unit of speed: kilometer-per-hour.
  2723. * Caller owns returned value and must free it.
  2724. * Also see {@link #getKilometerPerHour()}.
  2725. * @param status ICU error code.
  2726. * @stable ICU 53
  2727. */
  2728. static MeasureUnit *createKilometerPerHour(UErrorCode &status);
  2729. /**
  2730. * Returns by value, unit of speed: kilometer-per-hour.
  2731. * Also see {@link #createKilometerPerHour()}.
  2732. * @stable ICU 64
  2733. */
  2734. static MeasureUnit getKilometerPerHour();
  2735. /**
  2736. * Returns by pointer, unit of speed: knot.
  2737. * Caller owns returned value and must free it.
  2738. * Also see {@link #getKnot()}.
  2739. * @param status ICU error code.
  2740. * @stable ICU 56
  2741. */
  2742. static MeasureUnit *createKnot(UErrorCode &status);
  2743. /**
  2744. * Returns by value, unit of speed: knot.
  2745. * Also see {@link #createKnot()}.
  2746. * @stable ICU 64
  2747. */
  2748. static MeasureUnit getKnot();
  2749. #ifndef U_HIDE_DRAFT_API
  2750. /**
  2751. * Returns by pointer, unit of speed: light-speed.
  2752. * Caller owns returned value and must free it.
  2753. * Also see {@link #getLightSpeed()}.
  2754. * @param status ICU error code.
  2755. * @draft ICU 76
  2756. */
  2757. static MeasureUnit *createLightSpeed(UErrorCode &status);
  2758. /**
  2759. * Returns by value, unit of speed: light-speed.
  2760. * Also see {@link #createLightSpeed()}.
  2761. * @draft ICU 76
  2762. */
  2763. static MeasureUnit getLightSpeed();
  2764. #endif /* U_HIDE_DRAFT_API */
  2765. /**
  2766. * Returns by pointer, unit of speed: meter-per-second.
  2767. * Caller owns returned value and must free it.
  2768. * Also see {@link #getMeterPerSecond()}.
  2769. * @param status ICU error code.
  2770. * @stable ICU 53
  2771. */
  2772. static MeasureUnit *createMeterPerSecond(UErrorCode &status);
  2773. /**
  2774. * Returns by value, unit of speed: meter-per-second.
  2775. * Also see {@link #createMeterPerSecond()}.
  2776. * @stable ICU 64
  2777. */
  2778. static MeasureUnit getMeterPerSecond();
  2779. /**
  2780. * Returns by pointer, unit of speed: mile-per-hour.
  2781. * Caller owns returned value and must free it.
  2782. * Also see {@link #getMilePerHour()}.
  2783. * @param status ICU error code.
  2784. * @stable ICU 53
  2785. */
  2786. static MeasureUnit *createMilePerHour(UErrorCode &status);
  2787. /**
  2788. * Returns by value, unit of speed: mile-per-hour.
  2789. * Also see {@link #createMilePerHour()}.
  2790. * @stable ICU 64
  2791. */
  2792. static MeasureUnit getMilePerHour();
  2793. /**
  2794. * Returns by pointer, unit of temperature: celsius.
  2795. * Caller owns returned value and must free it.
  2796. * Also see {@link #getCelsius()}.
  2797. * @param status ICU error code.
  2798. * @stable ICU 53
  2799. */
  2800. static MeasureUnit *createCelsius(UErrorCode &status);
  2801. /**
  2802. * Returns by value, unit of temperature: celsius.
  2803. * Also see {@link #createCelsius()}.
  2804. * @stable ICU 64
  2805. */
  2806. static MeasureUnit getCelsius();
  2807. /**
  2808. * Returns by pointer, unit of temperature: fahrenheit.
  2809. * Caller owns returned value and must free it.
  2810. * Also see {@link #getFahrenheit()}.
  2811. * @param status ICU error code.
  2812. * @stable ICU 53
  2813. */
  2814. static MeasureUnit *createFahrenheit(UErrorCode &status);
  2815. /**
  2816. * Returns by value, unit of temperature: fahrenheit.
  2817. * Also see {@link #createFahrenheit()}.
  2818. * @stable ICU 64
  2819. */
  2820. static MeasureUnit getFahrenheit();
  2821. /**
  2822. * Returns by pointer, unit of temperature: generic.
  2823. * Caller owns returned value and must free it.
  2824. * Also see {@link #getGenericTemperature()}.
  2825. * @param status ICU error code.
  2826. * @stable ICU 56
  2827. */
  2828. static MeasureUnit *createGenericTemperature(UErrorCode &status);
  2829. /**
  2830. * Returns by value, unit of temperature: generic.
  2831. * Also see {@link #createGenericTemperature()}.
  2832. * @stable ICU 64
  2833. */
  2834. static MeasureUnit getGenericTemperature();
  2835. /**
  2836. * Returns by pointer, unit of temperature: kelvin.
  2837. * Caller owns returned value and must free it.
  2838. * Also see {@link #getKelvin()}.
  2839. * @param status ICU error code.
  2840. * @stable ICU 54
  2841. */
  2842. static MeasureUnit *createKelvin(UErrorCode &status);
  2843. /**
  2844. * Returns by value, unit of temperature: kelvin.
  2845. * Also see {@link #createKelvin()}.
  2846. * @stable ICU 64
  2847. */
  2848. static MeasureUnit getKelvin();
  2849. /**
  2850. * Returns by pointer, unit of torque: newton-meter.
  2851. * Caller owns returned value and must free it.
  2852. * Also see {@link #getNewtonMeter()}.
  2853. * @param status ICU error code.
  2854. * @stable ICU 64
  2855. */
  2856. static MeasureUnit *createNewtonMeter(UErrorCode &status);
  2857. /**
  2858. * Returns by value, unit of torque: newton-meter.
  2859. * Also see {@link #createNewtonMeter()}.
  2860. * @stable ICU 64
  2861. */
  2862. static MeasureUnit getNewtonMeter();
  2863. /**
  2864. * Returns by pointer, unit of torque: pound-force-foot.
  2865. * Caller owns returned value and must free it.
  2866. * Also see {@link #getPoundFoot()}.
  2867. * @param status ICU error code.
  2868. * @stable ICU 64
  2869. */
  2870. static MeasureUnit *createPoundFoot(UErrorCode &status);
  2871. /**
  2872. * Returns by value, unit of torque: pound-force-foot.
  2873. * Also see {@link #createPoundFoot()}.
  2874. * @stable ICU 64
  2875. */
  2876. static MeasureUnit getPoundFoot();
  2877. /**
  2878. * Returns by pointer, unit of volume: acre-foot.
  2879. * Caller owns returned value and must free it.
  2880. * Also see {@link #getAcreFoot()}.
  2881. * @param status ICU error code.
  2882. * @stable ICU 54
  2883. */
  2884. static MeasureUnit *createAcreFoot(UErrorCode &status);
  2885. /**
  2886. * Returns by value, unit of volume: acre-foot.
  2887. * Also see {@link #createAcreFoot()}.
  2888. * @stable ICU 64
  2889. */
  2890. static MeasureUnit getAcreFoot();
  2891. /**
  2892. * Returns by pointer, unit of volume: barrel.
  2893. * Caller owns returned value and must free it.
  2894. * Also see {@link #getBarrel()}.
  2895. * @param status ICU error code.
  2896. * @stable ICU 64
  2897. */
  2898. static MeasureUnit *createBarrel(UErrorCode &status);
  2899. /**
  2900. * Returns by value, unit of volume: barrel.
  2901. * Also see {@link #createBarrel()}.
  2902. * @stable ICU 64
  2903. */
  2904. static MeasureUnit getBarrel();
  2905. /**
  2906. * Returns by pointer, unit of volume: bushel.
  2907. * Caller owns returned value and must free it.
  2908. * Also see {@link #getBushel()}.
  2909. * @param status ICU error code.
  2910. * @stable ICU 54
  2911. */
  2912. static MeasureUnit *createBushel(UErrorCode &status);
  2913. /**
  2914. * Returns by value, unit of volume: bushel.
  2915. * Also see {@link #createBushel()}.
  2916. * @stable ICU 64
  2917. */
  2918. static MeasureUnit getBushel();
  2919. /**
  2920. * Returns by pointer, unit of volume: centiliter.
  2921. * Caller owns returned value and must free it.
  2922. * Also see {@link #getCentiliter()}.
  2923. * @param status ICU error code.
  2924. * @stable ICU 54
  2925. */
  2926. static MeasureUnit *createCentiliter(UErrorCode &status);
  2927. /**
  2928. * Returns by value, unit of volume: centiliter.
  2929. * Also see {@link #createCentiliter()}.
  2930. * @stable ICU 64
  2931. */
  2932. static MeasureUnit getCentiliter();
  2933. /**
  2934. * Returns by pointer, unit of volume: cubic-centimeter.
  2935. * Caller owns returned value and must free it.
  2936. * Also see {@link #getCubicCentimeter()}.
  2937. * @param status ICU error code.
  2938. * @stable ICU 54
  2939. */
  2940. static MeasureUnit *createCubicCentimeter(UErrorCode &status);
  2941. /**
  2942. * Returns by value, unit of volume: cubic-centimeter.
  2943. * Also see {@link #createCubicCentimeter()}.
  2944. * @stable ICU 64
  2945. */
  2946. static MeasureUnit getCubicCentimeter();
  2947. /**
  2948. * Returns by pointer, unit of volume: cubic-foot.
  2949. * Caller owns returned value and must free it.
  2950. * Also see {@link #getCubicFoot()}.
  2951. * @param status ICU error code.
  2952. * @stable ICU 54
  2953. */
  2954. static MeasureUnit *createCubicFoot(UErrorCode &status);
  2955. /**
  2956. * Returns by value, unit of volume: cubic-foot.
  2957. * Also see {@link #createCubicFoot()}.
  2958. * @stable ICU 64
  2959. */
  2960. static MeasureUnit getCubicFoot();
  2961. /**
  2962. * Returns by pointer, unit of volume: cubic-inch.
  2963. * Caller owns returned value and must free it.
  2964. * Also see {@link #getCubicInch()}.
  2965. * @param status ICU error code.
  2966. * @stable ICU 54
  2967. */
  2968. static MeasureUnit *createCubicInch(UErrorCode &status);
  2969. /**
  2970. * Returns by value, unit of volume: cubic-inch.
  2971. * Also see {@link #createCubicInch()}.
  2972. * @stable ICU 64
  2973. */
  2974. static MeasureUnit getCubicInch();
  2975. /**
  2976. * Returns by pointer, unit of volume: cubic-kilometer.
  2977. * Caller owns returned value and must free it.
  2978. * Also see {@link #getCubicKilometer()}.
  2979. * @param status ICU error code.
  2980. * @stable ICU 53
  2981. */
  2982. static MeasureUnit *createCubicKilometer(UErrorCode &status);
  2983. /**
  2984. * Returns by value, unit of volume: cubic-kilometer.
  2985. * Also see {@link #createCubicKilometer()}.
  2986. * @stable ICU 64
  2987. */
  2988. static MeasureUnit getCubicKilometer();
  2989. /**
  2990. * Returns by pointer, unit of volume: cubic-meter.
  2991. * Caller owns returned value and must free it.
  2992. * Also see {@link #getCubicMeter()}.
  2993. * @param status ICU error code.
  2994. * @stable ICU 54
  2995. */
  2996. static MeasureUnit *createCubicMeter(UErrorCode &status);
  2997. /**
  2998. * Returns by value, unit of volume: cubic-meter.
  2999. * Also see {@link #createCubicMeter()}.
  3000. * @stable ICU 64
  3001. */
  3002. static MeasureUnit getCubicMeter();
  3003. /**
  3004. * Returns by pointer, unit of volume: cubic-mile.
  3005. * Caller owns returned value and must free it.
  3006. * Also see {@link #getCubicMile()}.
  3007. * @param status ICU error code.
  3008. * @stable ICU 53
  3009. */
  3010. static MeasureUnit *createCubicMile(UErrorCode &status);
  3011. /**
  3012. * Returns by value, unit of volume: cubic-mile.
  3013. * Also see {@link #createCubicMile()}.
  3014. * @stable ICU 64
  3015. */
  3016. static MeasureUnit getCubicMile();
  3017. /**
  3018. * Returns by pointer, unit of volume: cubic-yard.
  3019. * Caller owns returned value and must free it.
  3020. * Also see {@link #getCubicYard()}.
  3021. * @param status ICU error code.
  3022. * @stable ICU 54
  3023. */
  3024. static MeasureUnit *createCubicYard(UErrorCode &status);
  3025. /**
  3026. * Returns by value, unit of volume: cubic-yard.
  3027. * Also see {@link #createCubicYard()}.
  3028. * @stable ICU 64
  3029. */
  3030. static MeasureUnit getCubicYard();
  3031. /**
  3032. * Returns by pointer, unit of volume: cup.
  3033. * Caller owns returned value and must free it.
  3034. * Also see {@link #getCup()}.
  3035. * @param status ICU error code.
  3036. * @stable ICU 54
  3037. */
  3038. static MeasureUnit *createCup(UErrorCode &status);
  3039. /**
  3040. * Returns by value, unit of volume: cup.
  3041. * Also see {@link #createCup()}.
  3042. * @stable ICU 64
  3043. */
  3044. static MeasureUnit getCup();
  3045. /**
  3046. * Returns by pointer, unit of volume: cup-metric.
  3047. * Caller owns returned value and must free it.
  3048. * Also see {@link #getCupMetric()}.
  3049. * @param status ICU error code.
  3050. * @stable ICU 56
  3051. */
  3052. static MeasureUnit *createCupMetric(UErrorCode &status);
  3053. /**
  3054. * Returns by value, unit of volume: cup-metric.
  3055. * Also see {@link #createCupMetric()}.
  3056. * @stable ICU 64
  3057. */
  3058. static MeasureUnit getCupMetric();
  3059. /**
  3060. * Returns by pointer, unit of volume: deciliter.
  3061. * Caller owns returned value and must free it.
  3062. * Also see {@link #getDeciliter()}.
  3063. * @param status ICU error code.
  3064. * @stable ICU 54
  3065. */
  3066. static MeasureUnit *createDeciliter(UErrorCode &status);
  3067. /**
  3068. * Returns by value, unit of volume: deciliter.
  3069. * Also see {@link #createDeciliter()}.
  3070. * @stable ICU 64
  3071. */
  3072. static MeasureUnit getDeciliter();
  3073. /**
  3074. * Returns by pointer, unit of volume: dessert-spoon.
  3075. * Caller owns returned value and must free it.
  3076. * Also see {@link #getDessertSpoon()}.
  3077. * @param status ICU error code.
  3078. * @stable ICU 68
  3079. */
  3080. static MeasureUnit *createDessertSpoon(UErrorCode &status);
  3081. /**
  3082. * Returns by value, unit of volume: dessert-spoon.
  3083. * Also see {@link #createDessertSpoon()}.
  3084. * @stable ICU 68
  3085. */
  3086. static MeasureUnit getDessertSpoon();
  3087. /**
  3088. * Returns by pointer, unit of volume: dessert-spoon-imperial.
  3089. * Caller owns returned value and must free it.
  3090. * Also see {@link #getDessertSpoonImperial()}.
  3091. * @param status ICU error code.
  3092. * @stable ICU 68
  3093. */
  3094. static MeasureUnit *createDessertSpoonImperial(UErrorCode &status);
  3095. /**
  3096. * Returns by value, unit of volume: dessert-spoon-imperial.
  3097. * Also see {@link #createDessertSpoonImperial()}.
  3098. * @stable ICU 68
  3099. */
  3100. static MeasureUnit getDessertSpoonImperial();
  3101. /**
  3102. * Returns by pointer, unit of volume: dram.
  3103. * Caller owns returned value and must free it.
  3104. * Also see {@link #getDram()}.
  3105. * @param status ICU error code.
  3106. * @stable ICU 68
  3107. */
  3108. static MeasureUnit *createDram(UErrorCode &status);
  3109. /**
  3110. * Returns by value, unit of volume: dram.
  3111. * Also see {@link #createDram()}.
  3112. * @stable ICU 68
  3113. */
  3114. static MeasureUnit getDram();
  3115. /**
  3116. * Returns by pointer, unit of volume: drop.
  3117. * Caller owns returned value and must free it.
  3118. * Also see {@link #getDrop()}.
  3119. * @param status ICU error code.
  3120. * @stable ICU 68
  3121. */
  3122. static MeasureUnit *createDrop(UErrorCode &status);
  3123. /**
  3124. * Returns by value, unit of volume: drop.
  3125. * Also see {@link #createDrop()}.
  3126. * @stable ICU 68
  3127. */
  3128. static MeasureUnit getDrop();
  3129. /**
  3130. * Returns by pointer, unit of volume: fluid-ounce.
  3131. * Caller owns returned value and must free it.
  3132. * Also see {@link #getFluidOunce()}.
  3133. * @param status ICU error code.
  3134. * @stable ICU 54
  3135. */
  3136. static MeasureUnit *createFluidOunce(UErrorCode &status);
  3137. /**
  3138. * Returns by value, unit of volume: fluid-ounce.
  3139. * Also see {@link #createFluidOunce()}.
  3140. * @stable ICU 64
  3141. */
  3142. static MeasureUnit getFluidOunce();
  3143. /**
  3144. * Returns by pointer, unit of volume: fluid-ounce-imperial.
  3145. * Caller owns returned value and must free it.
  3146. * Also see {@link #getFluidOunceImperial()}.
  3147. * @param status ICU error code.
  3148. * @stable ICU 64
  3149. */
  3150. static MeasureUnit *createFluidOunceImperial(UErrorCode &status);
  3151. /**
  3152. * Returns by value, unit of volume: fluid-ounce-imperial.
  3153. * Also see {@link #createFluidOunceImperial()}.
  3154. * @stable ICU 64
  3155. */
  3156. static MeasureUnit getFluidOunceImperial();
  3157. /**
  3158. * Returns by pointer, unit of volume: gallon.
  3159. * Caller owns returned value and must free it.
  3160. * Also see {@link #getGallon()}.
  3161. * @param status ICU error code.
  3162. * @stable ICU 54
  3163. */
  3164. static MeasureUnit *createGallon(UErrorCode &status);
  3165. /**
  3166. * Returns by value, unit of volume: gallon.
  3167. * Also see {@link #createGallon()}.
  3168. * @stable ICU 64
  3169. */
  3170. static MeasureUnit getGallon();
  3171. /**
  3172. * Returns by pointer, unit of volume: gallon-imperial.
  3173. * Caller owns returned value and must free it.
  3174. * Also see {@link #getGallonImperial()}.
  3175. * @param status ICU error code.
  3176. * @stable ICU 57
  3177. */
  3178. static MeasureUnit *createGallonImperial(UErrorCode &status);
  3179. /**
  3180. * Returns by value, unit of volume: gallon-imperial.
  3181. * Also see {@link #createGallonImperial()}.
  3182. * @stable ICU 64
  3183. */
  3184. static MeasureUnit getGallonImperial();
  3185. /**
  3186. * Returns by pointer, unit of volume: hectoliter.
  3187. * Caller owns returned value and must free it.
  3188. * Also see {@link #getHectoliter()}.
  3189. * @param status ICU error code.
  3190. * @stable ICU 54
  3191. */
  3192. static MeasureUnit *createHectoliter(UErrorCode &status);
  3193. /**
  3194. * Returns by value, unit of volume: hectoliter.
  3195. * Also see {@link #createHectoliter()}.
  3196. * @stable ICU 64
  3197. */
  3198. static MeasureUnit getHectoliter();
  3199. /**
  3200. * Returns by pointer, unit of volume: jigger.
  3201. * Caller owns returned value and must free it.
  3202. * Also see {@link #getJigger()}.
  3203. * @param status ICU error code.
  3204. * @stable ICU 68
  3205. */
  3206. static MeasureUnit *createJigger(UErrorCode &status);
  3207. /**
  3208. * Returns by value, unit of volume: jigger.
  3209. * Also see {@link #createJigger()}.
  3210. * @stable ICU 68
  3211. */
  3212. static MeasureUnit getJigger();
  3213. /**
  3214. * Returns by pointer, unit of volume: liter.
  3215. * Caller owns returned value and must free it.
  3216. * Also see {@link #getLiter()}.
  3217. * @param status ICU error code.
  3218. * @stable ICU 53
  3219. */
  3220. static MeasureUnit *createLiter(UErrorCode &status);
  3221. /**
  3222. * Returns by value, unit of volume: liter.
  3223. * Also see {@link #createLiter()}.
  3224. * @stable ICU 64
  3225. */
  3226. static MeasureUnit getLiter();
  3227. /**
  3228. * Returns by pointer, unit of volume: megaliter.
  3229. * Caller owns returned value and must free it.
  3230. * Also see {@link #getMegaliter()}.
  3231. * @param status ICU error code.
  3232. * @stable ICU 54
  3233. */
  3234. static MeasureUnit *createMegaliter(UErrorCode &status);
  3235. /**
  3236. * Returns by value, unit of volume: megaliter.
  3237. * Also see {@link #createMegaliter()}.
  3238. * @stable ICU 64
  3239. */
  3240. static MeasureUnit getMegaliter();
  3241. /**
  3242. * Returns by pointer, unit of volume: milliliter.
  3243. * Caller owns returned value and must free it.
  3244. * Also see {@link #getMilliliter()}.
  3245. * @param status ICU error code.
  3246. * @stable ICU 54
  3247. */
  3248. static MeasureUnit *createMilliliter(UErrorCode &status);
  3249. /**
  3250. * Returns by value, unit of volume: milliliter.
  3251. * Also see {@link #createMilliliter()}.
  3252. * @stable ICU 64
  3253. */
  3254. static MeasureUnit getMilliliter();
  3255. /**
  3256. * Returns by pointer, unit of volume: pinch.
  3257. * Caller owns returned value and must free it.
  3258. * Also see {@link #getPinch()}.
  3259. * @param status ICU error code.
  3260. * @stable ICU 68
  3261. */
  3262. static MeasureUnit *createPinch(UErrorCode &status);
  3263. /**
  3264. * Returns by value, unit of volume: pinch.
  3265. * Also see {@link #createPinch()}.
  3266. * @stable ICU 68
  3267. */
  3268. static MeasureUnit getPinch();
  3269. /**
  3270. * Returns by pointer, unit of volume: pint.
  3271. * Caller owns returned value and must free it.
  3272. * Also see {@link #getPint()}.
  3273. * @param status ICU error code.
  3274. * @stable ICU 54
  3275. */
  3276. static MeasureUnit *createPint(UErrorCode &status);
  3277. /**
  3278. * Returns by value, unit of volume: pint.
  3279. * Also see {@link #createPint()}.
  3280. * @stable ICU 64
  3281. */
  3282. static MeasureUnit getPint();
  3283. /**
  3284. * Returns by pointer, unit of volume: pint-metric.
  3285. * Caller owns returned value and must free it.
  3286. * Also see {@link #getPintMetric()}.
  3287. * @param status ICU error code.
  3288. * @stable ICU 56
  3289. */
  3290. static MeasureUnit *createPintMetric(UErrorCode &status);
  3291. /**
  3292. * Returns by value, unit of volume: pint-metric.
  3293. * Also see {@link #createPintMetric()}.
  3294. * @stable ICU 64
  3295. */
  3296. static MeasureUnit getPintMetric();
  3297. /**
  3298. * Returns by pointer, unit of volume: quart.
  3299. * Caller owns returned value and must free it.
  3300. * Also see {@link #getQuart()}.
  3301. * @param status ICU error code.
  3302. * @stable ICU 54
  3303. */
  3304. static MeasureUnit *createQuart(UErrorCode &status);
  3305. /**
  3306. * Returns by value, unit of volume: quart.
  3307. * Also see {@link #createQuart()}.
  3308. * @stable ICU 64
  3309. */
  3310. static MeasureUnit getQuart();
  3311. /**
  3312. * Returns by pointer, unit of volume: quart-imperial.
  3313. * Caller owns returned value and must free it.
  3314. * Also see {@link #getQuartImperial()}.
  3315. * @param status ICU error code.
  3316. * @stable ICU 68
  3317. */
  3318. static MeasureUnit *createQuartImperial(UErrorCode &status);
  3319. /**
  3320. * Returns by value, unit of volume: quart-imperial.
  3321. * Also see {@link #createQuartImperial()}.
  3322. * @stable ICU 68
  3323. */
  3324. static MeasureUnit getQuartImperial();
  3325. /**
  3326. * Returns by pointer, unit of volume: tablespoon.
  3327. * Caller owns returned value and must free it.
  3328. * Also see {@link #getTablespoon()}.
  3329. * @param status ICU error code.
  3330. * @stable ICU 54
  3331. */
  3332. static MeasureUnit *createTablespoon(UErrorCode &status);
  3333. /**
  3334. * Returns by value, unit of volume: tablespoon.
  3335. * Also see {@link #createTablespoon()}.
  3336. * @stable ICU 64
  3337. */
  3338. static MeasureUnit getTablespoon();
  3339. /**
  3340. * Returns by pointer, unit of volume: teaspoon.
  3341. * Caller owns returned value and must free it.
  3342. * Also see {@link #getTeaspoon()}.
  3343. * @param status ICU error code.
  3344. * @stable ICU 54
  3345. */
  3346. static MeasureUnit *createTeaspoon(UErrorCode &status);
  3347. /**
  3348. * Returns by value, unit of volume: teaspoon.
  3349. * Also see {@link #createTeaspoon()}.
  3350. * @stable ICU 64
  3351. */
  3352. static MeasureUnit getTeaspoon();
  3353. // End generated createXXX methods
  3354. protected:
  3355. #ifndef U_HIDE_INTERNAL_API
  3356. /**
  3357. * For ICU use only.
  3358. * @internal
  3359. */
  3360. void initTime(const char *timeId);
  3361. /**
  3362. * For ICU use only.
  3363. * @internal
  3364. */
  3365. void initCurrency(StringPiece isoCurrency);
  3366. #endif /* U_HIDE_INTERNAL_API */
  3367. private:
  3368. // Used by new draft APIs in ICU 67. If non-null, fImpl is owned by the
  3369. // MeasureUnit.
  3370. MeasureUnitImpl* fImpl;
  3371. // An index into a static string list in measunit.cpp. If set to -1, fImpl
  3372. // is in use instead of fTypeId and fSubTypeId.
  3373. int16_t fSubTypeId;
  3374. // An index into a static string list in measunit.cpp. If set to -1, fImpl
  3375. // is in use instead of fTypeId and fSubTypeId.
  3376. int8_t fTypeId;
  3377. MeasureUnit(int32_t typeId, int32_t subTypeId);
  3378. MeasureUnit(MeasureUnitImpl&& impl);
  3379. void setTo(int32_t typeId, int32_t subTypeId);
  3380. static MeasureUnit *create(int typeId, int subTypeId, UErrorCode &status);
  3381. /**
  3382. * Sets output's typeId and subTypeId according to subType, if subType is a
  3383. * valid/known identifier.
  3384. *
  3385. * @return Whether subType is known to ICU. If false, output was not
  3386. * modified.
  3387. */
  3388. static bool findBySubType(StringPiece subType, MeasureUnit* output);
  3389. /** Internal version of public API */
  3390. LocalArray<MeasureUnit> splitToSingleUnitsImpl(int32_t& outCount, UErrorCode& status) const;
  3391. friend class MeasureUnitImpl;
  3392. // For access to findBySubType
  3393. friend class number::impl::LongNameHandler;
  3394. };
  3395. // inline impl of @stable ICU 68 method
  3396. inline std::pair<LocalArray<MeasureUnit>, int32_t>
  3397. MeasureUnit::splitToSingleUnits(UErrorCode& status) const {
  3398. int32_t length;
  3399. auto array = splitToSingleUnitsImpl(length, status);
  3400. return std::make_pair(std::move(array), length);
  3401. }
  3402. U_NAMESPACE_END
  3403. #endif // !UNCONFIG_NO_FORMATTING
  3404. #endif /* U_SHOW_CPLUSPLUS_API */
  3405. #endif // __MEASUREUNIT_H__