ICU 75.1 75.1
Loading...
Searching...
No Matches
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
16
17#include "unicode/unum.h"
20
21#if U_SHOW_CPLUSPLUS_API
23#endif // U_SHOW_CPLUSPLUS_API
24
54
60
66
67#ifndef U_HIDE_DEPRECATED_API
73#endif /* U_HIDE_DEPRECATED_API */
75
180
198
199
241ureldatefmt_open( const char* locale,
242 UNumberFormat* nfToAdopt,
244 UDisplayContext capitalizationContext,
245 UErrorCode* status );
246
253U_CAPI void U_EXPORT2
255
262
274
289U_CAPI const UFormattedValue* U_EXPORT2
291
298U_CAPI void U_EXPORT2
300
301
302#if U_SHOW_CPLUSPLUS_API
303
304U_NAMESPACE_BEGIN
305
316
327
328U_NAMESPACE_END
329
330#endif
331
360U_CAPI int32_t U_EXPORT2
362 double offset,
364 UChar* result,
365 int32_t resultCapacity,
366 UErrorCode* status);
367
391U_CAPI void U_EXPORT2
393 const URelativeDateTimeFormatter* reldatefmt,
394 double offset,
397 UErrorCode* status);
398
427U_CAPI int32_t U_EXPORT2
429 double offset,
431 UChar* result,
432 int32_t resultCapacity,
433 UErrorCode* status);
434
461U_CAPI void U_EXPORT2
463 const URelativeDateTimeFormatter* reldatefmt,
464 double offset,
467 UErrorCode* status);
468
498U_CAPI int32_t U_EXPORT2
500 const UChar * relativeDateString,
501 int32_t relativeDateStringLen,
502 const UChar * timeString,
503 int32_t timeStringLen,
504 UChar* result,
505 int32_t resultCapacity,
506 UErrorCode* status );
507
508#endif /* !UCONFIG_NO_FORMATTING */
509
510#endif
"Smart pointer" class, closes a UFormattedRelativeDateTime via ureldatefmt_closeResult().
"Smart pointer" class, closes a URelativeDateTimeFormatter via ureldatefmt_close().
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
C API: Display context types (enum values)
UDisplayContext
Display context settings.
C API: Abstract operations for localized strings.
struct UFormattedValue UFormattedValue
An abstract formatted value: a string with associated field attributes.
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition umachine.h:110
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition umachine.h:378
C API: Compatibility APIs for number formatting.
void * UNumberFormat
A number formatter.
Definition unum.h:145
U_CAPI 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,...
U_CAPI void ureldatefmt_close(URelativeDateTimeFormatter *reldatefmt)
Close a URelativeDateTimeFormatter object.
U_CAPI 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_CAPI 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,...
U_CAPI 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,...
UDateRelativeDateTimeFormatterStyle
The formatting style.
Definition ureldatefmt.h:48
@ UDAT_STYLE_COUNT
One more than the highest normal UDateRelativeDateTimeFormatterStyle value.
Definition ureldatefmt.h:72
@ UDAT_STYLE_LONG
Everything spelled out.
Definition ureldatefmt.h:53
@ UDAT_STYLE_NARROW
Use the shortest possible form.
Definition ureldatefmt.h:65
@ UDAT_STYLE_SHORT
Abbreviations used when possible.
Definition ureldatefmt.h:59
U_CAPI 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...
U_CAPI 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.
URelativeDateTimeUnit
Represents the unit for formatting a relative date.
Definition ureldatefmt.h:81
@ UDAT_REL_UNIT_SATURDAY
Specifies that relative unit is Saturday, e.g.
@ UDAT_REL_UNIT_WEEK
Specifies that relative unit is week, e.g.
@ UDAT_REL_UNIT_SECOND
Specifies that relative unit is second, e.g.
@ UDAT_REL_UNIT_FRIDAY
Specifies that relative unit is Friday, e.g.
@ UDAT_REL_UNIT_DAY
Specifies that relative unit is day, e.g.
@ UDAT_REL_UNIT_COUNT
One more than the highest normal URelativeDateTimeUnit value.
@ UDAT_REL_UNIT_MONTH
Specifies that relative unit is month, e.g.
Definition ureldatefmt.h:99
@ UDAT_REL_UNIT_SUNDAY
Specifies that relative unit is Sunday, e.g.
@ UDAT_REL_UNIT_WEDNESDAY
Specifies that relative unit is Wednesday, e.g.
@ UDAT_REL_UNIT_QUARTER
Specifies that relative unit is quarter, e.g.
Definition ureldatefmt.h:93
@ UDAT_REL_UNIT_HOUR
Specifies that relative unit is hour, e.g.
@ UDAT_REL_UNIT_MINUTE
Specifies that relative unit is minute, e.g.
@ UDAT_REL_UNIT_TUESDAY
Specifies that relative unit is Tuesday, e.g.
@ UDAT_REL_UNIT_THURSDAY
Specifies that relative unit is Thursday, e.g.
@ UDAT_REL_UNIT_MONDAY
Specifies that relative unit is Monday, e.g.
@ UDAT_REL_UNIT_YEAR
Specifies that relative unit is year, e.g.
Definition ureldatefmt.h:87
struct URelativeDateTimeFormatter URelativeDateTimeFormatter
C typedef for struct URelativeDateTimeFormatter.
U_CAPI const UFormattedValue * ureldatefmt_resultAsValue(const UFormattedRelativeDateTime *ufrdt, UErrorCode *ec)
Returns a representation of a UFormattedRelativeDateTime as a UFormattedValue, which can be subsequen...
U_CAPI void ureldatefmt_closeResult(UFormattedRelativeDateTime *ufrdt)
Releases the UFormattedRelativeDateTime created by ureldatefmt_openResult.
struct UFormattedRelativeDateTime UFormattedRelativeDateTime
Opaque struct to contain the results of a URelativeDateTimeFormatter operation.
URelativeDateTimeFormatterField
FieldPosition and UFieldPosition selectors for format fields defined by RelativeDateTimeFormatter.
@ UDAT_REL_LITERAL_FIELD
Represents a literal text string, like "tomorrow" or "days ago".
@ UDAT_REL_NUMERIC_FIELD
Represents a number quantity, like "3" in "3 days ago".
U_CAPI UFormattedRelativeDateTime * ureldatefmt_openResult(UErrorCode *ec)
Creates an object to hold the result of a URelativeDateTimeFormatter operation.
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition utypes.h:415