ICU 78.3  78.3
Public Types | Public Member Functions | Static Public Member Functions
icu::TimeUnit Class Reference

Measurement unit for time units. More...

#include <tmunit.h>

Inheritance diagram for icu::TimeUnit:

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 TimeUnit * clone () const override
 Override clone. More...
 
 TimeUnit (const TimeUnit &other)
 Copy operator. More...
 
TimeUnit & operator= (const TimeUnit &other)
 Assignment operator. More...
 
virtual UClassID getDynamicClassID () const override
 Returns a unique class ID for this object POLYMORPHICALLY. More...
 
UTimeUnitFields getTimeUnitField () const
 Get time unit field. More...
 
virtual ~TimeUnit ()
 Destructor. More...
 

Static Public Member Functions

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

Detailed Description

Measurement unit for time units.

See also
TimeUnitAmount
TimeUnit
Stable:
ICU 4.2

Definition at line 35 of file tmunit.h.

Member Enumeration Documentation

◆ UTimeUnitFields

Constants for all the time units we supported.

Stable:
ICU 4.2
Enumerator
UTIMEUNIT_FIELD_COUNT 

One more than the highest normal UTimeUnitFields value.

Deprecated:
ICU 58 The numeric value may change over time, see ICU ticket #12420.

Definition at line 41 of file tmunit.h.

Constructor & Destructor Documentation

◆ TimeUnit()

icu::TimeUnit::TimeUnit ( const TimeUnit &  other)

Copy operator.

Stable:
ICU 4.2

◆ ~TimeUnit()

virtual icu::TimeUnit::~TimeUnit ( )
virtual

Destructor.

Stable:
ICU 4.2

Member Function Documentation

◆ clone()

virtual TimeUnit* icu::TimeUnit::clone ( ) const
overridevirtual

Override clone.

Stable:
ICU 4.2

◆ createInstance()

static TimeUnit* icu::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

◆ getDynamicClassID()

virtual UClassID icu::TimeUnit::getDynamicClassID ( ) const
overridevirtual

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

◆ getStaticClassID()

static UClassID icu::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 icu::TimeUnit::getTimeUnitField ( ) const

Get time unit field.

Returns
time unit field.
Stable:
ICU 4.2

◆ operator=()

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

Assignment operator.

Stable:
ICU 4.2

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