ICU 69.1 69.1

measure.h
Go to the documentation of this file.
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-2015, 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 __MEASURE_H__
14 #define __MEASURE_H__
15
16 #include "unicode/utypes.h"
17
18 #if U_SHOW_CPLUSPLUS_API
19
25 #if !UCONFIG_NO_FORMATTING
26
27 #include "unicode/fmtable.h"
28
29 U_NAMESPACE_BEGIN
30
31 class MeasureUnit;
32
45 class U_I18N_API Measure: public UObject {
46 public:
57 Measure(const Formattable& number, MeasureUnit* adoptedUnit,
58 UErrorCode& ec);
59
64 Measure(const Measure& other);
65
70 Measure& operator=(const Measure& other);
71
77 virtual Measure* clone() const;
78
83 virtual ~Measure();
84
90 UBool operator==(const UObject& other) const;
91
98 inline const Formattable& getNumber() const;
99
104 inline const MeasureUnit& getUnit() const;
105
117 static UClassID U_EXPORT2 getStaticClassID(void);
118
130 virtual UClassID getDynamicClassID(void) const;
131
132 protected:
137 Measure();
138
139 private:
143 Formattable number;
144
149 MeasureUnit* unit;
150 };
151
152 inline const Formattable& Measure::getNumber() const {
153 return number;
154 }
155
156 inline const MeasureUnit& Measure::getUnit() const {
157 return *unit;
158 }
159
160 U_NAMESPACE_END
161
162 #endif // !UCONFIG_NO_FORMATTING
163
164 #endif /* U_SHOW_CPLUSPLUS_API */
165
166 #endif // __MEASURE_H__
icu::MeasureUnit
A unit such as length, mass, volume, currency, etc.
Definition: measunit.h:369
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_I18N_API
#define U_I18N_API
Definition: utypes.h:301
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:64
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
icu::UObject::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
fmtable.h
C++ API: Formattable is a thin wrapper for primitive types used for formatting and parsing.
icu::Measure
An amount of a specified unit, consisting of a number and a Unit.
Definition: measure.h:45