measunit.h 107 KB

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