1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *******************************************************************************
5 * Copyright (C) 2009-2016, International Business Machines Corporation, *
6 * Google, and others. All Rights Reserved. *
7 *******************************************************************************
16 * \brief C++ API: time unit object
20 #include "unicode/measunit.h"
22 #if !UCONFIG_NO_FORMATTING
24 #if U_SHOW_CPLUSPLUS_API
28 * Measurement unit for time units.
33 class U_I18N_API TimeUnit
: public MeasureUnit
{
36 * Constants for all the time units we supported.
39 enum UTimeUnitFields
{
47 #ifndef U_HIDE_DEPRECATED_API
49 * One more than the highest normal UTimeUnitFields value.
50 * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
53 #endif // U_HIDE_DEPRECATED_API
58 * @param timeUnitField time unit field based on which the instance
60 * @param status input-output error code.
61 * If the timeUnitField is invalid,
62 * then this will be set to U_ILLEGAL_ARGUMENT_ERROR.
63 * @return a TimeUnit instance
66 static TimeUnit
* U_EXPORT2
createInstance(UTimeUnitFields timeUnitField
,
74 virtual UObject
* clone() const;
80 TimeUnit(const TimeUnit
& other
);
83 * Assignment operator.
86 TimeUnit
& operator=(const TimeUnit
& other
);
89 * Returns a unique class ID for this object POLYMORPHICALLY.
90 * This method implements a simple form of RTTI used by ICU.
91 * @return The class ID for this object. All objects of a given
92 * class have the same class ID. Objects of other classes have
93 * different class IDs.
96 virtual UClassID
getDynamicClassID() const;
99 * Returns the class ID for this class. This is used to compare to
100 * the return value of getDynamicClassID().
101 * @return The class ID for all objects of this class.
104 static UClassID U_EXPORT2
getStaticClassID();
108 * Get time unit field.
109 * @return time unit field.
112 UTimeUnitFields
getTimeUnitField() const;
121 UTimeUnitFields fTimeUnitField
;
125 * @internal (private)
127 TimeUnit(UTimeUnitFields timeUnitField
);
133 #endif // U_SHOW_CPLUSPLUS_API
135 #endif /* #if !UCONFIG_NO_FORMATTING */
137 #endif // __TMUNIT_H__