Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/unicode/measunit.h
Line
Count
Source (jump to first uncovered line)
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 !UCONFIG_NO_FORMATTING
19
20
#include "unicode/unistr.h"
21
22
/**
23
 * \file 
24
 * \brief C++ API: A unit for measuring a quantity.
25
 */
26
 
27
U_NAMESPACE_BEGIN
28
29
class StringEnumeration;
30
31
/**
32
 * A unit such as length, mass, volume, currency, etc.  A unit is
33
 * coupled with a numeric amount to produce a Measure.
34
 *
35
 * @author Alan Liu
36
 * @stable ICU 3.0
37
 */
38
class U_I18N_API MeasureUnit: public UObject {
39
 public:
40
41
    /**
42
     * Default constructor.
43
     * Populates the instance with the base dimensionless unit.
44
     * @stable ICU 3.0
45
     */
46
    MeasureUnit();
47
    
48
    /**
49
     * Copy constructor.
50
     * @stable ICU 3.0
51
     */
52
    MeasureUnit(const MeasureUnit &other);
53
        
54
    /**
55
     * Assignment operator.
56
     * @stable ICU 3.0
57
     */
58
    MeasureUnit &operator=(const MeasureUnit &other);
59
60
    /**
61
     * Returns a polymorphic clone of this object.  The result will
62
     * have the same class as returned by getDynamicClassID().
63
     * @stable ICU 3.0
64
     */
65
    virtual UObject* clone() const;
66
67
    /**
68
     * Destructor
69
     * @stable ICU 3.0
70
     */
71
    virtual ~MeasureUnit();
72
73
    /**
74
     * Equality operator.  Return true if this object is equal
75
     * to the given object.
76
     * @stable ICU 3.0
77
     */
78
    virtual UBool operator==(const UObject& other) const;
79
80
    /**
81
     * Inequality operator.  Return true if this object is not equal
82
     * to the given object.
83
     * @stable ICU 53
84
     */
85
0
    UBool operator!=(const UObject& other) const {
86
0
        return !(*this == other);
87
0
    }
88
89
    /**
90
     * Get the type.
91
     * @stable ICU 53
92
     */
93
    const char *getType() const;
94
95
    /**
96
     * Get the sub type.
97
     * @stable ICU 53
98
     */
99
    const char *getSubtype() const;
100
101
    /**
102
     * getAvailable gets all of the available units.
103
     * If there are too many units to fit into destCapacity then the
104
     * error code is set to U_BUFFER_OVERFLOW_ERROR.
105
     *
106
     * @param destArray destination buffer.
107
     * @param destCapacity number of MeasureUnit instances available at dest.
108
     * @param errorCode ICU error code.
109
     * @return number of available units.
110
     * @stable ICU 53
111
     */
112
    static int32_t getAvailable(
113
            MeasureUnit *destArray,
114
            int32_t destCapacity,
115
            UErrorCode &errorCode);
116
117
    /**
118
     * getAvailable gets all of the available units for a specific type.
119
     * If there are too many units to fit into destCapacity then the
120
     * error code is set to U_BUFFER_OVERFLOW_ERROR.
121
     *
122
     * @param type the type
123
     * @param destArray destination buffer.
124
     * @param destCapacity number of MeasureUnit instances available at dest.
125
     * @param errorCode ICU error code.
126
     * @return number of available units for type.
127
     * @stable ICU 53
128
     */
129
    static int32_t getAvailable(
130
            const char *type,
131
            MeasureUnit *destArray,
132
            int32_t destCapacity,
133
            UErrorCode &errorCode);
134
135
    /**
136
     * getAvailableTypes gets all of the available types. Caller owns the
137
     * returned StringEnumeration and must delete it when finished using it.
138
     *
139
     * @param errorCode ICU error code.
140
     * @return the types.
141
     * @stable ICU 53
142
     */
143
    static StringEnumeration* getAvailableTypes(UErrorCode &errorCode);
144
145
    /**
146
     * Return the class ID for this class. This is useful only for comparing to
147
     * a return value from getDynamicClassID(). For example:
148
     * <pre>
149
     * .   Base* polymorphic_pointer = createPolymorphicObject();
150
     * .   if (polymorphic_pointer->getDynamicClassID() ==
151
     * .       Derived::getStaticClassID()) ...
152
     * </pre>
153
     * @return          The class ID for all objects of this class.
154
     * @stable ICU 53
155
     */
156
    static UClassID U_EXPORT2 getStaticClassID(void);
157
158
    /**
159
     * Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
160
     * method is to implement a simple version of RTTI, since not all C++
161
     * compilers support genuine RTTI. Polymorphic operator==() and clone()
162
     * methods call this method.
163
     *
164
     * @return          The class ID for this object. All objects of a
165
     *                  given class have the same class ID.  Objects of
166
     *                  other classes have different class IDs.
167
     * @stable ICU 53
168
     */
169
    virtual UClassID getDynamicClassID(void) const;
170
171
#ifndef U_HIDE_INTERNAL_API
172
    /**
173
     * ICU use only.
174
     * Returns associated array index for this measure unit. Only valid for
175
     * non-currency measure units.
176
     * @internal
177
     */
178
    int32_t getIndex() const;
179
180
    /**
181
     * ICU use only.
182
     * Returns maximum value from getIndex plus 1.
183
     * @internal
184
     */
185
    static int32_t getIndexCount();
186
187
    /**
188
     * ICU use only.
189
     * @return the unit.getIndex() of the unit which has this unit.getType() and unit.getSubtype(),
190
     *         or a negative value if there is no such unit
191
     * @internal
192
     */
193
    static int32_t internalGetIndexForTypeAndSubtype(const char *type, const char *subtype);
194
195
    /**
196
     * ICU use only.
197
     * @internal
198
     */
199
    static MeasureUnit resolveUnitPerUnit(
200
            const MeasureUnit &unit, const MeasureUnit &perUnit, bool* isResolved);
201
#endif /* U_HIDE_INTERNAL_API */
202
203
// All code between the "Start generated createXXX methods" comment and
204
// the "End generated createXXX methods" comment is auto generated code
205
// and must not be edited manually. For instructions on how to correctly
206
// update this code, refer to:
207
// http://site.icu-project.org/design/formatting/measureformat/updating-measure-unit
208
//
209
// Start generated createXXX methods
210
211
    /**
212
     * Returns unit of acceleration: g-force.
213
     * Caller owns returned value and must free it.
214
     * @param status ICU error code.
215
     * @stable ICU 53
216
     */
217
    static MeasureUnit *createGForce(UErrorCode &status);
218
219
    /**
220
     * Returns unit of acceleration: meter-per-second-squared.
221
     * Caller owns returned value and must free it.
222
     * @param status ICU error code.
223
     * @stable ICU 54
224
     */
225
    static MeasureUnit *createMeterPerSecondSquared(UErrorCode &status);
226
227
    /**
228
     * Returns unit of angle: arc-minute.
229
     * Caller owns returned value and must free it.
230
     * @param status ICU error code.
231
     * @stable ICU 53
232
     */
233
    static MeasureUnit *createArcMinute(UErrorCode &status);
234
235
    /**
236
     * Returns unit of angle: arc-second.
237
     * Caller owns returned value and must free it.
238
     * @param status ICU error code.
239
     * @stable ICU 53
240
     */
241
    static MeasureUnit *createArcSecond(UErrorCode &status);
242
243
    /**
244
     * Returns unit of angle: degree.
245
     * Caller owns returned value and must free it.
246
     * @param status ICU error code.
247
     * @stable ICU 53
248
     */
249
    static MeasureUnit *createDegree(UErrorCode &status);
250
251
    /**
252
     * Returns unit of angle: radian.
253
     * Caller owns returned value and must free it.
254
     * @param status ICU error code.
255
     * @stable ICU 54
256
     */
257
    static MeasureUnit *createRadian(UErrorCode &status);
258
259
    /**
260
     * Returns unit of angle: revolution.
261
     * Caller owns returned value and must free it.
262
     * @param status ICU error code.
263
     * @stable ICU 56
264
     */
265
    static MeasureUnit *createRevolutionAngle(UErrorCode &status);
266
267
    /**
268
     * Returns unit of area: acre.
269
     * Caller owns returned value and must free it.
270
     * @param status ICU error code.
271
     * @stable ICU 53
272
     */
273
    static MeasureUnit *createAcre(UErrorCode &status);
274
275
    /**
276
     * Returns unit of area: hectare.
277
     * Caller owns returned value and must free it.
278
     * @param status ICU error code.
279
     * @stable ICU 53
280
     */
281
    static MeasureUnit *createHectare(UErrorCode &status);
282
283
    /**
284
     * Returns unit of area: square-centimeter.
285
     * Caller owns returned value and must free it.
286
     * @param status ICU error code.
287
     * @stable ICU 54
288
     */
289
    static MeasureUnit *createSquareCentimeter(UErrorCode &status);
290
291
    /**
292
     * Returns unit of area: square-foot.
293
     * Caller owns returned value and must free it.
294
     * @param status ICU error code.
295
     * @stable ICU 53
296
     */
297
    static MeasureUnit *createSquareFoot(UErrorCode &status);
298
299
    /**
300
     * Returns unit of area: square-inch.
301
     * Caller owns returned value and must free it.
302
     * @param status ICU error code.
303
     * @stable ICU 54
304
     */
305
    static MeasureUnit *createSquareInch(UErrorCode &status);
306
307
    /**
308
     * Returns unit of area: square-kilometer.
309
     * Caller owns returned value and must free it.
310
     * @param status ICU error code.
311
     * @stable ICU 53
312
     */
313
    static MeasureUnit *createSquareKilometer(UErrorCode &status);
314
315
    /**
316
     * Returns unit of area: square-meter.
317
     * Caller owns returned value and must free it.
318
     * @param status ICU error code.
319
     * @stable ICU 53
320
     */
321
    static MeasureUnit *createSquareMeter(UErrorCode &status);
322
323
    /**
324
     * Returns unit of area: square-mile.
325
     * Caller owns returned value and must free it.
326
     * @param status ICU error code.
327
     * @stable ICU 53
328
     */
329
    static MeasureUnit *createSquareMile(UErrorCode &status);
330
331
    /**
332
     * Returns unit of area: square-yard.
333
     * Caller owns returned value and must free it.
334
     * @param status ICU error code.
335
     * @stable ICU 54
336
     */
337
    static MeasureUnit *createSquareYard(UErrorCode &status);
338
339
    /**
340
     * Returns unit of concentr: karat.
341
     * Caller owns returned value and must free it.
342
     * @param status ICU error code.
343
     * @stable ICU 54
344
     */
345
    static MeasureUnit *createKarat(UErrorCode &status);
346
347
    /**
348
     * Returns unit of concentr: milligram-per-deciliter.
349
     * Caller owns returned value and must free it.
350
     * @param status ICU error code.
351
     * @stable ICU 57
352
     */
353
    static MeasureUnit *createMilligramPerDeciliter(UErrorCode &status);
354
355
    /**
356
     * Returns unit of concentr: millimole-per-liter.
357
     * Caller owns returned value and must free it.
358
     * @param status ICU error code.
359
     * @stable ICU 57
360
     */
361
    static MeasureUnit *createMillimolePerLiter(UErrorCode &status);
362
363
    /**
364
     * Returns unit of concentr: part-per-million.
365
     * Caller owns returned value and must free it.
366
     * @param status ICU error code.
367
     * @stable ICU 57
368
     */
369
    static MeasureUnit *createPartPerMillion(UErrorCode &status);
370
371
    /**
372
     * Returns unit of consumption: liter-per-100kilometers.
373
     * Caller owns returned value and must free it.
374
     * @param status ICU error code.
375
     * @stable ICU 56
376
     */
377
    static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status);
