Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:13:08

0001 // © 2016 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 /*
0004  *******************************************************************************
0005  * Copyright (C) 2009-2016, International Business Machines Corporation,       *
0006  * Google, and others. All Rights Reserved.                                    *
0007  *******************************************************************************
0008  */
0009 
0010 #ifndef __TMUNIT_H__
0011 #define __TMUNIT_H__
0012 
0013 
0014 /**
0015  * \file
0016  * \brief C++ API: time unit object
0017  */
0018 
0019 #include "unicode/utypes.h"
0020 
0021 #if U_SHOW_CPLUSPLUS_API
0022 
0023 #include "unicode/measunit.h"
0024 
0025 #if !UCONFIG_NO_FORMATTING
0026 
0027 U_NAMESPACE_BEGIN
0028 
0029 /**
0030  * Measurement unit for time units.
0031  * @see TimeUnitAmount
0032  * @see TimeUnit
0033  * @stable ICU 4.2
0034  */
0035 class U_I18N_API TimeUnit: public MeasureUnit {
0036 public:
0037     /**
0038      * Constants for all the time units we supported.
0039      * @stable ICU 4.2
0040      */
0041     enum UTimeUnitFields {
0042         UTIMEUNIT_YEAR,
0043         UTIMEUNIT_MONTH,
0044         UTIMEUNIT_DAY,
0045         UTIMEUNIT_WEEK,
0046         UTIMEUNIT_HOUR,
0047         UTIMEUNIT_MINUTE,
0048         UTIMEUNIT_SECOND,
0049 #ifndef U_HIDE_DEPRECATED_API
0050         /**
0051          * One more than the highest normal UTimeUnitFields value.
0052          * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
0053          */
0054         UTIMEUNIT_FIELD_COUNT
0055 #endif  // U_HIDE_DEPRECATED_API
0056     };
0057 
0058     /**
0059      * Create Instance.
0060      * @param timeUnitField  time unit field based on which the instance
0061      *                       is created.
0062      * @param status         input-output error code.
0063      *                       If the timeUnitField is invalid,
0064      *                       then this will be set to U_ILLEGAL_ARGUMENT_ERROR.
0065      * @return               a TimeUnit instance
0066      * @stable ICU 4.2
0067      */
0068     static TimeUnit* U_EXPORT2 createInstance(UTimeUnitFields timeUnitField,
0069                                               UErrorCode& status);
0070 
0071 
0072     /**
0073      * Override clone.
0074      * @stable ICU 4.2
0075      */
0076     virtual TimeUnit* clone() const override;
0077 
0078     /**
0079      * Copy operator.
0080      * @stable ICU 4.2
0081      */
0082     TimeUnit(const TimeUnit& other);
0083 
0084     /**
0085      * Assignment operator.
0086      * @stable ICU 4.2
0087      */
0088     TimeUnit& operator=(const TimeUnit& other);
0089 
0090     /**
0091      * Returns a unique class ID for this object POLYMORPHICALLY.
0092      * This method implements a simple form of RTTI used by ICU.
0093      * @return The class ID for this object. All objects of a given
0094      * class have the same class ID.  Objects of other classes have
0095      * different class IDs.
0096      * @stable ICU 4.2
0097      */
0098     virtual UClassID getDynamicClassID() const override;
0099 
0100     /**
0101      * Returns the class ID for this class. This is used to compare to
0102      * the return value of getDynamicClassID().
0103      * @return The class ID for all objects of this class.
0104      * @stable ICU 4.2
0105      */
0106     static UClassID U_EXPORT2 getStaticClassID();
0107 
0108 
0109     /**
0110      * Get time unit field.
0111      * @return time unit field.
0112      * @stable ICU 4.2
0113      */
0114     UTimeUnitFields getTimeUnitField() const;
0115 
0116     /**
0117      * Destructor.
0118      * @stable ICU 4.2
0119      */
0120     virtual ~TimeUnit();
0121 
0122 private:
0123     UTimeUnitFields fTimeUnitField;
0124 
0125     /**
0126      * Constructor
0127      * @internal (private)
0128      */
0129     TimeUnit(UTimeUnitFields timeUnitField);
0130 
0131 };
0132 
0133 
0134 U_NAMESPACE_END
0135 
0136 #endif /* #if !UCONFIG_NO_FORMATTING */
0137 
0138 #endif /* U_SHOW_CPLUSPLUS_API */
0139 
0140 #endif // __TMUNIT_H__
0141 //eof
0142 //