Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes16kdownloads
measunit.h3418 linesDownload Raw Back to unicode
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
16#include "unicode/utypes.h"
17
18#if U_SHOW_CPLUSPLUS_API
19
20#if !UCONFIG_NO_FORMATTING
21
22#include "unicode/unistr.h"
23#include "unicode/localpointer.h"
24
25/**
26 * \file 
27 * \brief C++ API: A unit for measuring a quantity.
28 */
29 
30U_NAMESPACE_BEGIN
31
32class StringEnumeration;
33struct MeasureUnitImpl;
34
35#ifndef U_HIDE_DRAFT_API
36/**
37 * Enumeration for unit complexity. There are three levels:
38 * 
39 * - SINGLE: A single unit, optionally with a power and/or SI prefix. Examples: hectare,
40 *           square-kilometer, kilojoule, per-second.
41 * - COMPOUND: A unit composed of the product of multiple single units. Examples:
42 *             meter-per-second, kilowatt-hour, kilogram-meter-per-square-second.
43 * - MIXED: A unit composed of the sum of multiple single units. Examples: foot+inch,
44 *          hour+minute+second, degree+arcminute+arcsecond.
45 *
46 * The complexity determines which operations are available. For example, you cannot set the power
47 * or SI prefix of a compound unit.
48 *
49 * @draft ICU 67
50 */
51enum UMeasureUnitComplexity {
52    /**
53     * A single unit, like kilojoule.
54     *
55     * @draft ICU 67
56     */
57    UMEASURE_UNIT_SINGLE,
58
59    /**
60     * A compound unit, like meter-per-second.
61     * 
62     * @draft ICU 67
63     */
64    UMEASURE_UNIT_COMPOUND,
65
66    /**
67     * A mixed unit, like hour+minute.
68     *
69     * @draft ICU 67
70     */
71    UMEASURE_UNIT_MIXED
72};
73
74/**
75 * Enumeration for SI prefixes, such as "kilo".
76 *
77 * @draft ICU 67
78 */
79typedef enum UMeasureSIPrefix {
80
81    /**
82     * SI prefix: yotta, 10^24.
83     *
84     * @draft ICU 67
85     */
86    UMEASURE_SI_PREFIX_YOTTA = 24,
87
88    /**
89     * SI prefix: zetta, 10^21.
90     *
91     * @draft ICU 67
92     */
93    UMEASURE_SI_PREFIX_ZETTA = 21,
94
95    /**
96     * SI prefix: exa, 10^18.
97     *
98     * @draft ICU 67
99     */
100    UMEASURE_SI_PREFIX_EXA = 18,
101
102    /**
103     * SI prefix: peta, 10^15.
104     *
105     * @draft ICU 67
106     */
107    UMEASURE_SI_PREFIX_PETA = 15,
108
109    /**
110     * SI prefix: tera, 10^12.
111     *
112     * @draft ICU 67
113     */
114    UMEASURE_SI_PREFIX_TERA = 12,
115
116    /**
117     * SI prefix: giga, 10^9.
118     *
119     * @draft ICU 67
120     */
121    UMEASURE_SI_PREFIX_GIGA = 9,
122
123    /**
124     * SI prefix: mega, 10^6.
125     *
126     * @draft ICU 67
127     */
128    UMEASURE_SI_PREFIX_MEGA = 6,
129
130    /**
131     * SI prefix: kilo, 10^3.
132     *
133     * @draft ICU 67
134     */
135    UMEASURE_SI_PREFIX_KILO = 3,
136
137    /**
138     * SI prefix: hecto, 10^2.
139     *
140     * @draft ICU 67
141     */
142    UMEASURE_SI_PREFIX_HECTO = 2,
143
144    /**
145     * SI prefix: deka, 10^1.
146     *
147     * @draft ICU 67
148     */
149    UMEASURE_SI_PREFIX_DEKA = 1,
150
151    /**
152     * The absence of an SI prefix.
153     *
154     * @draft ICU 67
155     */
156    UMEASURE_SI_PREFIX_ONE = 0,
157
158    /**
159     * SI prefix: deci, 10^-1.
160     *
161     * @draft ICU 67
162     */
163    UMEASURE_SI_PREFIX_DECI = -1,
164
165    /**
166     * SI prefix: centi, 10^-2.
167     *
168     * @draft ICU 67
169     */
170    UMEASURE_SI_PREFIX_CENTI = -2,
171
172    /**
173     * SI prefix: milli, 10^-3.
174     *
175     * @draft ICU 67
176     */
177    UMEASURE_SI_PREFIX_MILLI = -3,
178
179    /**
180     * SI prefix: micro, 10^-6.
181     *
182     * @draft ICU 67
183     */
184    UMEASURE_SI_PREFIX_MICRO = -6,
185
186    /**
187     * SI prefix: nano, 10^-9.
188     *
189     * @draft ICU 67
190     */
191    UMEASURE_SI_PREFIX_NANO = -9,
192
193    /**
194     * SI prefix: pico, 10^-12.
195     *
196     * @draft ICU 67
197     */
198    UMEASURE_SI_PREFIX_PICO = -12,
199
200    /**
201     * SI prefix: femto, 10^-15.
202     *
203     * @draft ICU 67
204     */
205    UMEASURE_SI_PREFIX_FEMTO = -15,
206
207    /**
208     * SI prefix: atto, 10^-18.
209     *
210     * @draft ICU 67
211     */
212    UMEASURE_SI_PREFIX_ATTO = -18,
213
214    /**
215     * SI prefix: zepto, 10^-21.
216     *
217     * @draft ICU 67
218     */
219    UMEASURE_SI_PREFIX_ZEPTO = -21,
220
221    /**
222     * SI prefix: yocto, 10^-24.
223     *
224     * @draft ICU 67
225     */
226    UMEASURE_SI_PREFIX_YOCTO = -24
227} UMeasureSIPrefix;
228#endif // U_HIDE_DRAFT_API
229
230/**
231 * A unit such as length, mass, volume, currency, etc.  A unit is
232 * coupled with a numeric amount to produce a Measure.
233 *
234 * @author Alan Liu
235 * @stable ICU 3.0
236 */
237class U_I18N_API MeasureUnit: public UObject {
238 public:
239
240    /**
241     * Default constructor.
242     * Populates the instance with the base dimensionless unit.
243     * @stable ICU 3.0
244     */
245    MeasureUnit();
246    
247    /**
248     * Copy constructor.
249     * @stable ICU 3.0
250     */
251    MeasureUnit(const MeasureUnit &other);
252
253#ifndef U_HIDE_DRAFT_API
254    /**
255     * Move constructor.
256     * @draft ICU 67
257     */
258    MeasureUnit(MeasureUnit &&other) noexcept;
259
260    /**
261     * Construct a MeasureUnit from a CLDR Unit Identifier, defined in UTS 35.
262     * Validates and canonicalizes the identifier.
263     *
264     * <pre>
265     * MeasureUnit example = MeasureUnit::forIdentifier("furlong-per-nanosecond")
266     * </pre>
267     *
268     * @param identifier The CLDR Unit Identifier
269     * @param status Set if the identifier is invalid.
270     * @draft ICU 67
271     */
272    static MeasureUnit forIdentifier(StringPiece identifier, UErrorCode& status);
273#endif // U_HIDE_DRAFT_API
274
275    /**
276     * Copy assignment operator.
277     * @stable ICU 3.0
278     */
279    MeasureUnit &operator=(const MeasureUnit &other);
280
281#ifndef U_HIDE_DRAFT_API
282    /**
283     * Move assignment operator.
284     * @draft ICU 67
285     */
286    MeasureUnit &operator=(MeasureUnit &&other) noexcept;
287#endif // U_HIDE_DRAFT_API
288
289    /**
290     * Returns a polymorphic clone of this object.  The result will
291     * have the same class as returned by getDynamicClassID().
292     * @stable ICU 3.0
293     */
294    virtual MeasureUnit* clone() const;
295
296    /**
297     * Destructor
298     * @stable ICU 3.0
299     */
300    virtual ~MeasureUnit();
301
302    /**
303     * Equality operator.  Return true if this object is equal
304     * to the given object.
305     * @stable ICU 3.0
306     */
307    virtual UBool operator==(const UObject& other) const;
308
309    /**
310     * Inequality operator.  Return true if this object is not equal
311     * to the given object.
312     * @stable ICU 53
313     */
314    UBool operator!=(const UObject& other) const {
315        return !(*this == other);
316    }
317
318    /**
319     * Get the type.
320     *
321     * If the unit does not have a type, the empty string is returned.
322     *
323     * @stable ICU 53
324     */
325    const char *getType() const;
326
327    /**
328     * Get the sub type.
329     *
330     * If the unit does not have a subtype, the empty string is returned.
331     *
332     * @stable ICU 53
333     */
334    const char *getSubtype() const;
335
336#ifndef U_HIDE_DRAFT_API
337    /**
338     * Get the CLDR Unit Identifier for this MeasureUnit, as defined in UTS 35.
339     *
340     * @return The string form of this unit, owned by this MeasureUnit.
341     * @draft ICU 67
342     */
343    const char* getIdentifier() const;
344
345    /**
346     * Compute the complexity of the unit. See UMeasureUnitComplexity for more information.
347     *
348     * @param status Set if an error occurs.
349     * @return The unit complexity.
350     * @draft ICU 67
351     */
352    UMeasureUnitComplexity getComplexity(UErrorCode& status) const;
353
354    /**
355     * Creates a MeasureUnit which is this SINGLE unit augmented with the specified SI prefix.
356     * For example, UMEASURE_SI_PREFIX_KILO for "kilo".
357     *
358     * There is sufficient locale data to format all standard SI prefixes.
359     *
360     * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
361     * occur. For more information, see UMeasureUnitComplexity.
362     *
363     * @param prefix The SI prefix, from UMeasureSIPrefix.
364     * @param status Set if this is not a SINGLE unit or if another error occurs.
365     * @return A new SINGLE unit.
366     * @draft ICU 67
367     */
368    MeasureUnit withSIPrefix(UMeasureSIPrefix prefix, UErrorCode& status) const;
369
370    /**
371     * Gets the current SI prefix of this SINGLE unit. For example, if the unit has the SI prefix
372     * "kilo", then UMEASURE_SI_PREFIX_KILO is returned.
373     *
374     * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
375     * occur. For more information, see UMeasureUnitComplexity.
376     *
377     * @param status Set if this is not a SINGLE unit or if another error occurs.
378     * @return The SI prefix of this SINGLE unit, from UMeasureSIPrefix.
379     * @draft ICU 67
380     */
381    UMeasureSIPrefix getSIPrefix(UErrorCode& status) const;
382
383    /**
384     * Creates a MeasureUnit which is this SINGLE unit augmented with the specified dimensionality
385     * (power). For example, if dimensionality is 2, the unit will be squared.
386     *
387     * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
388     * occur. For more information, see UMeasureUnitComplexity.
389     *
390     * For the base dimensionless unit, withDimensionality does nothing.
391     *
392     * @param dimensionality The dimensionality (power).
393     * @param status Set if this is not a SINGLE unit or if another error occurs.
394     * @return A new SINGLE unit.
395     * @draft ICU 67
396     */
397    MeasureUnit withDimensionality(int32_t dimensionality, UErrorCode& status) const;
398
399    /**
400     * Gets the dimensionality (power) of this MeasureUnit. For example, if the unit is square,
401     * then 2 is returned.
402     *
403     * NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will
404     * occur. For more information, see UMeasureUnitComplexity.
405     *
406     * For the base dimensionless unit, getDimensionality returns 0.
407     *
408     * @param status Set if this is not a SINGLE unit or if another error occurs.
409     * @return The dimensionality (power) of this simple unit.
410     * @draft ICU 67
411     */
412    int32_t getDimensionality(UErrorCode& status) const;
413
414    /**
415     * Gets the reciprocal of this MeasureUnit, with the numerator and denominator flipped.
416     *
417     * For example, if the receiver is "meter-per-second", the unit "second-per-meter" is returned.
418     *
419     * NOTE: Only works on SINGLE and COMPOUND units. If this is a MIXED unit, an error will
420     * occur. For more information, see UMeasureUnitComplexity.
421     *
422     * @param status Set if this is a MIXED unit or if another error occurs.
423     * @return The reciprocal of the target unit.
424     * @draft ICU 67
425     */
426    MeasureUnit reciprocal(UErrorCode& status) const;
427
428    /**
429     * Gets the product of this unit with another unit. This is a way to build units from
430     * constituent parts.
431     *
432     * The numerator and denominator are preserved through this operation.
433     *
434     * For example, if the receiver is "kilowatt" and the argument is "hour-per-day", then the
435     * unit "kilowatt-hour-per-day" is returned.
436     *
437     * NOTE: Only works on SINGLE and COMPOUND units. If either unit (receivee and argument) is a
438     * MIXED unit, an error will occur. For more information, see UMeasureUnitComplexity.
439     *
440     * @param other The MeasureUnit to multiply with the target.
441     * @param status Set if this or other is a MIXED unit or if another error occurs.
442     * @return The product of the target unit with the provided unit.
443     * @draft ICU 67
444     */
445    MeasureUnit product(const MeasureUnit& other, UErrorCode& status) const;
446#endif // U_HIDE_DRAFT_API
447
448#ifndef U_HIDE_INTERNAL_API
449    /**
450     * Gets the list of SINGLE units contained within a MIXED of COMPOUND unit.
451     *
452     * Examples:
453     * - Given "meter-kilogram-per-second", three units will be returned: "meter",
454     *   "kilogram", and "per-second".
455     * - Given "hour+minute+second", three units will be returned: "hour", "minute",
456     *   and "second".
457     *
458     * If this is a SINGLE unit, an array of length 1 will be returned.
459     *
460     * TODO(ICU-21021): Finalize this API and propose it as draft.
461     *
462     * @param outCount The number of elements in the return array.
463     * @param status Set if an error occurs.
464     * @return An array of single units, owned by the caller.
465     * @internal ICU 67 Technical Preview
466     */
467    LocalArray<MeasureUnit> splitToSingleUnits(int32_t& outCount, UErrorCode& status) const;
468#endif // U_HIDE_INTERNAL_API
469
470    /**
471     * getAvailable gets all of the available units.
472     * If there are too many units to fit into destCapacity then the
473     * error code is set to U_BUFFER_OVERFLOW_ERROR.
474     *
475     * @param destArray destination buffer.
476     * @param destCapacity number of MeasureUnit instances available at dest.
477     * @param errorCode ICU error code.
478     * @return number of available units.
479     * @stable ICU 53
480     */
481    static int32_t getAvailable(
482            MeasureUnit *destArray,
483            int32_t destCapacity,
484            UErrorCode &errorCode);
485
486    /**
487     * getAvailable gets all of the available units for a specific type.
488     * If there are too many units to fit into destCapacity then the
489     * error code is set to U_BUFFER_OVERFLOW_ERROR.
490     *
491     * @param type the type
492     * @param destArray destination buffer.
493     * @param destCapacity number of MeasureUnit instances available at dest.
494     * @param errorCode ICU error code.
495     * @return number of available units for type.
496     * @stable ICU 53
497     */
498    static int32_t getAvailable(
499            const char *type,
500            MeasureUnit *destArray,
501            int32_t destCapacity,
502            UErrorCode &errorCode);
503
504    /**
505     * getAvailableTypes gets all of the available types. Caller owns the
506     * returned StringEnumeration and must delete it when finished using it.
507     *
508     * @param errorCode ICU error code.
509     * @return the types.
510     * @stable ICU 53
511     */
512    static StringEnumeration* getAvailableTypes(UErrorCode &errorCode);
513
514    /**
515     * Return the class ID for this class. This is useful only for comparing to
516     * a return value from getDynamicClassID(). For example:
517     * <pre>
518     * .   Base* polymorphic_pointer = createPolymorphicObject();
519     * .   if (polymorphic_pointer->getDynamicClassID() ==
520     * .       Derived::getStaticClassID()) ...
521     * </pre>
522     * @return          The class ID for all objects of this class.
523     * @stable ICU 53
524     */
525    static UClassID U_EXPORT2 getStaticClassID(void);
526
527    /**
528     * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
529     * method is to implement a simple version of RTTI, since not all C++
530     * compilers support genuine RTTI. Polymorphic operator==() and clone()
531     * methods call this method.
532     *
533     * @return          The class ID for this object. All objects of a
534     *                  given class have the same class ID.  Objects of
535     *                  other classes have different class IDs.
536     * @stable ICU 53
537     */
538    virtual UClassID getDynamicClassID(void) const;
539
540#ifndef U_HIDE_INTERNAL_API
541    /**
542     * ICU use only.
543     * Returns associated array index for this measure unit. Only valid for
544     * non-currency measure units.
545     * @internal
546     */
547    int32_t getIndex() const;
548
549    /**
550     * ICU use only.
551     * Returns maximum value from getIndex plus 1.
552     * @internal
553     */
554    static int32_t getIndexCount();
555
556    /**
557     * ICU use only.
558     * @return the unit.getIndex() of the unit which has this unit.getType() and unit.getSubtype(),
559     *         or a negative value if there is no such unit
560     * @internal
561     */
562    static int32_t internalGetIndexForTypeAndSubtype(const char *type, const char *subtype);
563
564    /**
565     * ICU use only.
566     * @internal
567     */
568    static MeasureUnit resolveUnitPerUnit(
569            const MeasureUnit &unit, const MeasureUnit &perUnit, bool* isResolved);
570#endif /* U_HIDE_INTERNAL_API */
571
572// All code between the "Start generated createXXX methods" comment and
573// the "End generated createXXX methods" comment is auto generated code
574// and must not be edited manually. For instructions on how to correctly
575// update this code, refer to:
576// http://site.icu-project.org/design/formatting/measureformat/updating-measure-unit
577//
578// Start generated createXXX methods
579
580    /**
581     * Returns by pointer, unit of acceleration: g-force.
582     * Caller owns returned value and must free it.
583     * Also see {@link #getGForce()}.
584     * @param status ICU error code.
585     * @stable ICU 53
586     */
587    static MeasureUnit *createGForce(UErrorCode &status);
588
589    /**
590     * Returns by value, unit of acceleration: g-force.
591     * Also see {@link #createGForce()}.
592     * @stable ICU 64
593     */
594    static MeasureUnit getGForce();
595
596    /**
597     * Returns by pointer, unit of acceleration: meter-per-square-second.
598     * Caller owns returned value and must free it.
599     * Also see {@link #getMeterPerSecondSquared()}.
600     * @param status ICU error code.
601     * @stable ICU 54
602     */
603    static MeasureUnit *createMeterPerSecondSquared(UErrorCode &status);
604
605    /**
606     * Returns by value, unit of acceleration: meter-per-square-second.
607     * Also see {@link #createMeterPerSecondSquared()}.
608     * @stable ICU 64
609     */
610    static MeasureUnit getMeterPerSecondSquared();
611
612    /**
613     * Returns by pointer, unit of angle: arc-minute.
614     * Caller owns returned value and must free it.
615     * Also see {@link #getArcMinute()}.
616     * @param status ICU error code.
617     * @stable ICU 53
618     */
619    static MeasureUnit *createArcMinute(UErrorCode &status);
620
621    /**
622     * Returns by value, unit of angle: arc-minute.
623     * Also see {@link #createArcMinute()}.
624     * @stable ICU 64
625     */
626    static MeasureUnit getArcMinute();
627
628    /**
629     * Returns by pointer, unit of angle: arc-second.
630     * Caller owns returned value and must free it.
631     * Also see {@link #getArcSecond()}.
632     * @param status ICU error code.
633     * @stable ICU 53
634     */
635    static MeasureUnit *createArcSecond(UErrorCode &status);
636
637    /**
638     * Returns by value, unit of angle: arc-second.
639     * Also see {@link #createArcSecond()}.
640     * @stable ICU 64
641     */
642    static MeasureUnit getArcSecond();
643
644    /**
645     * Returns by pointer, unit of angle: degree.
646     * Caller owns returned value and must free it.
647     * Also see {@link #getDegree()}.
648     * @param status ICU error code.
649     * @stable ICU 53
650     */
651    static MeasureUnit *createDegree(UErrorCode &status);
652
653    /**
654     * Returns by value, unit of angle: degree.
655     * Also see {@link #createDegree()}.
656     * @stable ICU 64
657     */
658    static MeasureUnit getDegree();
659
660    /**
661     * Returns by pointer, unit of angle: radian.
662     * Caller owns returned value and must free it.
663     * Also see {@link #getRadian()}.
664     * @param status ICU error code.
665     * @stable ICU 54
666     */
667    static MeasureUnit *createRadian(UErrorCode &status);
668
669    /**
670     * Returns by value, unit of angle: radian.
671     * Also see {@link #createRadian()}.
672     * @stable ICU 64
673     */
674    static MeasureUnit getRadian();
675
676    /**
677     * Returns by pointer, unit of angle: revolution.
678     * Caller owns returned value and must free it.
679     * Also see {@link #getRevolutionAngle()}.
680     * @param status ICU error code.
681     * @stable ICU 56
682     */
683    static MeasureUnit *createRevolutionAngle(UErrorCode &status);
684
685    /**
686     * Returns by value, unit of angle: revolution.
687     * Also see {@link #createRevolutionAngle()}.
688     * @stable ICU 64
689     */
690    static MeasureUnit getRevolutionAngle();
691
692    /**
693     * Returns by pointer, unit of area: acre.
694     * Caller owns returned value and must free it.
695     * Also see {@link #getAcre()}.
696     * @param status ICU error code.
697     * @stable ICU 53
698     */
699    static MeasureUnit *createAcre(UErrorCode &status);
700
701    /**
702     * Returns by value, unit of area: acre.
703     * Also see {@link #createAcre()}.
704     * @stable ICU 64
705     */
706    static MeasureUnit getAcre();
707
708    /**
709     * Returns by pointer, unit of area: dunam.
710     * Caller owns returned value and must free it.
711     * Also see {@link #getDunam()}.
712     * @param status ICU error code.
713     * @stable ICU 64
714     */
715    static MeasureUnit *createDunam(UErrorCode &status);
716
717    /**
718     * Returns by value, unit of area: dunam.
719     * Also see {@link #createDunam()}.
720     * @stable ICU 64
721     */
722    static MeasureUnit getDunam();
723
724    /**
725     * Returns by pointer, unit of area: hectare.
726     * Caller owns returned value and must free it.
727     * Also see {@link #getHectare()}.
728     * @param status ICU error code.
729     * @stable ICU 53
730     */
731    static MeasureUnit *createHectare(UErrorCode &status);
732
733    /**
734     * Returns by value, unit of area: hectare.
735     * Also see {@link #createHectare()}.
736     * @stable ICU 64
737     */
738    static MeasureUnit getHectare();
739
740    /**
741     * Returns by pointer, unit of area: square-centimeter.
742     * Caller owns returned value and must free it.
743     * Also see {@link #getSquareCentimeter()}.
744     * @param status ICU error code.
745     * @stable ICU 54
746     */
747    static MeasureUnit *createSquareCentimeter(UErrorCode &status);
748
749    /**
750     * Returns by value, unit of area: square-centimeter.
751     * Also see {@link #createSquareCentimeter()}.
752     * @stable ICU 64
753     */
754    static MeasureUnit getSquareCentimeter();
755
756    /**
757     * Returns by pointer, unit of area: square-foot.
758     * Caller owns returned value and must free it.
759     * Also see {@link #getSquareFoot()}.
760     * @param status ICU error code.
761     * @stable ICU 53
762     */
763    static MeasureUnit *createSquareFoot(UErrorCode &status);
764
765    /**
766     * Returns by value, unit of area: square-foot.
767     * Also see {@link #createSquareFoot()}.
768     * @stable ICU 64
769     */
770    static MeasureUnit getSquareFoot();
771
772    /**
773     * Returns by pointer, unit of area: square-inch.
774     * Caller owns returned value and must free it.
775     * Also see {@link #getSquareInch()}.
776     * @param status ICU error code.
777     * @stable ICU 54
778     */
779    static MeasureUnit *createSquareInch(UErrorCode &status);
780
781    /**
782     * Returns by value, unit of area: square-inch.
783     * Also see {@link #createSquareInch()}.
784     * @stable ICU 64
785     */
786    static MeasureUnit getSquareInch();
787
788    /**
789     * Returns by pointer, unit of area: square-kilometer.
790     * Caller owns returned value and must free it.
791     * Also see {@link #getSquareKilometer()}.
792     * @param status ICU error code.
793     * @stable ICU 53
794     */
795    static MeasureUnit *createSquareKilometer(UErrorCode &status);
796
797    /**
798     * Returns by value, unit of area: square-kilometer.
799     * Also see {@link #createSquareKilometer()}.
800     * @stable ICU 64
801     */
802    static MeasureUnit getSquareKilometer();
803
804    /**
805     * Returns by pointer, unit of area: square-meter.
806     * Caller owns returned value and must free it.
807     * Also see {@link #getSquareMeter()}.
808     * @param status ICU error code.
809     * @stable ICU 53
810     */
811    static MeasureUnit *createSquareMeter(UErrorCode &status);
812
813    /**
814     * Returns by value, unit of area: square-meter.
815     * Also see {@link #createSquareMeter()}.
816     * @stable ICU 64
817     */
818    static MeasureUnit getSquareMeter();
819
820    /**
821     * Returns by pointer, unit of area: square-mile.
822     * Caller owns returned value and must free it.
823     * Also see {@link #getSquareMile()}.
824     * @param status ICU error code.
825     * @stable ICU 53
826     */
827    static MeasureUnit *createSquareMile(UErrorCode &status);
828
829    /**
830     * Returns by value, unit of area: square-mile.
831     * Also see {@link #createSquareMile()}.
832     * @stable ICU 64
833     */
834    static MeasureUnit getSquareMile();
835
836    /**
837     * Returns by pointer, unit of area: square-yard.
838     * Caller owns returned value and must free it.
839     * Also see {@link #getSquareYard()}.
840     * @param status ICU error code.
841     * @stable ICU 54
842     */
843    static MeasureUnit *createSquareYard(UErrorCode &status);
844
845    /**
846     * Returns by value, unit of area: square-yard.
847     * Also see {@link #createSquareYard()}.
848     * @stable ICU 64
849     */
850    static MeasureUnit getSquareYard();
851
852    /**
853     * Returns by pointer, unit of concentr: karat.
854     * Caller owns returned value and must free it.
855     * Also see {@link #getKarat()}.
856     * @param status ICU error code.
857     * @stable ICU 54
858     */
859    static MeasureUnit *createKarat(UErrorCode &status);
860
861    /**
862     * Returns by value, unit of concentr: karat.
863     * Also see {@link #createKarat()}.
864     * @stable ICU 64
865     */
866    static MeasureUnit getKarat();
867
868    /**
869     * Returns by pointer, unit of concentr: milligram-per-deciliter.
870     * Caller owns returned value and must free it.
871     * Also see {@link #getMilligramPerDeciliter()}.
872     * @param status ICU error code.
873     * @stable ICU 57
874     */
875    static MeasureUnit *createMilligramPerDeciliter(UErrorCode &status);
876
877    /**
878     * Returns by value, unit of concentr: milligram-per-deciliter.
879     * Also see {@link #createMilligramPerDeciliter()}.
880     * @stable ICU 64
881     */
882    static MeasureUnit getMilligramPerDeciliter();
883
884    /**
885     * Returns by pointer, unit of concentr: millimole-per-liter.
886     * Caller owns returned value and must free it.
887     * Also see {@link #getMillimolePerLiter()}.
888     * @param status ICU error code.
889     * @stable ICU 57
890     */
891    static MeasureUnit *createMillimolePerLiter(UErrorCode &status);
892
893    /**
894     * Returns by value, unit of concentr: millimole-per-liter.
895     * Also see {@link #createMillimolePerLiter()}.
896     * @stable ICU 64
897     */
898    static MeasureUnit getMillimolePerLiter();
899
900    /**
901     * Returns by pointer, unit of concentr: mole.
902     * Caller owns returned value and must free it.
903     * Also see {@link #getMole()}.
904     * @param status ICU error code.
905     * @stable ICU 64
906     */
907    static MeasureUnit *createMole(UErrorCode &status);
908
909    /**
910     * Returns by value, unit of concentr: mole.
911     * Also see {@link #createMole()}.
912     * @stable ICU 64
913     */
914    static MeasureUnit getMole();
915
916    /**
917     * Returns by pointer, unit of concentr: permillion.
918     * Caller owns returned value and must free it.
919     * Also see {@link #getPartPerMillion()}.
920     * @param status ICU error code.
921     * @stable ICU 57
922     */
923    static MeasureUnit *createPartPerMillion(UErrorCode &status);
924
925    /**
926     * Returns by value, unit of concentr: permillion.
927     * Also see {@link #createPartPerMillion()}.
928     * @stable ICU 64
929     */
930    static MeasureUnit getPartPerMillion();
931
932    /**
933     * Returns by pointer, unit of concentr: percent.
934     * Caller owns returned value and must free it.
935     * Also see {@link #getPercent()}.
936     * @param status ICU error code.
937     * @stable ICU 63
938     */
939    static MeasureUnit *createPercent(UErrorCode &status);
940
941    /**
942     * Returns by value, unit of concentr: percent.
943     * Also see {@link #createPercent()}.
944     * @stable ICU 64
945     */
946    static MeasureUnit getPercent();
947
948    /**
949     * Returns by pointer, unit of concentr: permille.
950     * Caller owns returned value and must free it.
951     * Also see {@link #getPermille()}.
952     * @param status ICU error code.
953     * @stable ICU 63
954     */
955    static MeasureUnit *createPermille(UErrorCode &status);
956
957    /**
958     * Returns by value, unit of concentr: permille.
959     * Also see {@link #createPermille()}.
960     * @stable ICU 64
961     */
962    static MeasureUnit getPermille();
963
964    /**
965     * Returns by pointer, unit of concentr: permyriad.
966     * Caller owns returned value and must free it.
967     * Also see {@link #getPermyriad()}.
968     * @param status ICU error code.
969     * @stable ICU 64
970     */
971    static MeasureUnit *createPermyriad(UErrorCode &status);
972
973    /**
974     * Returns by value, unit of concentr: permyriad.
975     * Also see {@link #createPermyriad()}.
976     * @stable ICU 64
977     */
978    static MeasureUnit getPermyriad();
979
980    /**
981     * Returns by pointer, unit of consumption: liter-per-100-kilometer.
982     * Caller owns returned value and must free it.
983     * Also see {@link #getLiterPer100Kilometers()}.
984     * @param status ICU error code.
985     * @stable ICU 56
986     */
987    static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status);
988
989    /**
990     * Returns by value, unit of consumption: liter-per-100-kilometer.
991     * Also see {@link #createLiterPer100Kilometers()}.
992     * @stable ICU 64
993     */
994    static MeasureUnit getLiterPer100Kilometers();
995
996    /**
997     * Returns by pointer, unit of consumption: liter-per-kilometer.
998     * Caller owns returned value and must free it.
999     * Also see {@link #getLiterPerKilometer()}.
1000     * @param status ICU error code.
1001     * @stable ICU 54
1002     */
1003    static MeasureUnit *createLiterPerKilometer(UErrorCode &status);
1004
1005    /**
1006     * Returns by value, unit of consumption: liter-per-kilometer.
1007     * Also see {@link #createLiterPerKilometer()}.
1008     * @stable ICU 64
1009     */
1010    static MeasureUnit getLiterPerKilometer();
1011
1012    /**
1013     * Returns by pointer, unit of consumption: mile-per-gallon.
1014     * Caller owns returned value and must free it.
1015     * Also see {@link #getMilePerGallon()}.
1016     * @param status ICU error code.
1017     * @stable ICU 54
1018     */
1019    static MeasureUnit *createMilePerGallon(UErrorCode &status);
1020
1021    /**
1022     * Returns by value, unit of consumption: mile-per-gallon.
1023     * Also see {@link #createMilePerGallon()}.
1024     * @stable ICU 64
1025     */
1026    static MeasureUnit getMilePerGallon();
1027
1028    /**
1029     * Returns by pointer, unit of consumption: mile-per-gallon-imperial.
1030     * Caller owns returned value and must free it.
1031     * Also see {@link #getMilePerGallonImperial()}.
1032     * @param status ICU error code.
1033     * @stable ICU 57
1034     */
1035    static MeasureUnit *createMilePerGallonImperial(UErrorCode &status);
1036
1037    /**
1038     * Returns by value, unit of consumption: mile-per-gallon-imperial.
1039     * Also see {@link #createMilePerGallonImperial()}.
1040     * @stable ICU 64
1041     */
1042    static MeasureUnit getMilePerGallonImperial();
1043
1044    /**
1045     * Returns by pointer, unit of digital: bit.
1046     * Caller owns returned value and must free it.
1047     * Also see {@link #getBit()}.
1048     * @param status ICU error code.
1049     * @stable ICU 54
1050     */
1051    static MeasureUnit *createBit(UErrorCode &status);
1052
1053    /**
1054     * Returns by value, unit of digital: bit.
1055     * Also see {@link #createBit()}.
1056     * @stable ICU 64
1057     */
1058    static MeasureUnit getBit();
1059
1060    /**
1061     * Returns by pointer, unit of digital: byte.
1062     * Caller owns returned value and must free it.
1063     * Also see {@link #getByte()}.
1064     * @param status ICU error code.
1065     * @stable ICU 54
1066     */
1067    static MeasureUnit *createByte(UErrorCode &status);
1068
1069    /**
1070     * Returns by value, unit of digital: byte.
1071     * Also see {@link #createByte()}.
1072     * @stable ICU 64
1073     */
1074    static MeasureUnit getByte();
1075
1076    /**
1077     * Returns by pointer, unit of digital: gigabit.
1078     * Caller owns returned value and must free it.
1079     * Also see {@link #getGigabit()}.
1080     * @param status ICU error code.
1081     * @stable ICU 54
1082     */
1083    static MeasureUnit *createGigabit(UErrorCode &status);
1084
1085    /**
1086     * Returns by value, unit of digital: gigabit.
1087     * Also see {@link #createGigabit()}.
1088     * @stable ICU 64
1089     */
1090    static MeasureUnit getGigabit();
1091
1092    /**
1093     * Returns by pointer, unit of digital: gigabyte.
1094     * Caller owns returned value and must free it.
1095     * Also see {@link #getGigabyte()}.
1096     * @param status ICU error code.
1097     * @stable ICU 54
1098     */
1099    static MeasureUnit *createGigabyte(UErrorCode &status);
1100
1101    /**
1102     * Returns by value, unit of digital: gigabyte.
1103     * Also see {@link #createGigabyte()}.
1104     * @stable ICU 64
1105     */
1106    static MeasureUnit getGigabyte();
1107
1108    /**
1109     * Returns by pointer, unit of digital: kilobit.
1110     * Caller owns returned value and must free it.
1111     * Also see {@link #getKilobit()}.
1112     * @param status ICU error code.
1113     * @stable ICU 54
1114     */
1115    static MeasureUnit *createKilobit(UErrorCode &status);
1116
1117    /**
1118     * Returns by value, unit of digital: kilobit.
1119     * Also see {@link #createKilobit()}.
1120     * @stable ICU 64
1121     */
1122    static MeasureUnit getKilobit();
1123
1124    /**
1125     * Returns by pointer, unit of digital: kilobyte.
1126     * Caller owns returned value and must free it.
1127     * Also see {@link #getKilobyte()}.
1128     * @param status ICU error code.
1129     * @stable ICU 54
1130     */
1131    static MeasureUnit *createKilobyte(UErrorCode &status);
1132
1133    /**
1134     * Returns by value, unit of digital: kilobyte.
1135     * Also see {@link #createKilobyte()}.
1136     * @stable ICU 64
1137     */
1138    static MeasureUnit getKilobyte();
1139
1140    /**
1141     * Returns by pointer, unit of digital: megabit.
1142     * Caller owns returned value and must free it.
1143     * Also see {@link #getMegabit()}.
1144     * @param status ICU error code.
1145     * @stable ICU 54
1146     */
1147    static MeasureUnit *createMegabit(UErrorCode &status);
1148
1149    /**
1150     * Returns by value, unit of digital: megabit.
1151     * Also see {@link #createMegabit()}.
1152     * @stable ICU 64
1153     */
1154    static MeasureUnit getMegabit();
1155
1156    /**
1157     * Returns by pointer, unit of digital: megabyte.
1158     * Caller owns returned value and must free it.
1159     * Also see {@link #getMegabyte()}.
1160     * @param status ICU error code.
1161     * @stable ICU 54
1162     */
1163    static MeasureUnit *createMegabyte(UErrorCode &status);
1164
1165    /**
1166     * Returns by value, unit of digital: megabyte.
1167     * Also see {@link #createMegabyte()}.
1168     * @stable ICU 64
1169     */
1170    static MeasureUnit getMegabyte();
1171
1172    /**
1173     * Returns by pointer, unit of digital: petabyte.
1174     * Caller owns returned value and must free it.
1175     * Also see {@link #getPetabyte()}.
1176     * @param status ICU error code.
1177     * @stable ICU 63
1178     */
1179    static MeasureUnit *createPetabyte(UErrorCode &status);
1180
1181    /**
1182     * Returns by value, unit of digital: petabyte.
1183     * Also see {@link #createPetabyte()}.
1184     * @stable ICU 64
1185     */
1186    static MeasureUnit getPetabyte();
1187
1188    /**
1189     * Returns by pointer, unit of digital: terabit.
1190     * Caller owns returned value and must free it.
1191     * Also see {@link #getTerabit()}.
1192     * @param status ICU error code.
1193     * @stable ICU 54
1194     */
1195    static MeasureUnit *createTerabit(UErrorCode &status);
1196
1197    /**
1198     * Returns by value, unit of digital: terabit.
1199     * Also see {@link #createTerabit()}.
1200     * @stable ICU 64

Showing the first 1,200 of 3418 lines. Download the file for the rest.

codekingpro/portable-devtools · Team Ai