378
379
    /**
380
     * Returns unit of consumption: liter-per-kilometer.
381
     * Caller owns returned value and must free it.
382
     * @param status ICU error code.
383
     * @stable ICU 54
384
     */
385
    static MeasureUnit *createLiterPerKilometer(UErrorCode &status);
386
387
    /**
388
     * Returns unit of consumption: mile-per-gallon.
389
     * Caller owns returned value and must free it.
390
     * @param status ICU error code.
391
     * @stable ICU 54
392
     */
393
    static MeasureUnit *createMilePerGallon(UErrorCode &status);
394
395
    /**
396
     * Returns unit of consumption: mile-per-gallon-imperial.
397
     * Caller owns returned value and must free it.
398
     * @param status ICU error code.
399
     * @stable ICU 57
400
     */
401
    static MeasureUnit *createMilePerGallonImperial(UErrorCode &status);
402
403
    /**
404
     * Returns unit of digital: bit.
405
     * Caller owns returned value and must free it.
406
     * @param status ICU error code.
407
     * @stable ICU 54
408
     */
409
    static MeasureUnit *createBit(UErrorCode &status);
410
411
    /**
412
     * Returns unit of digital: byte.
413
     * Caller owns returned value and must free it.
414
     * @param status ICU error code.
415
     * @stable ICU 54
416
     */
