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