ICU 71.1 71.1

tmunit.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 * Copyright (C) 2009-2016, International Business Machines Corporation, *
6 * Google, and others. All Rights Reserved. *
7 *******************************************************************************
8 */
9
10 #ifndef __TMUNIT_H__
11 #define __TMUNIT_H__
12
13
19 #include "unicode/utypes.h"
20
21 #if U_SHOW_CPLUSPLUS_API
22
23 #include "unicode/measunit.h"
24
25 #if !UCONFIG_NO_FORMATTING
26
27 U_NAMESPACE_BEGIN
28
35 class U_I18N_API TimeUnit: public MeasureUnit {
36 public:
41 enum UTimeUnitFields {
42 UTIMEUNIT_YEAR,
43 UTIMEUNIT_MONTH,
44 UTIMEUNIT_DAY,
45 UTIMEUNIT_WEEK,
46 UTIMEUNIT_HOUR,
47 UTIMEUNIT_MINUTE,
48 UTIMEUNIT_SECOND,
49 #ifndef U_HIDE_DEPRECATED_API
50
54 UTIMEUNIT_FIELD_COUNT
55 #endif // U_HIDE_DEPRECATED_API
56 };
57
68 static TimeUnit* U_EXPORT2 createInstance(UTimeUnitFields timeUnitField,
69 UErrorCode& status);
70
71
76 virtual TimeUnit* clone() const override;
77
82 TimeUnit(const TimeUnit& other);
83
88 TimeUnit& operator=(const TimeUnit& other);
89
98 virtual UClassID getDynamicClassID() const override;
99
106 static UClassID U_EXPORT2 getStaticClassID();
107
108
114 UTimeUnitFields getTimeUnitField() const;
115
120 virtual ~TimeUnit();
121
122 private:
123 UTimeUnitFields fTimeUnitField;
124
129 TimeUnit(UTimeUnitFields timeUnitField);
130
131 };
132
133
134 U_NAMESPACE_END
135
136 #endif /* #if !UCONFIG_NO_FORMATTING */
137
138 #endif /* U_SHOW_CPLUSPLUS_API */
139
140 #endif // __TMUNIT_H__
141 //eof
142 //
icu::MeasureUnit
A unit such as length, mass, volume, currency, etc.
Definition: measunit.h:368
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_I18N_API
#define U_I18N_API
Definition: utypes.h:301
icu::MeasureUnit::clone
virtual MeasureUnit * clone() const
Returns a polymorphic clone of this object.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
icu::MeasureUnit::getDynamicClassID
virtual UClassID getDynamicClassID(void) const override
Returns a unique class ID POLYMORPHICALLY.
icu::TimeUnit
Measurement unit for time units.
Definition: tmunit.h:35
icu::MeasureUnit::operator=
MeasureUnit & operator=(const MeasureUnit &other)
Copy assignment operator.
icu::MeasureUnit::getStaticClassID
static UClassID getStaticClassID(void)
Return the class ID for this class.
icu::TimeUnit::UTimeUnitFields
UTimeUnitFields
Constants for all the time units we supported.
Definition: tmunit.h:41
measunit.h
C++ API: A unit for measuring a quantity.