417
    static MeasureUnit *createByte(UErrorCode &status);
418
419
    /**
420
     * Returns unit of digital: gigabit.
421
     * Caller owns returned value and must free it.
422
     * @param status ICU error code.
423
     * @stable ICU 54
424
     */
425
    static MeasureUnit *createGigabit(UErrorCode &status);
426
427
    /**
428
     * Returns unit of digital: gigabyte.
429
     * Caller owns returned value and must free it.
430
     * @param status ICU error code.
431
     * @stable ICU 54
432
     */
433
    static MeasureUnit *createGigabyte(UErrorCode &status);
434
435
    /**
436
     * Returns unit of digital: kilobit.
437
     * Caller owns returned value and must free it.
438
     * @param status ICU error code.
439
     * @stable ICU 54
440
     */
441
    static MeasureUnit *createKilobit(UErrorCode &status);
442
443
    /**
444
     * Returns unit of digital: kilobyte.
445
     * Caller owns returned value and must free it.
446
     * @param status ICU error code.
447
     * @stable ICU 54
448
     */
449
    static MeasureUnit *createKilobyte(UErrorCode &status);
450
451
    /**
452
     * Returns unit of digital: megabit.
453
     * Caller owns returned value and must free it.
454
     * @param status ICU error code.
455
     * @stable ICU 54
456
     */
457
    static MeasureUnit *createMegabit(UErrorCode &status);
458
459
    /**
460
     * Returns unit of digital: megabyte.
461
     * Caller owns returned value and must free it.
462
     * @param status ICU error code.
463
     * @stable ICU 54
464
     */
465
    static MeasureUnit *createMegabyte(UErrorCode &status);
466
467
    /**
468
     * Returns unit of digital: terabit.
469
     * Caller owns returned value and must free it.
470
     * @param status ICU error code.
471
     * @stable ICU 54
472
     */
473
    static MeasureUnit *createTerabit(UErrorCode &status);
474
475
    /**
476
     * Returns unit of digital: terabyte.
477
     * Caller owns returned value and must free it.
478
     * @param status ICU error code.
479
     * @stable ICU 54
480
     */
481
    static MeasureUnit *createTerabyte(UErrorCode &status);
482
483
    /**
484
     * Returns unit of duration: century.
485
     * Caller owns returned value and must free it.
486
     * @param status ICU error code.
487
     * @stable ICU 56
488
     */
489
    static MeasureUnit *createCentury(UErrorCode &status);
490
491
    /**
492
     * Returns unit of duration: day.
493
     * Caller owns returned value and must free it.
494
     * @param status ICU error code.
495
     * @stable ICU 53
496
     */
497
    static MeasureUnit *createDay(UErrorCode &status);
498
499
    /**
500
     * Returns unit of duration: hour.
501
     * Caller owns returned value and must free it.
502
     * @param status ICU error code.
503
     * @stable ICU 53
504
     */
505
    static MeasureUnit *createHour(UErrorCode &status);
506
507
    /**
508
     * Returns unit of duration: microsecond.
509
     * Caller owns returned value and must free it.
510
     * @param status ICU error code.
511
     * @stable ICU 54
512
     */
513
    static MeasureUnit *createMicrosecond(UErrorCode &status);
514
515
    /**
516
     * Returns unit of duration: millisecond.
517
     * Caller owns returned value and must free it.
518
     * @param status ICU error code.
519
     * @stable ICU 53
520
     */
