2
*******************************************************************************
3
* Copyright (C) 2009-2010, Google, International Business Machines Corporation and *
4
* others. All Rights Reserved. *
5
*******************************************************************************
14
* \brief C++ API: time unit object
18
#include "unicode/measunit.h"
20
#if !UCONFIG_NO_FORMATTING
25
* Measurement unit for time units.
30
class U_I18N_API TimeUnit: public MeasureUnit {
33
* Constants for all the time units we supported.
36
enum UTimeUnitFields {
49
* @param timeUnitField time unit field based on which the instance
51
* @param status input-output error code.
52
* If the timeUnitField is invalid,
53
* then this will be set to U_ILLEGAL_ARGUMENT_ERROR.
54
* @return a TimeUnit instance
57
static TimeUnit* U_EXPORT2 createInstance(UTimeUnitFields timeUnitField,
65
virtual UObject* clone() const;
71
TimeUnit(const TimeUnit& other);
74
* Assignment operator.
77
TimeUnit& operator=(const TimeUnit& other);
81
* @return true if 2 objects are the same.
84
virtual UBool operator==(const UObject& other) const;
87
* Non-Equality operator.
88
* @return true if 2 objects are not the same.
91
UBool operator!=(const UObject& other) const;
94
* Returns a unique class ID for this object POLYMORPHICALLY.
95
* This method implements a simple form of RTTI used by ICU.
96
* @return The class ID for this object. All objects of a given
97
* class have the same class ID. Objects of other classes have
98
* different class IDs.
101
virtual UClassID getDynamicClassID() const;
104
* Returns the class ID for this class. This is used to compare to
105
* the return value of getDynamicClassID().
106
* @return The class ID for all objects of this class.
109
static UClassID U_EXPORT2 getStaticClassID();
113
* Get time unit field.
114
* @return time unit field.
117
UTimeUnitFields getTimeUnitField() const;
126
UTimeUnitFields fTimeUnitField;
132
TimeUnit(UTimeUnitFields timeUnitField);
138
TimeUnit::operator!=(const UObject& other) const {
139
return !operator==(other);
145
#endif /* #if !UCONFIG_NO_FORMATTING */
147
#endif // __TMUNIT_H__