Measure Class Reference

#include <measure.h>

Inheritance diagram for Measure:

UObject UMemory CurrencyAmount

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. This is an abstract class. Subclasses specify a concrete Unit type.

Measure objects are parsed and formatted by subclasses of MeasureFormat.

Measure objects are immutable.

This is an abstract class.

Author:
Alan Liu
Draft:
This API may be changed in the future versions and was introduced in ICU 3.0

Definition at line 42 of file 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.

 Measure (const Measure &other)
 Copy constructor.

Measure & operator= (const Measure &other)
 Assignment operator.

virtual UObject * clone () const =0
 Return a polymorphic clone of this object.

virtual ~Measure ()
 Destructor.

UBool operator== (const UObject &other) const
 Equality operator.

const Formattable & getNumber () const
 Return a reference to the numeric value of this object.

const MeasureUnit & getUnit () const
 Return a reference to the unit of this object.


Protected Member Functions

 Measure ()
 Default constructor.


Constructor & Destructor Documentation

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.
Draft:
This API may be changed in the future versions and was introduced in ICU 3.0

Measure::Measure (  const Measure &  other  ) 
 

Copy constructor.

Draft:
This API may be changed in the future versions and was introduced in ICU 3.0

virtual Measure::~Measure (   )  [virtual]
 

Destructor.

Draft:
This API may be changed in the future versions and was introduced in ICU 3.0

Measure::Measure (   )  [protected]
 

Default constructor.

Draft:
This API may be changed in the future versions and was introduced in ICU 3.0


Member Function Documentation

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

Return a polymorphic clone of this object.

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

Draft:
This API may be changed in the future versions and was introduced in ICU 3.0

Implemented in CurrencyAmount.

const Formattable & 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.

Draft:
This API may be changed in the future versions and was introduced in ICU 3.0

Definition at line 141 of file measure.h.

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

Return a reference to the unit of this object.

Draft:
This API may be changed in the future versions and was introduced in ICU 3.0

Definition at line 145 of file measure.h.

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

Assignment operator.

Draft:
This API may be changed in the future versions and was introduced in ICU 3.0

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

Equality operator.

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

Draft:
This API may be changed in the future versions and was introduced in ICU 3.0


The documentation for this class was generated from the following file:
Generated on Fri Jun 18 12:36:28 2004 for ICU by doxygen 1.3.7