521
    static MeasureUnit *createMillisecond(UErrorCode &status);
522
523
    /**
524
     * Returns unit of duration: minute.
525
     * Caller owns returned value and must free it.
526
     * @param status ICU error code.
527
     * @stable ICU 53
528
     */
529
    static MeasureUnit *createMinute(UErrorCode &status);
530
531
    /**
532
     * Returns unit of duration: month.
533
     * Caller owns returned value and must free it.
534
     * @param status ICU error code.
535
     * @stable ICU 53
536
     */
537
    static MeasureUnit *createMonth(UErrorCode &status);
538
539
    /**
540
     * Returns unit of duration: nanosecond.
541
     * Caller owns returned value and must free it.
542
     * @param status ICU error code.
543
     * @stable ICU 54
544
     */
545
    static MeasureUnit *createNanosecond(UErrorCode &status);
546
547
    /**
548
     * Returns unit of duration: second.
549
     * Caller owns returned value and must free it.
550
     * @param status ICU error code.
551
     * @stable ICU 53
552
     */
553
    static MeasureUnit *createSecond(UErrorCode &status);
554
555
    /**
556
     * Returns unit of duration: week.
557
     * Caller owns returned value and must free it.
558
     * @param status ICU error code.
559
     * @stable ICU 53
560
     */
561
    static MeasureUnit *createWeek(UErrorCode &status);
562
563
    /**
564
     * Returns unit of duration: year.
565
     * Caller owns returned value and must free it.
566
     * @param status ICU error code.
567
     * @stable ICU 53
568
     */
569
    static MeasureUnit *createYear(UErrorCode &status);
570
571
    /**
572
     * Returns unit of electric: ampere.
573
     * Caller owns returned value and must free it.
574
     * @param status ICU error code.
575
     * @stable ICU 54
576
     */
577
    static MeasureUnit *createAmpere(UErrorCode &status);
578
579
    /**
580
     * Returns unit of electric: milliampere.
581
     * Caller owns returned value and must free it.
582
     * @param status ICU error code.
583
     * @stable ICU 54
584
     */
585
    static MeasureUnit *createMilliampere(UErrorCode &status);
586
587
    /**
588
     * Returns unit of electric: ohm.
589
     * Caller owns returned value and must free it.
590
     * @param status ICU error code.
591
     * @stable ICU 54
592
     */
593
    static MeasureUnit *createOhm(UErrorCode &status);
594
595
    /**
596
     * Returns unit of electric: volt.
597
     * Caller owns returned value and must free it.
598
     * @param status ICU error code.
599
     * @stable ICU 54
600
     */
601
    static MeasureUnit *createVolt(UErrorCode &status);
602
603
    /**
604
     * Returns unit of energy: calorie.
605
     * Caller owns returned value and must free it.
606
     * @param status ICU error code.
607
     * @stable ICU 54
608
     */
609
    static MeasureUnit *createCalorie(UErrorCode &status);
610
611
    /**
612
     * Returns unit of energy: foodcalorie.
613
     * Caller owns returned value and must free it.
614
     * @param status ICU error code.
615
     * @stable ICU 54
616
     */
617
    static MeasureUnit *createFoodcalorie(UErrorCode &status);
618
619
    /**
620
     * Returns unit of energy: joule.
621
     * Caller owns returned value and must free it.
622
     * @param status ICU error code.
623
     * @stable ICU 54
624
     */
625
    static MeasureUnit *createJoule(UErrorCode &status);
626
627
    /**
628
     * Returns unit of energy: kilocalorie.
629
     * Caller owns returned value and must free it.
630
     * @param status ICU error code.
631
     * @stable ICU 54
632
     */
633
    static MeasureUnit *createKilocalorie(UErrorCode &status);
634
635
    /**
636
     * Returns unit of energy: kilojoule.
637
     * Caller owns returned value and must free it.
638
     * @param status ICU error code.
639
     * @stable ICU 54
640
     */
641
    static MeasureUnit *createKilojoule(UErrorCode &status);
642
643
    /**
644
     * Returns unit of energy: kilowatt-hour.
645
     * Caller owns returned value and must free it.
646
     * @param status ICU error code.
647
     * @stable ICU 54
648
     */
649
    static MeasureUnit *createKilowattHour(UErrorCode &status);
650
651
    /**
652
     * Returns unit of frequency: gigahertz.
653
     * Caller owns returned value and must free it.
654
     * @param status ICU error code.
655
     * @stable ICU 54
656
     */
657
    static MeasureUnit *createGigahertz(UErrorCode &status);
658
659
    /**
660
     * Returns unit of frequency: hertz.
661
     * Caller owns returned value and must free it.
662
     * @param status ICU error code.
663
     * @stable ICU 54
664
     */
665
    static MeasureUnit *createHertz(UErrorCode &status);
666
667
    /**
668
     * Returns unit of frequency: kilohertz.
669
     * Caller owns returned value and must free it.
670
     * @param status ICU error code.
671
     * @stable ICU 54
672
     */
673
    static MeasureUnit *createKilohertz(UErrorCode &status);
674
675
    /**
676
     * Returns unit of frequency: megahertz.
677
     * Caller owns returned value and must free it.
678
     * @param status ICU error code.
679
     * @stable ICU 54
680
     */
681
    static MeasureUnit *createMegahertz(UErrorCode &status);
682
683
    /**
684
     * Returns unit of length: astronomical-unit.
685
     * Caller owns returned value and must free it.
686
     * @param status ICU error code.
687
     * @stable ICU 54
688
     */
