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
reldatefmt.h
Go to the documentation of this file.
1
/*
2
*****************************************************************************
3
* Copyright (C) 2014-2015, International Business Machines Corporation and
4
* others.
5
* All Rights Reserved.
6
*****************************************************************************
7
*
8
* File RELDATEFMT.H
9
*****************************************************************************
10
*/
11
12
#ifndef __RELDATEFMT_H
13
#define __RELDATEFMT_H
14
15
#include "
unicode/utypes.h
"
16
#include "
unicode/uobject.h
"
17
#include "
unicode/udisplaycontext.h
"
18
#include "
unicode/locid.h
"
19
25
#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION
26
31
typedef
enum
UDateRelativeDateTimeFormatterStyle
{
36
UDAT_STYLE_LONG
,
37
42
UDAT_STYLE_SHORT
,
43
48
UDAT_STYLE_NARROW
,
49
54
UDAT_STYLE_COUNT
55
}
UDateRelativeDateTimeFormatterStyle
;
56
62
typedef
enum
UDateRelativeUnit
{
63
68
UDAT_RELATIVE_SECONDS
,
69
74
UDAT_RELATIVE_MINUTES
,
75
80
UDAT_RELATIVE_HOURS
,
81
86
UDAT_RELATIVE_DAYS
,
87
92
UDAT_RELATIVE_WEEKS
,
93
98
UDAT_RELATIVE_MONTHS
,
99
104
UDAT_RELATIVE_YEARS
,
105
110
UDAT_RELATIVE_UNIT_COUNT
111
}
UDateRelativeUnit
;
112
117
typedef
enum
UDateAbsoluteUnit
{
118
119
// Days of week have to remain together and in order from Sunday to
120
// Saturday.
125
UDAT_ABSOLUTE_SUNDAY
,
126
131
UDAT_ABSOLUTE_MONDAY
,
132
137
UDAT_ABSOLUTE_TUESDAY
,
138
143
UDAT_ABSOLUTE_WEDNESDAY
,
144
149
UDAT_ABSOLUTE_THURSDAY
,
150
155
UDAT_ABSOLUTE_FRIDAY
,
156
161
UDAT_ABSOLUTE_SATURDAY
,
162
167
UDAT_ABSOLUTE_DAY
,
168
173
UDAT_ABSOLUTE_WEEK
,
174
179
UDAT_ABSOLUTE_MONTH
,
180
185
UDAT_ABSOLUTE_YEAR
,
186
191
UDAT_ABSOLUTE_NOW
,
192
197
UDAT_ABSOLUTE_UNIT_COUNT
198
}
UDateAbsoluteUnit
;
199
205
typedef
enum
UDateDirection
{
206
211
UDAT_DIRECTION_LAST_2
,
212
217
UDAT_DIRECTION_LAST
,
218
223
UDAT_DIRECTION_THIS
,
224
229
UDAT_DIRECTION_NEXT
,
230
235
UDAT_DIRECTION_NEXT_2
,
236
241
UDAT_DIRECTION_PLAIN
,
242
247
UDAT_DIRECTION_COUNT
248
}
UDateDirection
;
249
250
251
U_NAMESPACE_BEGIN
252
253
class
RelativeDateTimeCacheData;
254
class
SharedNumberFormat;
255
class
SharedPluralRules;
256
class
SharedBreakIterator;
257
class
NumberFormat;
258
class
UnicodeString;
259
328
class
U_I18N_API
RelativeDateTimeFormatter
:
public
UObject
{
329
public
:
330
335
RelativeDateTimeFormatter
(
UErrorCode
& status);
336
341
RelativeDateTimeFormatter
(
const
Locale
& locale,
UErrorCode
& status);
342
353
RelativeDateTimeFormatter
(
354
const
Locale
& locale,
NumberFormat
*nfToAdopt,
UErrorCode
& status);
355
371
RelativeDateTimeFormatter
(
372
const
Locale
& locale,
373
NumberFormat
*nfToAdopt,
374
UDateRelativeDateTimeFormatterStyle
style,
375
UDisplayContext
capitalizationContext,
376
UErrorCode
& status);
377
382
RelativeDateTimeFormatter
(
const
RelativeDateTimeFormatter
& other);
383
388
RelativeDateTimeFormatter
& operator=(
389
const
RelativeDateTimeFormatter
& other);
390
395
virtual
~
RelativeDateTimeFormatter
();
396
412
UnicodeString
& format(
413
double
quantity,
414
UDateDirection
direction,
415
UDateRelativeUnit
unit,
416
UnicodeString
& appendTo,
417
UErrorCode
& status)
const
;
418
431
UnicodeString
& format(
432
UDateDirection
direction,
433
UDateAbsoluteUnit
unit,
434
UnicodeString
& appendTo,
435
UErrorCode
& status)
const
;
436
449
UnicodeString
& combineDateAndTime(
450
const
UnicodeString
& relativeDateString,
451
const
UnicodeString
& timeString,
452
UnicodeString
& appendTo,
453
UErrorCode
& status)
const
;
454
460
const
NumberFormat
& getNumberFormat()
const
;
461
467
UDisplayContext
getCapitalizationContext()
const
;
468
474
UDateRelativeDateTimeFormatterStyle
getFormatStyle()
const
;
475
476
private
:
477
const
RelativeDateTimeCacheData* fCache;
478
const
SharedNumberFormat *fNumberFormat;
479
const
SharedPluralRules *fPluralRules;
480
UDateRelativeDateTimeFormatterStyle
fStyle;
481
UDisplayContext
fContext;
482
const
SharedBreakIterator *fOptBreakIterator;
483
Locale
fLocale;
484
void
init(
485
NumberFormat
*nfToAdopt,
486
BreakIterator
*brkIter,
487
UErrorCode
&status);
488
void
adjustForContext(
UnicodeString
&)
const
;
489
};
490
491
U_NAMESPACE_END
492
493
#endif
/* !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION*/
494
#endif
Generated on Wed Oct 7 2015 21:17:56 for ICU 56.1 by
1.8.1.2