measunit.h 95 KB

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