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
19 #include "unicode/utypes.h"
21 #if U_SHOW_CPLUSPLUS_API
23 #include "unicode/measunit.h"
25 #if !UCONFIG_NO_FORMATTING
30 * Measurement unit for time units.
35 class U_I18N_API TimeUnit
: public MeasureUnit
{
38 * Constants for all the time units we supported.
41 enum UTimeUnitFields
{
49 #ifndef U_HIDE_DEPRECATED_API
51 * One more than the highest normal UTimeUnitFields value.
52 * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
55 #endif // U_HIDE_DEPRECATED_API
60 * @param timeUnitField time unit field based on which the instance
62 * @param status input-output error code.
63 * If the timeUnitField is invalid,
64 * then this will be set to U_ILLEGAL_ARGUMENT_ERROR.
65 * @return a TimeUnit instance
68 static TimeUnit
* U_EXPORT2
createInstance(UTimeUnitFields timeUnitField
,
76 virtual TimeUnit
* clone() const;
82 TimeUnit(const TimeUnit
& other
);
85 * Assignment operator.
88 TimeUnit
& operator=(const TimeUnit
& other
);
91 * Returns a unique class ID for this object POLYMORPHICALLY.
92 * This method implements a simple form of RTTI used by ICU.
93 * @return The class ID for this object. All objects of a given
94 * class have the same class ID. Objects of other classes have
95 * different class IDs.
98 virtual UClassID
getDynamicClassID() const;
101 * Returns the class ID for this class. This is used to compare to
102 * the return value of getDynamicClassID().
103 * @return The class ID for all objects of this class.
106 static UClassID U_EXPORT2
getStaticClassID();
110 * Get time unit field.
111 * @return time unit field.
114 UTimeUnitFields
getTimeUnitField() const;
123 UTimeUnitFields fTimeUnitField
;
127 * @internal (private)
129 TimeUnit(UTimeUnitFields timeUnitField
);
136 #endif /* #if !UCONFIG_NO_FORMATTING */
138 #endif /* U_SHOW_CPLUSPLUS_API */
140 #endif // __TMUNIT_H__