jpayne@69: // © 2016 and later: Unicode, Inc. and others. jpayne@69: // License & terms of use: http://www.unicode.org/copyright.html jpayne@69: /* jpayne@69: ******************************************************************************* jpayne@69: * Copyright (C) 2009-2016, International Business Machines Corporation, * jpayne@69: * Google, and others. All Rights Reserved. * jpayne@69: ******************************************************************************* jpayne@69: */ jpayne@69: jpayne@69: #ifndef __TMUNIT_H__ jpayne@69: #define __TMUNIT_H__ jpayne@69: jpayne@69: jpayne@69: /** jpayne@69: * \file jpayne@69: * \brief C++ API: time unit object jpayne@69: */ jpayne@69: jpayne@69: #include "unicode/utypes.h" jpayne@69: jpayne@69: #if U_SHOW_CPLUSPLUS_API jpayne@69: jpayne@69: #include "unicode/measunit.h" jpayne@69: jpayne@69: #if !UCONFIG_NO_FORMATTING jpayne@69: jpayne@69: U_NAMESPACE_BEGIN jpayne@69: jpayne@69: /** jpayne@69: * Measurement unit for time units. jpayne@69: * @see TimeUnitAmount jpayne@69: * @see TimeUnit jpayne@69: * @stable ICU 4.2 jpayne@69: */ jpayne@69: class U_I18N_API TimeUnit: public MeasureUnit { jpayne@69: public: jpayne@69: /** jpayne@69: * Constants for all the time units we supported. jpayne@69: * @stable ICU 4.2 jpayne@69: */ jpayne@69: enum UTimeUnitFields { jpayne@69: UTIMEUNIT_YEAR, jpayne@69: UTIMEUNIT_MONTH, jpayne@69: UTIMEUNIT_DAY, jpayne@69: UTIMEUNIT_WEEK, jpayne@69: UTIMEUNIT_HOUR, jpayne@69: UTIMEUNIT_MINUTE, jpayne@69: UTIMEUNIT_SECOND, jpayne@69: #ifndef U_HIDE_DEPRECATED_API jpayne@69: /** jpayne@69: * One more than the highest normal UTimeUnitFields value. jpayne@69: * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. jpayne@69: */ jpayne@69: UTIMEUNIT_FIELD_COUNT jpayne@69: #endif // U_HIDE_DEPRECATED_API jpayne@69: }; jpayne@69: jpayne@69: /** jpayne@69: * Create Instance. jpayne@69: * @param timeUnitField time unit field based on which the instance jpayne@69: * is created. jpayne@69: * @param status input-output error code. jpayne@69: * If the timeUnitField is invalid, jpayne@69: * then this will be set to U_ILLEGAL_ARGUMENT_ERROR. jpayne@69: * @return a TimeUnit instance jpayne@69: * @stable ICU 4.2 jpayne@69: */ jpayne@69: static TimeUnit* U_EXPORT2 createInstance(UTimeUnitFields timeUnitField, jpayne@69: UErrorCode& status); jpayne@69: jpayne@69: jpayne@69: /** jpayne@69: * Override clone. jpayne@69: * @stable ICU 4.2 jpayne@69: */ jpayne@69: virtual TimeUnit* clone() const; jpayne@69: jpayne@69: /** jpayne@69: * Copy operator. jpayne@69: * @stable ICU 4.2 jpayne@69: */ jpayne@69: TimeUnit(const TimeUnit& other); jpayne@69: jpayne@69: /** jpayne@69: * Assignment operator. jpayne@69: * @stable ICU 4.2 jpayne@69: */ jpayne@69: TimeUnit& operator=(const TimeUnit& other); jpayne@69: jpayne@69: /** jpayne@69: * Returns a unique class ID for this object POLYMORPHICALLY. jpayne@69: * This method implements a simple form of RTTI used by ICU. jpayne@69: * @return The class ID for this object. All objects of a given jpayne@69: * class have the same class ID. Objects of other classes have jpayne@69: * different class IDs. jpayne@69: * @stable ICU 4.2 jpayne@69: */ jpayne@69: virtual UClassID getDynamicClassID() const; jpayne@69: jpayne@69: /** jpayne@69: * Returns the class ID for this class. This is used to compare to jpayne@69: * the return value of getDynamicClassID(). jpayne@69: * @return The class ID for all objects of this class. jpayne@69: * @stable ICU 4.2 jpayne@69: */ jpayne@69: static UClassID U_EXPORT2 getStaticClassID(); jpayne@69: jpayne@69: jpayne@69: /** jpayne@69: * Get time unit field. jpayne@69: * @return time unit field. jpayne@69: * @stable ICU 4.2 jpayne@69: */ jpayne@69: UTimeUnitFields getTimeUnitField() const; jpayne@69: jpayne@69: /** jpayne@69: * Destructor. jpayne@69: * @stable ICU 4.2 jpayne@69: */ jpayne@69: virtual ~TimeUnit(); jpayne@69: jpayne@69: private: jpayne@69: UTimeUnitFields fTimeUnitField; jpayne@69: jpayne@69: /** jpayne@69: * Constructor jpayne@69: * @internal (private) jpayne@69: */ jpayne@69: TimeUnit(UTimeUnitFields timeUnitField); jpayne@69: jpayne@69: }; jpayne@69: jpayne@69: jpayne@69: U_NAMESPACE_END jpayne@69: jpayne@69: #endif /* #if !UCONFIG_NO_FORMATTING */ jpayne@69: jpayne@69: #endif /* U_SHOW_CPLUSPLUS_API */ jpayne@69: jpayne@69: #endif // __TMUNIT_H__ jpayne@69: //eof jpayne@69: //