ICU 74.1 74.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
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:369
icu::TimeUnit
Measurement unit for time units.
Definition: tmunit.h:35
icu::TimeUnit::operator=
TimeUnit & operator=(const TimeUnit &other)
Assignment operator.
icu::TimeUnit::getStaticClassID
static UClassID getStaticClassID()
Returns the class ID for this class.
icu::TimeUnit::TimeUnit
TimeUnit(const TimeUnit &other)
Copy operator.
icu::TimeUnit::~TimeUnit
virtual ~TimeUnit()
Destructor.
icu::TimeUnit::UTimeUnitFields
UTimeUnitFields
Constants for all the time units we supported.
Definition: tmunit.h:41
icu::TimeUnit::getTimeUnitField
UTimeUnitFields getTimeUnitField() const
Get time unit field.
icu::TimeUnit::clone
virtual TimeUnit * clone() const override
Override clone.
icu::TimeUnit::getDynamicClassID
virtual UClassID getDynamicClassID() const override
Returns a unique class ID for this object POLYMORPHICALLY.
icu::TimeUnit::createInstance
static TimeUnit * createInstance(UTimeUnitFields timeUnitField, UErrorCode &status)
Create Instance.
measunit.h
C++ API: A unit for measuring a quantity.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
U_I18N_API
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition: utypes.h:301