689
    static MeasureUnit *createAstronomicalUnit(UErrorCode &status);
690
691
    /**
692
     * Returns unit of length: centimeter.
693
     * Caller owns returned value and must free it.
694
     * @param status ICU error code.
695
     * @stable ICU 53
696
     */
697
    static MeasureUnit *createCentimeter(UErrorCode &status);
698
699
    /**
700
     * Returns unit of length: decimeter.
701
     * Caller owns returned value and must free it.
702
     * @param status ICU error code.
703
     * @stable ICU 54
704
     */
705
    static MeasureUnit *createDecimeter(UErrorCode &status);
706
707
    /**
708
     * Returns unit of length: fathom.
709
     * Caller owns returned value and must free it.
710
     * @param status ICU error code.
711
     * @stable ICU 54
712
     */
713
    static MeasureUnit *createFathom(UErrorCode &status);
714
715
    /**
716
     * Returns unit of length: foot.
717
     * Caller owns returned value and must free it.
718
     * @param status ICU error code.
719
     * @stable ICU 53
720
     */
721
    static MeasureUnit *createFoot(UErrorCode &status);
722
723
    /**
724
     * Returns unit of length: furlong.
725
     * Caller owns returned value and must free it.
726
     * @param status ICU error code.
727
     * @stable ICU 54
728
     */
729
    static MeasureUnit *createFurlong(UErrorCode &status);
730
731
    /**
732
     * Returns unit of length: inch.
733
     * Caller owns returned value and must free it.
734
     * @param status ICU error code.
735
     * @stable ICU 53
736
     */
737
    static MeasureUnit *createInch(UErrorCode &status);
738
739
    /**
740
     * Returns unit of length: kilometer.
741
     * Caller owns returned value and must free it.
742
     * @param status ICU error code.
743
     * @stable ICU 53
744
     */
745
    static MeasureUnit *createKilometer(UErrorCode &status);
746
747
    /**
748
     * Returns unit of length: light-year.
749
     * Caller owns returned value and must free it.
750
     * @param status ICU error code.
751
     * @stable ICU 53
752
     */
753
    static MeasureUnit *createLightYear(UErrorCode &status);
754
755
    /**
756
     * Returns unit of length: meter.
757
     * Caller owns returned value and must free it.
758
     * @param status ICU error code.
759
     * @stable ICU 53
760
     */
761
    static MeasureUnit *createMeter(UErrorCode &status);
762
763
    /**
764
     * Returns unit of length: micrometer.
765
     * Caller owns returned value and must free it.
766
     * @param status ICU error code.
767
     * @stable ICU 54
768
     */
769
    static MeasureUnit *createMicrometer(UErrorCode &status);
770
771
    /**
772
     * Returns unit of length: mile.
773
     * Caller owns returned value and must free it.
774
     * @param status ICU error code.
775
     * @stable ICU 53
776
     */
777
    static MeasureUnit *createMile(UErrorCode &status);
778
779
    /**
780
     * Returns unit of length: mile-scandinavian.
781
     * Caller owns returned value and must free it.
782
     * @param status ICU error code.
783
     * @stable ICU 56
784
     */
785
    static MeasureUnit *createMileScandinavian(UErrorCode &status);
786
787
    /**
788
     * Returns unit of length: millimeter.
789
     * Caller owns returned value and must free it.
790
     * @param status ICU error code.
791
     * @stable ICU 53
792
     */
793
    static MeasureUnit *createMillimeter(UErrorCode &status);
794
795
    /**
796
     * Returns unit of length: nanometer.
797
     * Caller owns returned value and must free it.
798
     * @param status ICU error code.
799
     * @stable ICU 54
800
     */
801
    static MeasureUnit *createNanometer(UErrorCode &status);
802
803
    /**
804
     * Returns unit of length: nautical-mile.
805
     * Caller owns returned value and must free it.
806
     * @param status ICU error code.
807
     * @stable ICU 54
808
     */
809
    static MeasureUnit *createNauticalMile(UErrorCode &status);
810
811
    /**
812
     * Returns unit of length: parsec.
813
     * Caller owns returned value and must free it.
814
     * @param status ICU error code.
815
     * @stable ICU 54
816
     */
817
    static MeasureUnit *createParsec(UErrorCode &status);
818
819
    /**
820
     * Returns unit of length: picometer.
821
     * Caller owns returned value and must free it.
822
     * @param status ICU error code.
823
     * @stable ICU 53
824
     */
825
    static MeasureUnit *createPicometer(UErrorCode &status);
826
827
    /**
828
     * Returns unit of length: point.
829
     * Caller owns returned value and must free it.
830
     * @param status ICU error code.
831
     * @stable ICU 59
832
     */
833
    static MeasureUnit *createPoint(UErrorCode &status);
834
835
    /**
836
     * Returns unit of length: yard.
837
     * Caller owns returned value and must free it.
838
     * @param status ICU error code.
839
     * @stable ICU 53
840
     */
841
    static MeasureUnit *createYard(UErrorCode &status);
842
843
    /**
844
     * Returns unit of light: lux.
845
     * Caller owns returned value and must free it.
846
     * @param status ICU error code.
847
     * @stable ICU 54
848
     */
849
    static MeasureUnit *createLux(UErrorCode &status);
850
851
    /**
852
     * Returns unit of mass: carat.
853
     * Caller owns returned value and must free it.
854
     * @param status ICU error code.
855
     * @stable ICU 54
856
     */
