1 // Copyright (C) 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
27 * Measurement unit for time units.
32 class U_I18N_API TimeUnit: public MeasureUnit {
35 * Constants for all the time units we supported.
38 enum UTimeUnitFields {
46 #ifndef U_HIDE_DEPRECATED_API
48 * One more than the highest normal UTimeUnitFields value.
49 * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
52 #endif // U_HIDE_DEPRECATED_API
57 * @param timeUnitField time unit field based on which the instance
59 * @param status input-output error code.
60 * If the timeUnitField is invalid,
61 * then this will be set to U_ILLEGAL_ARGUMENT_ERROR.
62 * @return a TimeUnit instance
65 static TimeUnit* U_EXPORT2 createInstance(UTimeUnitFields timeUnitField,
73 virtual UObject* clone() const;
79 TimeUnit(const TimeUnit& other);
82 * Assignment operator.
85 TimeUnit& operator=(const TimeUnit& other);
88 * Returns a unique class ID for this object POLYMORPHICALLY.
89 * This method implements a simple form of RTTI used by ICU.
90 * @return The class ID for this object. All objects of a given
91 * class have the same class ID. Objects of other classes have
92 * different class IDs.
95 virtual UClassID getDynamicClassID() const;
98 * Returns the class ID for this class. This is used to compare to
99 * the return value of getDynamicClassID().
100 * @return The class ID for all objects of this class.
103 static UClassID U_EXPORT2 getStaticClassID();
107 * Get time unit field.
108 * @return time unit field.
111 UTimeUnitFields getTimeUnitField() const;
120 UTimeUnitFields fTimeUnitField;
124 * @internal (private)
126 TimeUnit(UTimeUnitFields timeUnitField);
133 #endif /* #if !UCONFIG_NO_FORMATTING */
135 #endif // __TMUNIT_H__