ICU 60.2 60.2

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

- File List
- Globals

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
23 #if !UCONFIG_NO_FORMATTING
24
25 #include "unicode/fmtable.h"
26
27 U_NAMESPACE_BEGIN
28
29 class MeasureUnit;
30
43 class U_I18N_API Measure: public UObject {
44 public:
55 Measure(const Formattable& number, MeasureUnit* adoptedUnit,
56 UErrorCode& ec);
57
62 Measure(const Measure& other);
63
68 Measure& operator=(const Measure& other);
69
75 virtual UObject* clone() const;
76
81 virtual ~Measure();
82
88 UBool operator==(const UObject& other) const;
89
96 inline const Formattable& getNumber() const;
97
102 inline const MeasureUnit& getUnit() const;
103
115 static UClassID U_EXPORT2 getStaticClassID(void);
116
128 virtual UClassID getDynamicClassID(void) const;
129
130 protected:
135 Measure();
136
137 private:
141 Formattable number;
142
147 MeasureUnit* unit;
148 };
149
150 inline const Formattable& Measure::getNumber() const {
151 return number;
152 }
153
154 inline const MeasureUnit& Measure::getUnit() const {
155 return *unit;
156 }
157
158 U_NAMESPACE_END
159
160 #endif // !UCONFIG_NO_FORMATTING
161 #endif // __MEASURE_H__
icu::MeasureUnit
A unit such as length, mass, volume, currency, etc.
Definition: measunit.h:38
icu::Measure
An amount of a specified unit, consisting of a number and a Unit.
Definition: measure.h:43
icu::UObject::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU4C "poor man&#39;s RTTI", returns a UClassID for the actual ICU class.
icu::Measure::getUnit
const MeasureUnit & getUnit() const
Return a reference to the unit of this object.
Definition: measure.h:154
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&#39;s RTTI.
Definition: uobject.h:93
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:360
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
icu::Measure::getNumber
const Formattable & getNumber() const
Return a reference to the numeric value of this object.
Definition: measure.h:150
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:68
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:236
fmtable.h
C++ API: Formattable is a thin wrapper for primitive types used for formatting and parsing...