857
    static MeasureUnit *createCarat(UErrorCode &status);
858
859
    /**
860
     * Returns unit of mass: gram.
861
     * Caller owns returned value and must free it.
862
     * @param status ICU error code.
863
     * @stable ICU 53
864
     */
865
    static MeasureUnit *createGram(UErrorCode &status);
866
867
    /**
868
     * Returns unit of mass: kilogram.
869
     * Caller owns returned value and must free it.
870
     * @param status ICU error code.
871
     * @stable ICU 53
872
     */
873
    static MeasureUnit *createKilogram(UErrorCode &status);
874
875
    /**
876
     * Returns unit of mass: metric-ton.
877
     * Caller owns returned value and must free it.
878
     * @param status ICU error code.
879
     * @stable ICU 54
880
     */
881
    static MeasureUnit *createMetricTon(UErrorCode &status);
882
883
    /**
884
     * Returns unit of mass: microgram.
885
     * Caller owns returned value and must free it.
886
     * @param status ICU error code.
887
     * @stable ICU 54
888
     */
889
    static MeasureUnit *createMicrogram(UErrorCode &status);
890
891
    /**
892
     * Returns unit of mass: milligram.
893
     * Caller owns returned value and must free it.
894
     * @param status ICU error code.
895
     * @stable ICU 54
896
     */
897
    static MeasureUnit *createMilligram(UErrorCode &status);
898
899
    /**
900
     * Returns unit of mass: ounce.
901
     * Caller owns returned value and must free it.
902
     * @param status ICU error code.
903
     * @stable ICU 53
904
     */
905
    static MeasureUnit *createOunce(UErrorCode &status);
906
907
    /**
908
     * Returns unit of mass: ounce-troy.
909
     * Caller owns returned value and must free it.
910
     * @param status ICU error code.
911
     * @stable ICU 54
912
     */
913
    static MeasureUnit *createOunceTroy(UErrorCode &status);
914
915
    /**
916
     * Returns unit of mass: pound.
917
     * Caller owns returned value and must free it.
918
     * @param status ICU error code.
919
     * @stable ICU 53
920
     */
921
    static MeasureUnit *createPound(UErrorCode &status);
922
923
    /**
924
     * Returns unit of mass: stone.
925
     * Caller owns returned value and must free it.
926
     * @param status ICU error code.
927
     * @stable ICU 54
928
     */
929
    static MeasureUnit *createStone(UErrorCode &status);
930
931
    /**
932
     * Returns unit of mass: ton.
933
     * Caller owns returned value and must free it.
934
     * @param status ICU error code.
935
     * @stable ICU 54
936
     */
937
    static MeasureUnit *createTon(UErrorCode &status);
938
939
    /**
940
     * Returns unit of power: gigawatt.
941
     * Caller owns returned value and must free it.
942
     * @param status ICU error code.
943
     * @stable ICU 54
944
     */
945
    static MeasureUnit *createGigawatt(UErrorCode &status);
946
947
    /**
948
     * Returns unit of power: horsepower.
949
     * Caller owns returned value and must free it.
950
     * @param status ICU error code.
951
     * @stable ICU 53
952
     */
953
    static MeasureUnit *createHorsepower(UErrorCode &status);
954
955
    /**
956
     * Returns unit of power: kilowatt.
957
     * Caller owns returned value and must free it.
958
     * @param status ICU error code.
959
     * @stable ICU 53
960
     */
961
    static MeasureUnit *createKilowatt(UErrorCode &status);
962
963
    /**
964
     * Returns unit of power: megawatt.
965
     * Caller owns returned value and must free it.
966
     * @param status ICU error code.
967
     * @stable ICU 54
968
     */
969
    static MeasureUnit *createMegawatt(UErrorCode &status);
970
971
    /**
972
     * Returns unit of power: milliwatt.
973
     * Caller owns returned value and must free it.
974
     * @param status ICU error code.
975
     * @stable ICU 54
976
     */
977
    static MeasureUnit *createMilliwatt(UErrorCode &status);
978
979
    /**
980
     * Returns unit of power: watt.
981
     * Caller owns returned value and must free it.
982
     * @param status ICU error code.
983
     * @stable ICU 53
984
     */
985
    static MeasureUnit *createWatt(UErrorCode &status);
986
987
    /**
988
     * Returns unit of pressure: hectopascal.
989
     * Caller owns returned value and must free it.
990
     * @param status ICU error code.
991
     * @stable ICU 53
992
     */
993
    static MeasureUnit *createHectopascal(UErrorCode &status);
994
995
    /**
996
     * Returns unit of pressure: inch-hg.
997
     * Caller owns returned value and must free it.
998
     * @param status ICU error code.
999
     * @stable ICU 53
1000
     */
1001
    static MeasureUnit *createInchHg(UErrorCode &status);
1002
1003
    /**
1004
     * Returns unit of pressure: millibar.
1005
     * Caller owns returned value and must free it.
1006
     * @param status ICU error code.
1007
     * @stable ICU 53
1008
     */
1009
    static MeasureUnit *createMillibar(UErrorCode &status);
1010
1011
    /**
1012
     * Returns unit of pressure: millimeter-of-mercury.
1013
     * Caller owns returned value and must free it.
1014
     * @param status ICU error code.
1015
     * @stable ICU 54
1016
     */
1017
    static MeasureUnit *createMillimeterOfMercury(UErrorCode &status);
1018
1019
    /**
1020
     * Returns unit of pressure: pound-per-square-inch.
1021
     * Caller owns returned value and must free it.
1022
     * @param status ICU error code.
1023
     * @stable ICU 54
1024
     */
