]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/unicode/measure.h
2 **********************************************************************
3 * Copyright (c) 2004-2006, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
7 * Created: April 26, 2004
9 **********************************************************************
14 #include "unicode/utypes.h"
18 * \brief C++ API: MeasureUnit object.
21 #if !UCONFIG_NO_FORMATTING
23 #include "unicode/fmtable.h"
30 * An amount of a specified unit, consisting of a number and a Unit.
31 * For example, a length measure consists of a number and a length
32 * unit, such as feet or meters. This is an abstract class.
33 * Subclasses specify a concrete Unit type.
35 * <p>Measure objects are parsed and formatted by subclasses of
38 * <p>Measure objects are immutable.
40 * <p>This is an abstract class.
45 class U_I18N_API Measure
: public UObject
{
48 * Construct an object with the given numeric amount and the given
49 * unit. After this call, the caller must not delete the given
51 * @param number a numeric object; amount.isNumeric() must be TRUE
52 * @param adoptedUnit the unit object, which must not be NULL
53 * @param ec input-output error code. If the amount or the unit
54 * is invalid, then this will be set to a failing value.
57 Measure(const Formattable
& number
, MeasureUnit
* adoptedUnit
,
64 Measure(const Measure
& other
);
70 Measure
& operator=(const Measure
& other
);
73 * Return a polymorphic clone of this object. The result will
74 * have the same class as returned by getDynamicClassID().
77 virtual UObject
* clone() const = 0;
86 * Equality operator. Return true if this object is equal
87 * to the given object.
90 UBool
operator==(const UObject
& other
) const;
93 * Return a reference to the numeric value of this object. The
94 * numeric value may be of any numeric type supported by
98 inline const Formattable
& getNumber() const;
101 * Return a reference to the unit of this object.
104 inline const MeasureUnit
& getUnit() const;
108 * Default constructor.
115 * The numeric value of this object, e.g. 2.54 or 100.
120 * The unit of this object, e.g., "millimeter" or "JPY". This is
121 * owned by this object.
126 inline const Formattable
& Measure::getNumber() const {
130 inline const MeasureUnit
& Measure::getUnit() const {
136 #endif // !UCONFIG_NO_FORMATTING
137 #endif // __MEASURE_H__