]>
git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/unicode/measure.h
2 **********************************************************************
3 * Copyright (c) 2004, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
7 * Created: April 26, 2004
9 **********************************************************************
14 #include "unicode/utypes.h"
16 #if !UCONFIG_NO_FORMATTING
18 #include "unicode/fmtable.h"
25 * An amount of a specified unit, consisting of a number and a Unit.
26 * For example, a length measure consists of a number and a length
27 * unit, such as feet or meters. This is an abstract class.
28 * Subclasses specify a concrete Unit type.
30 * <p>Measure objects are parsed and formatted by subclasses of
33 * <p>Measure objects are immutable.
35 * <p>This is an abstract class.
40 class U_I18N_API Measure
: public UObject
{
43 * Construct an object with the given numeric amount and the given
44 * unit. After this call, the caller must not delete the given
46 * @param number a numeric object; amount.isNumeric() must be TRUE
47 * @param adoptedUnit the unit object, which must not be NULL
48 * @param ec input-output error code. If the amount or the unit
49 * is invalid, then this will be set to a failing value.
52 Measure(const Formattable
& number
, MeasureUnit
* adoptedUnit
,
59 Measure(const Measure
& other
);
65 Measure
& operator=(const Measure
& other
);
68 * Return a polymorphic clone of this object. The result will
69 * have the same class as returned by getDynamicClassID().
72 virtual UObject
* clone() const = 0;
81 * Equality operator. Return true if this object is equal
82 * to the given object.
85 UBool
operator==(const UObject
& other
) const;
88 * Return a reference to the numeric value of this object. The
89 * numeric value may be of any numeric type supported by
93 inline const Formattable
& getNumber() const;
96 * Return a reference to the unit of this object.
99 inline const MeasureUnit
& getUnit() const;
103 * Default constructor.
110 * The numeric value of this object, e.g. 2.54 or 100.
115 * The unit of this object, e.g., "millimeter" or "JPY". This is
116 * owned by this object.
121 inline const Formattable
& Measure::getNumber() const {
125 inline const MeasureUnit
& Measure::getUnit() const {
131 #endif // !UCONFIG_NO_FORMATTING
132 #endif // __MEASURE_H__