icu::Measure Class Reference

An amount of a specified unit, consisting of a number and a Unit. More...

#include <measure.h>

Inheritance diagram for icu::Measure:
icu::UObject icu::UMemory icu::CurrencyAmount icu::TimeUnitAmount

Public Member Functions

 Measure (const Formattable &number, MeasureUnit *adoptedUnit, UErrorCode &ec)
 Construct an object with the given numeric amount and the given unit.
 Measure (const Measure &other)
 Copy constructor.
Measureoperator= (const Measure &other)
 Assignment operator.
virtual UObjectclone () const
 Return a polymorphic clone of this object.
virtual ~Measure ()
 Destructor.
UBool operator== (const UObject &other) const
 Equality operator.
const FormattablegetNumber () const
 Return a reference to the numeric value of this object.
const MeasureUnitgetUnit () const
 Return a reference to the unit of this object.
virtual UClassID getDynamicClassID (void) const
 Returns a unique class ID POLYMORPHICALLY.

Static Public Member Functions

static UClassID getStaticClassID (void)
 Return the class ID for this class.

Protected Member Functions

 Measure ()
 Default constructor.

Detailed Description

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.

Author:
Alan Liu
Stable:
ICU 3.0

Definition at line 43 of file measure.h.


Constructor & Destructor Documentation

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.

Parameters:
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.
Stable:
ICU 3.0
icu::Measure::Measure ( const Measure other  ) 

Copy constructor.

Stable:
ICU 3.0
virtual icu::Measure::~Measure (  )  [virtual]

Destructor.

Stable:
ICU 3.0
icu::Measure::Measure (  )  [protected]

Default constructor.

Stable:
ICU 3.0

Member Function Documentation

virtual UObject* icu::Measure::clone (  )  const [virtual]

Return a polymorphic clone of this object.

The result will have the same class as returned by getDynamicClassID().

Stable:
ICU 3.0

Reimplemented in icu::CurrencyAmount, and icu::TimeUnitAmount.

virtual UClassID icu::Measure::getDynamicClassID ( void   )  const [virtual]

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.

Returns:
The class ID for this object. All objects of a given class have the same class ID. Objects of other classes have different class IDs.
Stable:
ICU 53

Reimplemented from icu::UObject.

Reimplemented in icu::CurrencyAmount, and icu::TimeUnitAmount.

const Formattable & icu::Measure::getNumber (  )  const [inline]

Return a reference to the numeric value of this object.

The numeric value may be of any numeric type supported by Formattable.

Stable:
ICU 3.0

Definition at line 150 of file measure.h.

static UClassID icu::Measure::getStaticClassID ( void   )  [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()) ...
 
Returns:
The class ID for all objects of this class.
Stable:
ICU 53

Reimplemented in icu::CurrencyAmount, and icu::TimeUnitAmount.

const MeasureUnit & icu::Measure::getUnit (  )  const [inline]

Return a reference to the unit of this object.

Stable:
ICU 3.0

Definition at line 154 of file measure.h.

Referenced by icu::CurrencyAmount::getCurrency().

Measure& icu::Measure::operator= ( const Measure other  ) 

Assignment operator.

Stable:
ICU 3.0

Reimplemented in icu::CurrencyAmount, and icu::TimeUnitAmount.

UBool icu::Measure::operator== ( const UObject other  )  const

Equality operator.

Return true if this object is equal to the given object.

Stable:
ICU 3.0

Reimplemented in icu::TimeUnitAmount.


The documentation for this class was generated from the following file:

Generated on 15 Dec 2017 for ICU 60.1 by  doxygen 1.6.1