1025
    static MeasureUnit *createPoundPerSquareInch(UErrorCode &status);
1026
1027
    /**
1028
     * Returns unit of speed: kilometer-per-hour.
1029
     * Caller owns returned value and must free it.
1030
     * @param status ICU error code.
1031
     * @stable ICU 53
1032
     */
1033
    static MeasureUnit *createKilometerPerHour(UErrorCode &status);
1034
1035
    /**
1036
     * Returns unit of speed: knot.
1037
     * Caller owns returned value and must free it.
1038
     * @param status ICU error code.
1039
     * @stable ICU 56
1040
     */
1041
    static MeasureUnit *createKnot(UErrorCode &status);
1042
1043
    /**
1044
     * Returns unit of speed: meter-per-second.
1045
     * Caller owns returned value and must free it.
1046
     * @param status ICU error code.
1047
     * @stable ICU 53
1048
     */
1049
    static MeasureUnit *createMeterPerSecond(UErrorCode &status);
1050
1051
    /**
1052
     * Returns unit of speed: mile-per-hour.
1053
     * Caller owns returned value and must free it.
1054
     * @param status ICU error code.
1055
     * @stable ICU 53
1056
     */
1057
    static MeasureUnit *createMilePerHour(UErrorCode &status);
1058
1059
    /**
1060
     * Returns unit of temperature: celsius.
1061
     * Caller owns returned value and must free it.
1062
     * @param status ICU error code.
1063
     * @stable ICU 53
1064
     */
1065
    static MeasureUnit *createCelsius(UErrorCode &status);
1066
1067
    /**
1068
     * Returns unit of temperature: fahrenheit.
1069
     * Caller owns returned value and must free it.
1070
     * @param status ICU error code.
1071
     * @stable ICU 53
1072
     */
1073
    static MeasureUnit *createFahrenheit(UErrorCode &status);
1074
1075
    /**
1076
     * Returns unit of temperature: generic.
1077
     * Caller owns returned value and must free it.
1078
     * @param status ICU error code.
1079
     * @stable ICU 56
1080
     */
1081
    static MeasureUnit *createGenericTemperature(UErrorCode &status);
1082
1083
    /**
1084
     * Returns unit of temperature: kelvin.
1085
     * Caller owns returned value and must free it.
1086
     * @param status ICU error code.
1087
     * @stable ICU 54
1088
     */
1089
    static MeasureUnit *createKelvin(UErrorCode &status);
1090
1091
    /**
1092
     * Returns unit of volume: acre-foot.
1093
     * Caller owns returned value and must free it.
1094
     * @param status ICU error code.
1095
     * @stable ICU 54
1096
     */
1097
    static MeasureUnit *createAcreFoot(UErrorCode &status);
1098
1099
    /**
1100
     * Returns unit of volume: bushel.
1101
     * Caller owns returned value and must free it.
1102
     * @param status ICU error code.
1103
     * @stable ICU 54
1104
     */
1105
    static MeasureUnit *createBushel(UErrorCode &status);
1106
1107
    /**
1108
     * Returns unit of volume: centiliter.
1109
     * Caller owns returned value and must free it.
1110
     * @param status ICU error code.
1111
     * @stable ICU 54
1112
     */
1113
    static MeasureUnit *createCentiliter(UErrorCode &status);
1114
1115
    /**
1116
     * Returns unit of volume: cubic-centimeter.
1117
     * Caller owns returned value and must free it.
1118
     * @param status ICU error code.
1119
     * @stable ICU 54
1120
     */
1121
    static MeasureUnit *createCubicCentimeter(UErrorCode &status);
1122
1123
    /**
1124
     * Returns unit of volume: cubic-foot.
1125
     * Caller owns returned value and must free it.
1126
     * @param status ICU error code.
1127
     * @stable ICU 54
1128
     */
1129
    static MeasureUnit *createCubicFoot(UErrorCode &status);
1130
1131
    /**
1132
     * Returns unit of volume: cubic-inch.
1133
     * Caller owns returned value and must free it.
1134
     * @param status ICU error code.
1135
     * @stable ICU 54
1136
     */
1137
    static MeasureUnit *createCubicInch(UErrorCode &status);
1138
1139
    /**
1140
     * Returns unit of volume: cubic-kilometer.
1141
     * Caller owns returned value and must free it.
1142
     * @param status ICU error code.
1143
     * @stable ICU 53
1144
     */
1145
    static MeasureUnit *createCubicKilometer(UErrorCode &status);
1146
1147
    /**
1148
     * Returns unit of volume: cubic-meter.
1149
     * Caller owns returned value and must free it.
1150
     * @param status ICU error code.
1151
     * @stable ICU 54
1152
     */
1153
    static MeasureUnit *createCubicMeter(UErrorCode &status);
1154
1155
    /**
1156
     * Returns unit of volume: cubic-mile.
1157
     * Caller owns returned value and must free it.
1158
     * @param status ICU error code.
1159
     * @stable ICU 53
1160
     */
1161
    static MeasureUnit *createCubicMile(UErrorCode &status);
1162
1163
    /**
1164
     * Returns unit of volume: cubic-yard.
1165
     * Caller owns returned value and must free it.
1166
     * @param status ICU error code.
1167
     * @stable ICU 54
1168
     */
1169
    static MeasureUnit *createCubicYard(UErrorCode &status);
1170
1171
    /**
1172
     * Returns unit of volume: cup.
1173
     * Caller owns returned value and must free it.
1174
     * @param status ICU error code.
1175
     * @stable ICU 54
1176
     */
