ICU 67.1  67.1
ureldatefmt.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) 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"
19 #include "unicode/localpointer.h"
21 
51 
57 
63 
64 #ifndef U_HIDE_DEPRECATED_API
65 
70 #endif /* U_HIDE_DEPRECATED_API */
72 
78 typedef enum URelativeDateTimeUnit {
169 #ifndef U_HIDE_DEPRECATED_API
170 
175 #endif /* U_HIDE_DEPRECATED_API */
177 
195 
196 
238 ureldatefmt_open( const char* locale,
239  UNumberFormat* nfToAdopt,
241  UDisplayContext capitalizationContext,
242  UErrorCode* status );
243 
250 U_STABLE void U_EXPORT2
252 
259 
271 
286 U_STABLE const UFormattedValue* U_EXPORT2
288 
295 U_STABLE void U_EXPORT2
297 
298 
299 #if U_SHOW_CPLUSPLUS_API
300 
301 U_NAMESPACE_BEGIN
302 
313 
324 
325 U_NAMESPACE_END
326 
327 #endif
328 
357 U_STABLE int32_t U_EXPORT2
359  double offset,
361  UChar* result,
362  int32_t resultCapacity,
363  UErrorCode* status);
364 
388 U_STABLE void U_EXPORT2
390  const URelativeDateTimeFormatter* reldatefmt,
391  double offset,
394  UErrorCode* status);
395 
424 U_STABLE int32_t U_EXPORT2
426  double offset,
428  UChar* result,
429  int32_t resultCapacity,
430  UErrorCode* status);
431 
458 U_STABLE void U_EXPORT2
460  const URelativeDateTimeFormatter* reldatefmt,
461  double offset,
464  UErrorCode* status);
465 
495 U_STABLE int32_t U_EXPORT2
497  const UChar * relativeDateString,
498  int32_t relativeDateStringLen,
499  const UChar * timeString,
500  int32_t timeStringLen,
501  UChar* result,
502  int32_t resultCapacity,
503  UErrorCode* status );
504 
505 #endif /* !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION */
506 
507 #endif
Represents a number quantity, like "3" in "3 days ago".
Definition: ureldatefmt.h:193
Represents a literal text string, like "tomorrow" or "days ago".
Definition: ureldatefmt.h:188
URelativeDateTimeUnit
Represents the unit for formatting a relative date.
Definition: ureldatefmt.h:78
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.
C API: Abstract operations for localized strings.
void ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt)
Close a URelativeDateTimeFormatter object.
Specifies that relative unit is second, e.g.
Definition: ureldatefmt.h:126
struct URelativeDateTimeFormatter URelativeDateTimeFormatter
C typedef for struct URelativeDateTimeFormatter.
Definition: ureldatefmt.h:202
Specifies that relative unit is week, e.g.
Definition: ureldatefmt.h:102
Specifies that relative unit is month, e.g.
Definition: ureldatefmt.h:96
struct UFormattedRelativeDateTime UFormattedRelativeDateTime
Opaque struct to contain the results of a URelativeDateTimeFormatter operation.
Definition: ureldatefmt.h:258
UDisplayContext
Display context settings.
URelativeDateTimeFormatterField
FieldPosition and UFieldPosition selectors for format fields defined by RelativeDateTimeFormatter.
Definition: ureldatefmt.h:183
void ureldatefmt_formatNumericToResult(const URelativeDateTimeFormatter *reldatefmt, double offset, URelativeDateTimeUnit unit, UFormattedRelativeDateTime *result, UErrorCode *status)
Format a combination of URelativeDateTimeUnit and numeric offset using a numeric style, e.g.
Specifies that relative unit is Friday, e.g.
Definition: ureldatefmt.h:162
Specifies that relative unit is Monday, e.g.
Definition: ureldatefmt.h:138
Everything spelled out.
Definition: ureldatefmt.h:50
Specifies that relative unit is Saturday, e.g.
Definition: ureldatefmt.h:168
C API: Display context types (enum values)
Specifies that relative unit is minute, e.g.
Definition: ureldatefmt.h:120
Specifies that relative unit is Wednesday, e.g.
Definition: ureldatefmt.h:150
Abbreviations used when possible.
Definition: ureldatefmt.h:56
Specifies that relative unit is Sunday, e.g.
Definition: ureldatefmt.h:132
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...
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:550
void * UNumberFormat
A number formatter.
Definition: unum.h:141
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
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...
One more than the highest normal UDateRelativeDateTimeFormatterStyle value.
Definition: ureldatefmt.h:69
void ureldatefmt_formatToResult(const URelativeDateTimeFormatter *reldatefmt, double offset, URelativeDateTimeUnit unit, UFormattedRelativeDateTime *result, UErrorCode *status)
Format a combination of URelativeDateTimeUnit and numeric offset using a text style if possible...
Specifies that relative unit is quarter, e.g.
Definition: ureldatefmt.h:90
UDateRelativeDateTimeFormatterStyle
The formatting style.
Definition: ureldatefmt.h:45
"Smart pointer" class, closes a URelativeDateTimeFormatter via ureldatefmt_close().
Specifies that relative unit is hour, e.g.
Definition: ureldatefmt.h:114
Use the shortest possible form.
Definition: ureldatefmt.h:62
void ureldatefmt_closeResult(UFormattedRelativeDateTime *ufrdt)
Releases the UFormattedRelativeDateTime created by ureldatefmt_openResult.
Specifies that relative unit is year, e.g.
Definition: ureldatefmt.h:84
const UFormattedValue * ureldatefmt_resultAsValue(const UFormattedRelativeDateTime *ufrdt, UErrorCode *ec)
Returns a representation of a UFormattedRelativeDateTime as a UFormattedValue, which can be subsequen...
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:376
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
Specifies that relative unit is Tuesday, e.g.
Definition: ureldatefmt.h:144
Specifies that relative unit is day, e.g.
Definition: ureldatefmt.h:108
Basic definitions for ICU, for both C and C++ APIs.
Specifies that relative unit is Thursday, e.g.
Definition: ureldatefmt.h:156
UFormattedRelativeDateTime * ureldatefmt_openResult(UErrorCode *ec)
Creates an object to hold the result of a URelativeDateTimeFormatter operation.
"Smart pointer" class, closes a UFormattedRelativeDateTime via ureldatefmt_closeResult().
Definition: ureldatefmt.h:312
struct UFormattedValue UFormattedValue
An abstract formatted value: a string with associated field attributes.
One more than the highest normal URelativeDateTimeUnit value.
Definition: ureldatefmt.h:174
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:111
C API: Compatibility APIs for number formatting.
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's locale.