ICU 50.2 50.2
TimeUnit Class Reference

Measurement unit for time units. More...

#include <tmunit.h>

Inheritance diagram for TimeUnit:
MeasureUnit UObject UMemory

Public Types

enum  UTimeUnitFields {
  UTIMEUNIT_YEAR , UTIMEUNIT_MONTH , UTIMEUNIT_DAY , UTIMEUNIT_WEEK ,
  UTIMEUNIT_HOUR , UTIMEUNIT_MINUTE , UTIMEUNIT_SECOND , UTIMEUNIT_FIELD_COUNT
}
 Constants for all the time units we supported. More...
 

Public Member Functions

virtual UObjectclone () const
 Override clone.
 
 TimeUnit (const TimeUnit &other)
 Copy operator.
 
TimeUnitoperator= (const TimeUnit &other)
 Assignment operator.
 
virtual UBool operator== (const UObject &other) const
 Equality operator.
 
UBool operator!= (const UObject &other) const
 Non-Equality operator.
 
virtual UClassID getDynamicClassID () const
 Returns a unique class ID for this object POLYMORPHICALLY.
 
UTimeUnitFields getTimeUnitField () const
 Get time unit field.
 
virtual ~TimeUnit ()
 Destructor.
 
- Public Member Functions inherited from MeasureUnit
virtual ~MeasureUnit ()
 Destructor.
 
- Public Member Functions inherited from UObject
virtual ~UObject ()
 Destructor.
 

Static Public Member Functions

static TimeUnitcreateInstance (UTimeUnitFields timeUnitField, UErrorCode &status)
 Create Instance.
 
static UClassID getStaticClassID ()
 Returns the class ID for this class.
 

Additional Inherited Members

- Protected Member Functions inherited from MeasureUnit
 MeasureUnit ()
 Default constructor.
 

Detailed Description

Measurement unit for time units.

See also
TimeUnitAmount
TimeUnit
Stable
ICU 4.2

Definition at line 30 of file tmunit.h.

Member Enumeration Documentation

◆ UTimeUnitFields

Constants for all the time units we supported.

Stable
ICU 4.2

Definition at line 36 of file tmunit.h.

Constructor & Destructor Documentation

◆ TimeUnit()

TimeUnit::TimeUnit ( const TimeUnit & other)

Copy operator.

Stable
ICU 4.2

References TimeUnit().

Referenced by createInstance(), operator=(), TimeUnit(), and ~TimeUnit().

◆ ~TimeUnit()

virtual TimeUnit::~TimeUnit ( )
virtual

Destructor.

Stable
ICU 4.2

References TimeUnit().

Member Function Documentation

◆ clone()

virtual UObject * TimeUnit::clone ( ) const
virtual

Override clone.

Stable
ICU 4.2

Implements MeasureUnit.

◆ createInstance()

static TimeUnit * TimeUnit::createInstance ( UTimeUnitFields timeUnitField,
UErrorCode & status )
static

Create Instance.

Parameters
timeUnitFieldtime unit field based on which the instance is created.
statusinput-output error code. If the timeUnitField is invalid, then this will be set to U_ILLEGAL_ARGUMENT_ERROR.
Returns
a TimeUnit instance
Stable
ICU 4.2

References TimeUnit().

◆ getDynamicClassID()

virtual UClassID TimeUnit::getDynamicClassID ( ) const
virtual

Returns a unique class ID for this object POLYMORPHICALLY.

This method implements a simple form of RTTI used by ICU.

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 4.2

Implements UObject.

◆ getStaticClassID()

static UClassID TimeUnit::getStaticClassID ( )
static

Returns the class ID for this class.

This is used to compare to the return value of getDynamicClassID().

Returns
The class ID for all objects of this class.
Stable
ICU 4.2

◆ getTimeUnitField()

UTimeUnitFields TimeUnit::getTimeUnitField ( ) const

Get time unit field.

Returns
time unit field.
Stable
ICU 4.2

◆ operator!=()

UBool TimeUnit::operator!= ( const UObject & other) const
inline

Non-Equality operator.

Returns
true if 2 objects are not the same.
Stable
ICU 4.2

Definition at line 138 of file tmunit.h.

References operator==().

◆ operator=()

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

Assignment operator.

Stable
ICU 4.2

References TimeUnit().

◆ operator==()

virtual UBool TimeUnit::operator== ( const UObject & other) const
virtual

Equality operator.

Returns
true if 2 objects are the same.
Stable
ICU 4.2

Implements MeasureUnit.

Referenced by operator!=().


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