ICU 72.1 72.1
|
An amount of a specified unit, consisting of a number and a Unit. More...
#include <measure.h>
Public Member Functions | |
Measure (const Formattable &number, MeasureUnit *adoptedUnit, UErrorCode &ec) | |
Construct an object with the given numeric amount and the given unit. More... | |
Measure (const Measure &other) | |
Copy constructor. More... | |
Measure & | operator= (const Measure &other) |
Assignment operator. More... | |
virtual Measure * | clone () const |
Return a polymorphic clone of this object. More... | |
virtual | ~Measure () |
Destructor. More... | |
bool | operator== (const UObject &other) const |
Equality operator. More... | |
const Formattable & | getNumber () const |
Return a reference to the numeric value of this object. More... | |
const MeasureUnit & | getUnit () const |
Return a reference to the unit of this object. More... | |
virtual UClassID | getDynamicClassID (void) const override |
Returns a unique class ID POLYMORPHICALLY. More... | |
Public Member Functions inherited from icu::UObject | |
virtual | ~UObject () |
Destructor. More... | |
virtual UClassID | getDynamicClassID () const |
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class. More... | |
Static Public Member Functions | |
static UClassID | getStaticClassID (void) |
Return the class ID for this class. More... | |
Protected Member Functions | |
Measure () | |
Default constructor. More... | |
An amount of a specified unit, consisting of a number and a Unit.
For example, a length measure consists of a number and a length unit, such as feet or meters.
Measure objects are formatted by MeasureFormat.
Measure objects are immutable.
icu::Measure::Measure | ( | const Formattable & | number, |
MeasureUnit * | adoptedUnit, | ||
UErrorCode & | ec | ||
) |
Construct an object with the given numeric amount and the given unit.
After this call, the caller must not delete the given unit object.
number | a numeric object; amount.isNumeric() must be true |
adoptedUnit | the unit object, which must not be NULL |
ec | input-output error code. If the amount or the unit is invalid, then this will be set to a failing value. |
|
virtual |
Destructor.
|
protected |
Default constructor.
|
virtual |
Return a polymorphic clone of this object.
The result will have the same class as returned by getDynamicClassID().
Reimplemented in icu::CurrencyAmount, and icu::TimeUnitAmount.
|
overridevirtual |
Returns a unique class ID POLYMORPHICALLY.
Pure virtual override. This method is to implement a simple version of RTTI, since not all C++ compilers support genuine RTTI. Polymorphic operator==() and clone() methods call this method.
Reimplemented from icu::UObject.
Reimplemented in icu::CurrencyAmount, and icu::TimeUnitAmount.
|
inline |
Return a reference to the numeric value of this object.
The numeric value may be of any numeric type supported by Formattable.
|
static |
Return the class ID for this class.
This is useful only for comparing to a return value from getDynamicClassID(). For example:
. Base* polymorphic_pointer = createPolymorphicObject(); . if (polymorphic_pointer->getDynamicClassID() == . erived::getStaticClassID()) ...
|
inline |
bool icu::Measure::operator== | ( | const UObject & | other | ) | const |