1177
    static MeasureUnit *createCup(UErrorCode &status);
1178
1179
    /**
1180
     * Returns unit of volume: cup-metric.
1181
     * Caller owns returned value and must free it.
1182
     * @param status ICU error code.
1183
     * @stable ICU 56
1184
     */
1185
    static MeasureUnit *createCupMetric(UErrorCode &status);
1186
1187
    /**
1188
     * Returns unit of volume: deciliter.
1189
     * Caller owns returned value and must free it.
1190
     * @param status ICU error code.
1191
     * @stable ICU 54
1192
     */
1193
    static MeasureUnit *createDeciliter(UErrorCode &status);
1194
1195
    /**
1196
     * Returns unit of volume: fluid-ounce.
1197
     * Caller owns returned value and must free it.
1198
     * @param status ICU error code.
1199
     * @stable ICU 54
1200
     */
1201
    static MeasureUnit *createFluidOunce(UErrorCode &status);
1202
1203
    /**
1204
     * Returns unit of volume: gallon.
1205
     * Caller owns returned value and must free it.
1206
     * @param status ICU error code.
1207
     * @stable ICU 54
1208
     */
1209
    static MeasureUnit *createGallon(UErrorCode &status);
1210
1211
    /**
1212
     * Returns unit of volume: gallon-imperial.
1213
     * Caller owns returned value and must free it.
1214
     * @param status ICU error code.
1215
     * @stable ICU 57
1216
     */
1217
    static MeasureUnit *createGallonImperial(UErrorCode &status);
1218
1219
    /**
1220
     * Returns unit of volume: hectoliter.
1221
     * Caller owns returned value and must free it.
1222
     * @param status ICU error code.
1223
     * @stable ICU 54
1224
     */
1225
    static MeasureUnit *createHectoliter(UErrorCode &status);
1226
1227
    /**
1228
     * Returns unit of volume: liter.
1229
     * Caller owns returned value and must free it.
1230
     * @param status ICU error code.
1231
     * @stable ICU 53
1232
     */
1233
    static MeasureUnit *createLiter(UErrorCode &status);
1234
1235
    /**
1236
     * Returns unit of volume: megaliter.
1237
     * Caller owns returned value and must free it.
1238
     * @param status ICU error code.
1239
     * @stable ICU 54
1240
     */
1241
    static MeasureUnit *createMegaliter(UErrorCode &status);
1242
1243
    /**
1244
     * Returns unit of volume: milliliter.
1245
     * Caller owns returned value and must free it.
1246
     * @param status ICU error code.
1247
     * @stable ICU 54
1248
     */
1249
    static MeasureUnit *createMilliliter(UErrorCode &status);
1250
1251
    /**
1252
     * Returns unit of volume: pint.
1253
     * Caller owns returned value and must free it.
1254
     * @param status ICU error code.
1255
     * @stable ICU 54
1256
     */
1257
    static MeasureUnit *createPint(UErrorCode &status);
1258
1259
    /**
1260
     * Returns unit of volume: pint-metric.
1261
     * Caller owns returned value and must free it.
1262
     * @param status ICU error code.
1263
     * @stable ICU 56
1264
     */
1265
    static MeasureUnit *createPintMetric(UErrorCode &status);
1266
1267
    /**
1268
     * Returns unit of volume: quart.
1269
     * Caller owns returned value and must free it.
1270
     * @param status ICU error code.
1271
     * @stable ICU 54
1272
     */
1273
    static MeasureUnit *createQuart(UErrorCode &status);
1274
1275
    /**
1276
     * Returns unit of volume: tablespoon.
1277
     * Caller owns returned value and must free it.
1278
     * @param status ICU error code.
1279
     * @stable ICU 54
1280
     */
1281
    static MeasureUnit *createTablespoon(UErrorCode &status);
1282
1283
    /**
1284
     * Returns unit of volume: teaspoon.
1285
     * Caller owns returned value and must free it.
1286
     * @param status ICU error code.
1287
     * @stable ICU 54
1288
     */
1289
    static MeasureUnit *createTeaspoon(UErrorCode &status);
1290
1291
1292
// End generated createXXX methods
1293
1294
 protected:
1295
1296
#ifndef U_HIDE_INTERNAL_API
1297
    /**
1298
     * For ICU use only.
1299
     * @internal
1300
     */
1301
    void initTime(const char *timeId);
1302
1303
    /**
1304
     * For ICU use only.
1305
     * @internal
1306
     */
1307
    void initCurrency(const char *isoCurrency);
1308
1309
    /**
1310
     * For ICU use only.
1311
     * @internal
1312
     */
1313
    void initNoUnit(const char *subtype);
1314
1315
#endif  /* U_HIDE_INTERNAL_API */
1316
1317
private:
1318
    int32_t fTypeId;
1319
    int32_t fSubTypeId;
1320
    char fCurrency[4];
1321
1322
    MeasureUnit(int32_t typeId, int32_t subTypeId) : fTypeId(typeId), fSubTypeId(subTypeId) {
1323
        fCurrency[0] = 0;
1324
    }
1325
    void setTo(int32_t typeId, int32_t subTypeId);
1326
    int32_t getOffset() const;
1327
    static MeasureUnit *create(int typeId, int subTypeId, UErrorCode &status);
1328
};
1329
1330
U_NAMESPACE_END
1331
1332
#endif // !UNCONFIG_NO_FORMATTING
1333
#endif // __MEASUREUNIT_H__