ICU 55.1  55.1
measure.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 __MEASURE_H__
12 #define __MEASURE_H__
13 
14 #include "unicode/utypes.h"
15 
21 #if !UCONFIG_NO_FORMATTING
22 
23 #include "unicode/fmtable.h"
24 
26 
27 class MeasureUnit;
28 
41 class U_I18N_API Measure: public UObject {
42  public:
53  Measure(const Formattable& number, MeasureUnit* adoptedUnit,
54  UErrorCode& ec);
55 
60  Measure(const Measure& other);
61 
66  Measure& operator=(const Measure& other);
67 
73  virtual UObject* clone() const;
74 
79  virtual ~Measure();
80 
86  UBool operator==(const UObject& other) const;
87 
94  inline const Formattable& getNumber() const;
95 
100  inline const MeasureUnit& getUnit() const;
101 
113  static UClassID U_EXPORT2 getStaticClassID(void);
114 
126  virtual UClassID getDynamicClassID(void) const;
127 
128  protected:
134 
135  private:
139  Formattable number;
140 
145  MeasureUnit* unit;
146 };
147 
148 inline const Formattable& Measure::getNumber() const {
149  return number;
150 }
151 
152 inline const MeasureUnit& Measure::getUnit() const {
153  return *unit;
154 }
155 
157 
158 #endif // !UCONFIG_NO_FORMATTING
159 #endif // __MEASURE_H__
icu::MeasureUnit
A unit such as length, mass, volume, currency, etc.
Definition: measunit.h:36
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
icu::Measure::getStaticClassID
static UClassID getStaticClassID(void)
Return the class ID for this class.
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
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
icu::Formattable
Formattable objects can be passed to the Format class or its subclasses for formatting.
Definition: fmtable.h:66
icu::Measure::operator=
Measure & operator=(const Measure &other)
Assignment operator.
icu::Measure::~Measure
virtual ~Measure()
Destructor.
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:221
icu::Measure::Measure
Measure(const Measure &other)
Copy constructor.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:91
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:476
fmtable.h
C++ API: Formattable is a thin wrapper for primitive types used for formatting and parsing.
icu::Measure::Measure
Measure(const Formattable &number, MeasureUnit *adoptedUnit, UErrorCode &ec)
Construct an object with the given numeric amount and the given unit.
icu::Measure
An amount of a specified unit, consisting of a number and a Unit.
Definition: measure.h:41
icu::Measure::operator==
UBool operator==(const UObject &other) const
Equality operator.
icu::Measure::clone
virtual UObject * clone() const
Return a polymorphic clone of this object.
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
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::Measure::Measure
Measure()
Default constructor.
icu::Measure::getDynamicClassID
virtual UClassID getDynamicClassID(void) const
Returns a unique class ID POLYMORPHICALLY.