ICU 58.2 58.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

ureldatefmt.h
Go to the documentation of this file.
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *****************************************************************************************
5 * Copyright (C) 2016, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 *****************************************************************************************
8 */
9
10 #ifndef URELDATEFMT_H
11 #define URELDATEFMT_H
12
13 #include "unicode/utypes.h"
14
15 #if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION
16
17 #include "unicode/unum.h"
18 #include "unicode/udisplaycontext.h"
19 #include "unicode/localpointer.h"
20
44 typedef enum UDateRelativeDateTimeFormatterStyle {
49 UDAT_STYLE_LONG,
50
55 UDAT_STYLE_SHORT,
56
61 UDAT_STYLE_NARROW,
62
63 #ifndef U_HIDE_DEPRECATED_API
64
68 UDAT_STYLE_COUNT
69 #endif // U_HIDE_DEPRECATED_API
70 } UDateRelativeDateTimeFormatterStyle;
71
72 #ifndef U_HIDE_DRAFT_API
73
78 typedef enum URelativeDateTimeUnit {
84 UDAT_REL_UNIT_YEAR,
90 UDAT_REL_UNIT_QUARTER,
96 UDAT_REL_UNIT_MONTH,
102 UDAT_REL_UNIT_WEEK,
108 UDAT_REL_UNIT_DAY,
114 UDAT_REL_UNIT_HOUR,
120 UDAT_REL_UNIT_MINUTE,
126 UDAT_REL_UNIT_SECOND,
132 UDAT_REL_UNIT_SUNDAY,
138 UDAT_REL_UNIT_MONDAY,
144 UDAT_REL_UNIT_TUESDAY,
150 UDAT_REL_UNIT_WEDNESDAY,
156 UDAT_REL_UNIT_THURSDAY,
162 UDAT_REL_UNIT_FRIDAY,
168 UDAT_REL_UNIT_SATURDAY,
169 #ifndef U_HIDE_DEPRECATED_API
170
174 UDAT_REL_UNIT_COUNT
175 #endif // U_HIDE_DEPRECATED_API
176 } URelativeDateTimeUnit;
177 #endif /* U_HIDE_DRAFT_API */
178
179 #ifndef U_HIDE_DRAFT_API
180
185 struct URelativeDateTimeFormatter;
186 typedef struct URelativeDateTimeFormatter URelativeDateTimeFormatter;
221 U_DRAFT URelativeDateTimeFormatter* U_EXPORT2
222 ureldatefmt_open( const char* locale,
223 UNumberFormat* nfToAdopt,
224 UDateRelativeDateTimeFormatterStyle width,
225 UDisplayContext capitalizationContext,
226 UErrorCode* status );
227
234 U_DRAFT void U_EXPORT2
235 ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt);
236
237 #if U_SHOW_CPLUSPLUS_API
238
239 U_NAMESPACE_BEGIN
240
250 U_DEFINE_LOCAL_OPEN_POINTER(LocalURelativeDateTimeFormatterPointer, URelativeDateTimeFormatter, ureldatefmt_close);
251
252 U_NAMESPACE_END
253
254 #endif
255
284 U_DRAFT int32_t U_EXPORT2
285 ureldatefmt_formatNumeric( const URelativeDateTimeFormatter* reldatefmt,
286 double offset,
287 URelativeDateTimeUnit unit,
288 UChar* result,
289 int32_t resultCapacity,
290 UErrorCode* status);
291
320 U_DRAFT int32_t U_EXPORT2
321 ureldatefmt_format( const URelativeDateTimeFormatter* reldatefmt,
322 double offset,
323 URelativeDateTimeUnit unit,
324 UChar* result,
325 int32_t resultCapacity,
326 UErrorCode* status);
327
357 U_DRAFT int32_t U_EXPORT2
358 ureldatefmt_combineDateAndTime( const URelativeDateTimeFormatter* reldatefmt,
359 const UChar * relativeDateString,
360 int32_t relativeDateStringLen,
361 const UChar * timeString,
362 int32_t timeStringLen,
363 UChar* result,
364 int32_t resultCapacity,
365 UErrorCode* status );
366
367 #endif /* U_HIDE_DRAFT_API */
368
369 #endif /* !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION */
370
371 #endif
URelativeDateTimeUnit
URelativeDateTimeUnit
Represents the unit for formatting a relative date.
Definition: ureldatefmt.h:78
ureldatefmt_formatNumeric
int32_t ureldatefmt_formatNumeric(const URelativeDateTimeFormatter *reldatefmt, double offset, URelativeDateTimeUnit unit, UChar *result, int32_t resultCapacity, UErrorCode *status)
Format a combination of URelativeDateTimeUnit and numeric offset using a numeric style, e.g.
ureldatefmt_close
void ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt)
Close a URelativeDateTimeFormatter object.
UDAT_REL_UNIT_SECOND
Specifies that relative unit is second, e.g.
Definition: ureldatefmt.h:126
URelativeDateTimeFormatter
struct URelativeDateTimeFormatter URelativeDateTimeFormatter
C typedef for struct URelativeDateTimeFormatter.
Definition: ureldatefmt.h:186
UDAT_REL_UNIT_WEEK
Specifies that relative unit is week, e.g.
Definition: ureldatefmt.h:102
UDAT_REL_UNIT_MONTH
Specifies that relative unit is month, e.g.
Definition: ureldatefmt.h:96
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:66
UDAT_REL_UNIT_FRIDAY
Specifies that relative unit is Friday, e.g.
Definition: ureldatefmt.h:162
UDAT_REL_UNIT_MONDAY
Specifies that relative unit is Monday, e.g.
Definition: ureldatefmt.h:138
UDAT_STYLE_LONG
Everything spelled out.
Definition: ureldatefmt.h:49
UDAT_REL_UNIT_SATURDAY
Specifies that relative unit is Saturday, e.g.
Definition: ureldatefmt.h:168
udisplaycontext.h
C API: Display context types (enum values)
UDAT_REL_UNIT_MINUTE
Specifies that relative unit is minute, e.g.
Definition: ureldatefmt.h:120
UDAT_REL_UNIT_WEDNESDAY
Specifies that relative unit is Wednesday, e.g.
Definition: ureldatefmt.h:150
UDAT_STYLE_SHORT
Abbreviations used when possible.
Definition: ureldatefmt.h:55
UDAT_REL_UNIT_SUNDAY
Specifies that relative unit is Sunday, e.g.
Definition: ureldatefmt.h:132
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
ureldatefmt_format
int32_t ureldatefmt_format(const URelativeDateTimeFormatter *reldatefmt, double offset, URelativeDateTimeUnit unit, UChar *result, int32_t resultCapacity, UErrorCode *status)
Format a combination of URelativeDateTimeUnit and numeric offset using a text style if possible...
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:530
UNumberFormat
void * UNumberFormat
A number formatter.
Definition: unum.h:136
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
ureldatefmt_open
URelativeDateTimeFormatter * ureldatefmt_open(const char *locale, UNumberFormat *nfToAdopt, UDateRelativeDateTimeFormatterStyle width, UDisplayContext capitalizationContext, UErrorCode *status)
Open a new URelativeDateTimeFormatter object for a given locale using the specified width and capital...
UDAT_STYLE_COUNT
One more than the highest normal UDateRelativeDateTimeFormatterStyle value.
Definition: ureldatefmt.h:68
UDAT_REL_UNIT_QUARTER
Specifies that relative unit is quarter, e.g.
Definition: ureldatefmt.h:90
UDateRelativeDateTimeFormatterStyle
UDateRelativeDateTimeFormatterStyle
The formatting style.
Definition: ureldatefmt.h:44
LocalURelativeDateTimeFormatterPointer
"Smart pointer" class, closes a URelativeDateTimeFormatter via ureldatefmt_close().
UDAT_REL_UNIT_HOUR
Specifies that relative unit is hour, e.g.
Definition: ureldatefmt.h:114
UDAT_STYLE_NARROW
Use the shortest possible form.
Definition: ureldatefmt.h:61
UDAT_REL_UNIT_YEAR
Specifies that relative unit is year, e.g.
Definition: ureldatefmt.h:84
UChar
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:337
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
UDAT_REL_UNIT_TUESDAY
Specifies that relative unit is Tuesday, e.g.
Definition: ureldatefmt.h:144
UDAT_REL_UNIT_DAY
Specifies that relative unit is day, e.g.
Definition: ureldatefmt.h:108
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UDAT_REL_UNIT_THURSDAY
Specifies that relative unit is Thursday, e.g.
Definition: ureldatefmt.h:156
UDAT_REL_UNIT_COUNT
One more than the highest normal URelativeDateTimeUnit value.
Definition: ureldatefmt.h:174
U_DRAFT
#define U_DRAFT
This is used to declare a function as a draft public ICU C API.
Definition: umachine.h:136
unum.h
C API: NumberFormat.
ureldatefmt_combineDateAndTime
int32_t ureldatefmt_combineDateAndTime(const URelativeDateTimeFormatter *reldatefmt, const UChar *relativeDateString, int32_t relativeDateStringLen, const UChar *timeString, int32_t timeStringLen, UChar *result, int32_t resultCapacity, UErrorCode *status)
Combines a relative date string and a time string in this object&#39;s locale.