ICU 75.1 75.1
|
Express a duration as a time unit and number. More...
#include <tmutamt.h>
Public Member Functions | |
TimeUnitAmount (const Formattable &number, TimeUnit::UTimeUnitFields timeUnitField, UErrorCode &status) | |
Construct TimeUnitAmount object with the given number and the given time unit. | |
TimeUnitAmount (double amount, TimeUnit::UTimeUnitFields timeUnitField, UErrorCode &status) | |
Construct TimeUnitAmount object with the given numeric amount and the given time unit. | |
TimeUnitAmount (const TimeUnitAmount &other) | |
Copy constructor. | |
TimeUnitAmount & | operator= (const TimeUnitAmount &other) |
Assignment operator. | |
virtual TimeUnitAmount * | clone () const override |
Clone. | |
virtual | ~TimeUnitAmount () |
Destructor. | |
virtual bool | operator== (const UObject &other) const |
Equality operator. | |
bool | operator!= (const UObject &other) const |
Not-equality operator. | |
virtual UClassID | getDynamicClassID () const override |
Returns a unique class ID POLYMORPHICALLY. | |
const TimeUnit & | getTimeUnit () const |
Get the time unit. | |
TimeUnit::UTimeUnitFields | getTimeUnitField () const |
Get the time unit field value. | |
Public Member Functions inherited from icu::Measure | |
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 | ~Measure () |
Destructor. | |
bool | operator== (const UObject &other) const |
Equality operator. | |
bool | operator!= (const UObject &other) const |
Inequality 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. | |
Public Member Functions inherited from icu::UObject | |
virtual | ~UObject () |
Destructor. | |
Static Public Member Functions | |
static UClassID | getStaticClassID () |
Return the class ID for this class. | |
Static Public Member Functions inherited from icu::Measure | |
static UClassID | getStaticClassID () |
Return the class ID for this class. | |
Additional Inherited Members | |
Protected Member Functions inherited from icu::Measure | |
Measure () | |
Default constructor. | |
Express a duration as a time unit and number.
Patterned after Currency.
icu::TimeUnitAmount::TimeUnitAmount | ( | const Formattable & | number, |
TimeUnit::UTimeUnitFields | timeUnitField, | ||
UErrorCode & | status | ||
) |
Construct TimeUnitAmount object with the given number and the given time unit.
number | a numeric object; number.isNumeric() must be true |
timeUnitField | the time unit field of a time unit |
status | the input-output error code. If the number is not numeric or the timeUnitField is not valid, then this will be set to a failing value: U_ILLEGAL_ARGUMENT_ERROR. |
icu::TimeUnitAmount::TimeUnitAmount | ( | double | amount, |
TimeUnit::UTimeUnitFields | timeUnitField, | ||
UErrorCode & | status | ||
) |
Construct TimeUnitAmount object with the given numeric amount and the given time unit.
amount | a numeric amount. |
timeUnitField | the time unit field on which a time unit amount object will be created. |
status | the input-output error code. If the timeUnitField is not valid, then this will be set to a failing value: U_ILLEGAL_ARGUMENT_ERROR. |
icu::TimeUnitAmount::TimeUnitAmount | ( | const TimeUnitAmount & | other | ) |
Copy constructor.
|
overridevirtual |
Clone.
Reimplemented from icu::Measure.
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::Measure.
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()) ...
TimeUnit::UTimeUnitFields icu::TimeUnitAmount::getTimeUnitField | ( | ) | const |
Not-equality operator.
other | the object to compare to. |
Definition at line 162 of file tmutamt.h.
References icu::operator==().
TimeUnitAmount & icu::TimeUnitAmount::operator= | ( | const TimeUnitAmount & | other | ) |
Assignment operator.
Equality operator.
other | the object to compare to. |