ICU 56.1
56.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
i18n
unicode
tmutfmt.h
Go to the documentation of this file.
1
/*
2
*******************************************************************************
3
* Copyright (C) 2008-2014, Google, International Business Machines Corporation
4
* and others. All Rights Reserved.
5
*******************************************************************************
6
*/
7
8
#ifndef __TMUTFMT_H__
9
#define __TMUTFMT_H__
10
11
#include "
unicode/utypes.h
"
12
19
#if !UCONFIG_NO_FORMATTING
20
#ifndef U_HIDE_DEPRECATED_API
21
22
#include "
unicode/unistr.h
"
23
#include "
unicode/tmunit.h
"
24
#include "
unicode/tmutamt.h
"
25
#include "
unicode/measfmt.h
"
26
#include "
unicode/numfmt.h
"
27
#include "
unicode/plurrule.h
"
28
29
37
enum
UTimeUnitFormatStyle
{
39
UTMUTFMT_FULL_STYLE
,
41
UTMUTFMT_ABBREVIATED_STYLE
,
43
UTMUTFMT_FORMAT_STYLE_COUNT
44
};
45
typedef
enum
UTimeUnitFormatStyle
UTimeUnitFormatStyle
;
48
U_NAMESPACE_BEGIN
49
50
class
Hashtable;
51
class
UVector;
52
83
class
U_I18N_API
TimeUnitFormat
:
public
MeasureFormat
{
84
public
:
85
91
TimeUnitFormat
(
UErrorCode
& status);
92
97
TimeUnitFormat
(
const
Locale
& locale,
UErrorCode
& status);
98
103
TimeUnitFormat
(
const
Locale
& locale,
UTimeUnitFormatStyle
style,
UErrorCode
& status);
104
109
TimeUnitFormat
(
const
TimeUnitFormat
&);
110
115
virtual
~
TimeUnitFormat
();
116
123
virtual
Format
*
clone
(
void
)
const
;
124
129
TimeUnitFormat
&
operator=
(
const
TimeUnitFormat
& other);
130
138
UBool
operator!=
(
const
Format
& other)
const
;
139
146
void
setLocale(
const
Locale
& locale,
UErrorCode
& status);
147
148
155
void
setNumberFormat(
const
NumberFormat
& format,
UErrorCode
& status);
156
162
virtual
void
parseObject
(
const
UnicodeString
& source,
163
Formattable
& result,
164
ParsePosition
& pos)
const
;
165
177
static
UClassID
U_EXPORT2
getStaticClassID
(
void
);
178
190
virtual
UClassID
getDynamicClassID
(
void
)
const
;
191
192
private
:
193
Hashtable* fTimeUnitToCountToPatterns[TimeUnit::UTIMEUNIT_FIELD_COUNT];
194
UTimeUnitFormatStyle
fStyle;
195
196
void
create(
UTimeUnitFormatStyle
style,
UErrorCode
& status);
197
198
// it might actually be simpler to make them Decimal Formats later.
199
// initialize all private data members
200
void
setup(
UErrorCode
& status);
201
202
// initialize data member without fill in data for fTimeUnitToCountToPattern
203
void
initDataMembers(
UErrorCode
& status);
204
205
// initialize fTimeUnitToCountToPatterns from current locale's resource.
206
void
readFromCurrentLocale(
UTimeUnitFormatStyle
style,
const
char
* key,
const
UVector& pluralCounts,
207
UErrorCode
& status);
208
209
// check completeness of fTimeUnitToCountToPatterns against all time units,
210
// and all plural rules, fill in fallback as necessary.
211
void
checkConsistency(
UTimeUnitFormatStyle
style,
const
char
* key,
UErrorCode
& status);
212
213
// fill in fTimeUnitToCountToPatterns from locale fall-back chain
214
void
searchInLocaleChain(
UTimeUnitFormatStyle
style,
const
char
* key,
const
char
* localeName,
215
TimeUnit::UTimeUnitFields
field,
const
UnicodeString
&,
216
const
char
*, Hashtable*,
UErrorCode
&);
217
218
// initialize hash table
219
Hashtable* initHash(
UErrorCode
& status);
220
221
// delete hash table
222
void
deleteHash(Hashtable* htable);
223
224
// copy hash table
225
void
copyHash(
const
Hashtable* source, Hashtable* target,
UErrorCode
& status);
226
// get time unit name, such as "year", from time unit field enum, such as
227
// UTIMEUNIT_YEAR.
228
static
const
char
* getTimeUnitName(
TimeUnit::UTimeUnitFields
field,
UErrorCode
& status);
229
230
};
231
232
inline
UBool
233
TimeUnitFormat::operator!=
(
const
Format
& other)
const
{
234
return
!
operator==
(other);
235
}
236
237
U_NAMESPACE_END
238
239
#endif
/* U_HIDE_DEPRECATED_API */
240
#endif
/* #if !UCONFIG_NO_FORMATTING */
241
242
#endif // __TMUTFMT_H__
243
//eof
Generated on Wed Oct 7 2015 21:17:57 for ICU 56.1 by
1.8.1.2