ICU 56.1: measunit.h Source File

ICU 56.1 56.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

measunit.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (c) 2004-2015, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 * Author: Alan Liu
7 * Created: April 26, 2004
8 * Since: ICU 3.0
9 **********************************************************************
10 */
11 #ifndef __MEASUREUNIT_H__
12 #define __MEASUREUNIT_H__
13
14 #include "unicode/utypes.h"
15
16 #if !UCONFIG_NO_FORMATTING
17
18 #include "unicode/unistr.h"
19
25 U_NAMESPACE_BEGIN
26
27 class StringEnumeration;
28
36 class U_I18N_API MeasureUnit: public UObject {
37 public:
38
43 MeasureUnit() : fTypeId(0), fSubTypeId(0) {
44 fCurrency[0] = 0;
45 }
46
51 MeasureUnit(const MeasureUnit &other);
52
57 MeasureUnit &operator=(const MeasureUnit &other);
58
64 virtual UObject* clone() const;
65
70 virtual ~MeasureUnit();
71
77 virtual UBool operator==(const UObject& other) const;
78
84 UBool operator!=(const UObject& other) const {
85 return !(*this == other);
86 }
87
92 const char *getType() const;
93
98 const char *getSubtype() const;
99
111 static int32_t getAvailable(
112 MeasureUnit *destArray,
113 int32_t destCapacity,
114 UErrorCode &errorCode);
115
128 static int32_t getAvailable(
129 const char *type,
130 MeasureUnit *destArray,
131 int32_t destCapacity,
132 UErrorCode &errorCode);
133
142 static StringEnumeration* getAvailableTypes(UErrorCode &errorCode);
143
155 static UClassID U_EXPORT2 getStaticClassID(void);
156
168 virtual UClassID getDynamicClassID(void) const;
169
170 #ifndef U_HIDE_INTERNAL_API
171
177 int32_t getIndex() const;
178
184 static int32_t getIndexCount();
185
190 static MeasureUnit *resolveUnitPerUnit(
191 const MeasureUnit &unit, const MeasureUnit &perUnit);
192 #endif /* U_HIDE_INTERNAL_API */
193
194 // All code between the "Start generated createXXX methods" comment and
195 // the "End generated createXXX methods" comment is auto generated code
196 // and must not be edited manually. For instructions on how to correctly
197 // update this code, refer to:
198 // http://site.icu-project.org/design/formatting/measureformat/updating-measure-unit
199 //
200 // Start generated createXXX methods
201
208 static MeasureUnit *createGForce(UErrorCode &status);
209
216 static MeasureUnit *createMeterPerSecondSquared(UErrorCode &status);
217
224 static MeasureUnit *createArcMinute(UErrorCode &status);
225
232 static MeasureUnit *createArcSecond(UErrorCode &status);
233
240 static MeasureUnit *createDegree(UErrorCode &status);
241
248 static MeasureUnit *createRadian(UErrorCode &status);
249
250 #ifndef U_HIDE_DRAFT_API
251
257 static MeasureUnit *createRevolutionAngle(UErrorCode &status);
258 #endif /* U_HIDE_DRAFT_API */
259
266 static MeasureUnit *createAcre(UErrorCode &status);
267
274 static MeasureUnit *createHectare(UErrorCode &status);
275
282 static MeasureUnit *createSquareCentimeter(UErrorCode &status);
283
290 static MeasureUnit *createSquareFoot(UErrorCode &status);
291
298 static MeasureUnit *createSquareInch(UErrorCode &status);
299
306 static MeasureUnit *createSquareKilometer(UErrorCode &status);
307
314 static MeasureUnit *createSquareMeter(UErrorCode &status);
315
322 static MeasureUnit *createSquareMile(UErrorCode &status);
323
330 static MeasureUnit *createSquareYard(UErrorCode &status);
331
332 #ifndef U_HIDE_DRAFT_API
333
339 static MeasureUnit *createLiterPer100Kilometers(UErrorCode &status);
340 #endif /* U_HIDE_DRAFT_API */
341
348 static MeasureUnit *createLiterPerKilometer(UErrorCode &status);
349
356 static MeasureUnit *createMilePerGallon(UErrorCode &status);
357
364 static MeasureUnit *createBit(UErrorCode &status);
365
372 static MeasureUnit *createByte(UErrorCode &status);
373
380 static MeasureUnit *createGigabit(UErrorCode &status);
381
388 static MeasureUnit *createGigabyte(UErrorCode &status);
389
396 static MeasureUnit *createKilobit(UErrorCode &status);
397
404 static MeasureUnit *createKilobyte(UErrorCode &status);
405
412 static MeasureUnit *createMegabit(UErrorCode &status);
413
420 static MeasureUnit *createMegabyte(UErrorCode &status);
421
428 static MeasureUnit *createTerabit(UErrorCode &status);
429
436 static MeasureUnit *createTerabyte(UErrorCode &status);
437
438 #ifndef U_HIDE_DRAFT_API
439
445 static MeasureUnit *createCentury(UErrorCode &status);
446 #endif /* U_HIDE_DRAFT_API */
447
454 static MeasureUnit *createDay(UErrorCode &status);
455
462 static MeasureUnit *createHour(UErrorCode &status);
463
470 static MeasureUnit *createMicrosecond(UErrorCode &status);
471
478 static MeasureUnit *createMillisecond(UErrorCode &status);
479
486 static MeasureUnit *createMinute(UErrorCode &status);
487
494 static MeasureUnit *createMonth(UErrorCode &status);
495
502 static MeasureUnit *createNanosecond(UErrorCode &status);
503
510 static MeasureUnit *createSecond(UErrorCode &status);
511
518 static MeasureUnit *createWeek(UErrorCode &status);
519
526 static MeasureUnit *createYear(UErrorCode &status);
527
534 static MeasureUnit *createAmpere(UErrorCode &status);
535
542 static MeasureUnit *createMilliampere(UErrorCode &status);
543
550 static MeasureUnit *createOhm(UErrorCode &status);
551
558 static MeasureUnit *createVolt(UErrorCode &status);
559
566 static MeasureUnit *createCalorie(UErrorCode &status);
567
574 static MeasureUnit *createFoodcalorie(UErrorCode &status);
575
582 static MeasureUnit *createJoule(UErrorCode &status);
583
590 static MeasureUnit *createKilocalorie(UErrorCode &status);
591
598 static MeasureUnit *createKilojoule(UErrorCode &status);
599
606 static MeasureUnit *createKilowattHour(UErrorCode &status);
607
614 static MeasureUnit *createGigahertz(UErrorCode &status);
615
622 static MeasureUnit *createHertz(UErrorCode &status);
623
630 static MeasureUnit *createKilohertz(UErrorCode &status);
631
638 static MeasureUnit *createMegahertz(UErrorCode &status);
639
646 static MeasureUnit *createAstronomicalUnit(UErrorCode &status);
647
654 static MeasureUnit *createCentimeter(UErrorCode &status);
655
662 static MeasureUnit *createDecimeter(UErrorCode &status);
663
670 static MeasureUnit *createFathom(UErrorCode &status);
671
678 static MeasureUnit *createFoot(UErrorCode &status);
679
686 static MeasureUnit *createFurlong(UErrorCode &status);
687
694 static MeasureUnit *createInch(UErrorCode &status);
695
702 static MeasureUnit *createKilometer(UErrorCode &status);
703
710 static MeasureUnit *createLightYear(UErrorCode &status);
711
718 static MeasureUnit *createMeter(UErrorCode &status);
719
726 static MeasureUnit *createMicrometer(UErrorCode &status);
727
734 static MeasureUnit *createMile(UErrorCode &status);
735
736 #ifndef U_HIDE_DRAFT_API
737
743 static MeasureUnit *createMileScandinavian(UErrorCode &status);
744 #endif /* U_HIDE_DRAFT_API */
745
752 static MeasureUnit *createMillimeter(UErrorCode &status);
753
760 static MeasureUnit *createNanometer(UErrorCode &status);
761
768 static MeasureUnit *createNauticalMile(UErrorCode &status);
769
776 static MeasureUnit *createParsec(UErrorCode &status);
777
784 static MeasureUnit *createPicometer(UErrorCode &status);
785
792 static MeasureUnit *createYard(UErrorCode &status);
793
800 static MeasureUnit *createLux(UErrorCode &status);
801
808 static MeasureUnit *createCarat(UErrorCode &status);
809
816 static MeasureUnit *createGram(UErrorCode &status);
817
824 static MeasureUnit *createKilogram(UErrorCode &status);
825
832 static MeasureUnit *createMetricTon(UErrorCode &status);
833
840 static MeasureUnit *createMicrogram(UErrorCode &status);
841
848 static MeasureUnit *createMilligram(UErrorCode &status);
849
856 static MeasureUnit *createOunce(UErrorCode &status);
857
864 static MeasureUnit *createOunceTroy(UErrorCode &status);
865
872 static MeasureUnit *createPound(UErrorCode &status);
873
880 static MeasureUnit *createStone(UErrorCode &status);
881
888 static MeasureUnit *createTon(UErrorCode &status);
889
896 static MeasureUnit *createGigawatt(UErrorCode &status);
897
904 static MeasureUnit *createHorsepower(UErrorCode &status);
905
912 static MeasureUnit *createKilowatt(UErrorCode &status);
913
920 static MeasureUnit *createMegawatt(UErrorCode &status);
921
928 static MeasureUnit *createMilliwatt(UErrorCode &status);
929
936 static MeasureUnit *createWatt(UErrorCode &status);
937
944 static MeasureUnit *createHectopascal(UErrorCode &status);
945
952 static MeasureUnit *createInchHg(UErrorCode &status);
953
960 static MeasureUnit *createMillibar(UErrorCode &status);
961
968 static MeasureUnit *createMillimeterOfMercury(UErrorCode &status);
969
976 static MeasureUnit *createPoundPerSquareInch(UErrorCode &status);
977
984 static MeasureUnit *createKarat(UErrorCode &status);
985
992 static MeasureUnit *createKilometerPerHour(UErrorCode &status);
993
994 #ifndef U_HIDE_DRAFT_API
995
1001 static MeasureUnit *createKnot(UErrorCode &status);
1002 #endif /* U_HIDE_DRAFT_API */
1003
1010 static MeasureUnit *createMeterPerSecond(UErrorCode &status);
1011
1018 static MeasureUnit *createMilePerHour(UErrorCode &status);
1019
1026 static MeasureUnit *createCelsius(UErrorCode &status);
1027
1034 static MeasureUnit *createFahrenheit(UErrorCode &status);
1035
1036 #ifndef U_HIDE_DRAFT_API
1037
1043 static MeasureUnit *createGenericTemperature(UErrorCode &status);
1044 #endif /* U_HIDE_DRAFT_API */
1045
1052 static MeasureUnit *createKelvin(UErrorCode &status);
1053
1060 static MeasureUnit *createAcreFoot(UErrorCode &status);
1061
1068 static MeasureUnit *createBushel(UErrorCode &status);
1069
1076 static MeasureUnit *createCentiliter(UErrorCode &status);
1077
1084 static MeasureUnit *createCubicCentimeter(UErrorCode &status);
1085
1092 static MeasureUnit *createCubicFoot(UErrorCode &status);
1093
1100 static MeasureUnit *createCubicInch(UErrorCode &status);
1101
1108 static MeasureUnit *createCubicKilometer(UErrorCode &status);
1109
1116 static MeasureUnit *createCubicMeter(UErrorCode &status);
1117
1124 static MeasureUnit *createCubicMile(UErrorCode &status);
1125
1132 static MeasureUnit *createCubicYard(UErrorCode &status);
1133
1140 static MeasureUnit *createCup(UErrorCode &status);
1141
1142 #ifndef U_HIDE_DRAFT_API
1143
1149 static MeasureUnit *createCupMetric(UErrorCode &status);
1150 #endif /* U_HIDE_DRAFT_API */
1151
1158 static MeasureUnit *createDeciliter(UErrorCode &status);
1159
1166 static MeasureUnit *createFluidOunce(UErrorCode &status);
1167
1174 static MeasureUnit *createGallon(UErrorCode &status);
1175
1182 static MeasureUnit *createHectoliter(UErrorCode &status);
1183
1190 static MeasureUnit *createLiter(UErrorCode &status);
1191
1198 static MeasureUnit *createMegaliter(UErrorCode &status);
1199
1206 static MeasureUnit *createMilliliter(UErrorCode &status);
1207
1214 static MeasureUnit *createPint(UErrorCode &status);
1215
1216 #ifndef U_HIDE_DRAFT_API
1217
1223 static MeasureUnit *createPintMetric(UErrorCode &status);
1224 #endif /* U_HIDE_DRAFT_API */
1225
1232 static MeasureUnit *createQuart(UErrorCode &status);
1233
1240 static MeasureUnit *createTablespoon(UErrorCode &status);
1241
1248 static MeasureUnit *createTeaspoon(UErrorCode &status);
1249
1250
1251 // End generated createXXX methods
1252
1253 protected:
1254
1255 #ifndef U_HIDE_INTERNAL_API
1256
1260 void initTime(const char *timeId);
1261
1266 void initCurrency(const char *isoCurrency);
1267
1268 #endif /* U_HIDE_INTERNAL_API */
1269
1270 private:
1271 int32_t fTypeId;
1272 int32_t fSubTypeId;
1273 char fCurrency[4];
1274
1275 MeasureUnit(int32_t typeId, int32_t subTypeId) : fTypeId(typeId), fSubTypeId(subTypeId) {
1276 fCurrency[0] = 0;
1277 }
1278 void setTo(int32_t typeId, int32_t subTypeId);
1279 int32_t getOffset() const;
1280 static MeasureUnit *create(int typeId, int subTypeId, UErrorCode &status);
1281 };
1282
1283 U_NAMESPACE_END
1284
1285 #endif // !UNCONFIG_NO_FORMATTING
1286 #endif // __MEASUREUNIT_H__
icu::MeasureUnit::operator!=
UBool operator!=(const UObject &other) const
Inequality operator.
Definition: measunit.h:84
icu::MeasureUnit
A unit such as length, mass, volume, currency, etc.
Definition: measunit.h:36
icu::UObject::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
unistr.h
C++ API: Unicode String.
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:91
icu::StringEnumeration
Base class for 'pure' C++ implementations of uenum api.
Definition: strenum.h:55
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:358
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
icu::MeasureUnit::MeasureUnit
MeasureUnit()
Default constructor.
Definition: measunit.h:43
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:476
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:221
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234