ICU 78.3: i18n/unicode/udateintervalformat.h Source File

ICU 78.3 78.3

udateintervalformat.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) 2010-2012,2015 International Business Machines
6 * Corporation and others. All Rights Reserved.
7 *****************************************************************************************
8 */
9
10 #ifndef UDATEINTERVALFORMAT_H
11 #define UDATEINTERVALFORMAT_H
12
13 #include "unicode/utypes.h"
14
15 #if !UCONFIG_NO_FORMATTING
16
17 #include "unicode/ucal.h"
18 #include "unicode/umisc.h"
19 #include "unicode/uformattedvalue.h"
20 #include "unicode/udisplaycontext.h"
21
22 #if U_SHOW_CPLUSPLUS_API
23 #include "unicode/localpointer.h"
24 #endif // U_SHOW_CPLUSPLUS_API
25
87 struct UDateIntervalFormat;
88 typedef struct UDateIntervalFormat UDateIntervalFormat;
90 struct UFormattedDateInterval;
95 typedef struct UFormattedDateInterval UFormattedDateInterval;
96
121 U_CAPI UDateIntervalFormat* U_EXPORT2
122 udtitvfmt_open(const char* locale,
123 const UChar* skeleton,
124 int32_t skeletonLength,
125 const UChar* tzID,
126 int32_t tzIDLength,
127 UErrorCode* status);
128
135 U_CAPI void U_EXPORT2
136 udtitvfmt_close(UDateIntervalFormat *formatter);
137
147 U_CAPI UFormattedDateInterval* U_EXPORT2
148 udtitvfmt_openResult(UErrorCode* ec);
149
172 U_CAPI const UFormattedValue* U_EXPORT2
173 udtitvfmt_resultAsValue(const UFormattedDateInterval* uresult, UErrorCode* ec);
174
181 U_CAPI void U_EXPORT2
182 udtitvfmt_closeResult(UFormattedDateInterval* uresult);
183
184
185 #if U_SHOW_CPLUSPLUS_API
186
187 U_NAMESPACE_BEGIN
188
198 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateIntervalFormatPointer, UDateIntervalFormat, udtitvfmt_close);
199
209 U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedDateIntervalPointer, UFormattedDateInterval, udtitvfmt_closeResult);
210
211 U_NAMESPACE_END
212
213 #endif
214
215
245 U_CAPI int32_t U_EXPORT2
246 udtitvfmt_format(const UDateIntervalFormat* formatter,
247 UDate fromDate,
248 UDate toDate,
249 UChar* result,
250 int32_t resultCapacity,
251 UFieldPosition* position,
252 UErrorCode* status);
253
254
271 U_CAPI void U_EXPORT2
272 udtitvfmt_formatToResult(
273 const UDateIntervalFormat* formatter,
274 UDate fromDate,
275 UDate toDate,
276 UFormattedDateInterval* result,
277 UErrorCode* status);
278
296 U_CAPI void U_EXPORT2
297 udtitvfmt_formatCalendarToResult(
298 const UDateIntervalFormat* formatter,
299 UCalendar* fromCalendar,
300 UCalendar* toCalendar,
301 UFormattedDateInterval* result,
302 UErrorCode* status);
303
315 U_CAPI void U_EXPORT2
316 udtitvfmt_setContext(UDateIntervalFormat* formatter, UDisplayContext value, UErrorCode* status);
317
327 U_CAPI UDisplayContext U_EXPORT2
328 udtitvfmt_getContext(const UDateIntervalFormat* formatter, UDisplayContextType type, UErrorCode* status);
329
330 #endif /* #if !UCONFIG_NO_FORMATTING */
331
332 #endif
LocalUDateIntervalFormatPointer
"Smart pointer" class, closes a UDateIntervalFormat via udtitvfmt_close().
LocalUFormattedDateIntervalPointer
"Smart pointer" class, closes a UFormattedDateInterval via udtitvfmt_close().
Definition: udateintervalformat.h:198
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
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:548
UFieldPosition
A struct representing a range of text containing a specific field.
Definition: umisc.h:34
ucal.h
C API: Calendar.
UCalendar
void * UCalendar
A calendar.
Definition: ucal.h:172
udtitvfmt_resultAsValue
U_CAPI const UFormattedValue * udtitvfmt_resultAsValue(const UFormattedDateInterval *uresult, UErrorCode *ec)
Returns a representation of a UFormattedDateInterval as a UFormattedValue, which can be subsequently ...
udtitvfmt_openResult
U_CAPI UFormattedDateInterval * udtitvfmt_openResult(UErrorCode *ec)
Creates an object to hold the result of a UDateIntervalFormat operation.
UFormattedDateInterval
struct UFormattedDateInterval UFormattedDateInterval
Opaque struct to contain the results of a UDateIntervalFormat operation.
Definition: udateintervalformat.h:95
udtitvfmt_setContext
U_CAPI void udtitvfmt_setContext(UDateIntervalFormat *formatter, UDisplayContext value, UErrorCode *status)
Set a particular UDisplayContext value in the formatter, such as UDISPCTX_CAPITALIZATION_FOR_STANDALO...
udtitvfmt_getContext
U_CAPI UDisplayContext udtitvfmt_getContext(const UDateIntervalFormat *formatter, UDisplayContextType type, UErrorCode *status)
Get the formatter's UDisplayContext value for the specified UDisplayContextType, such as UDISPCTX_TYP...
udtitvfmt_format
U_CAPI int32_t udtitvfmt_format(const UDateIntervalFormat *formatter, UDate fromDate, UDate toDate, UChar *result, int32_t resultCapacity, UFieldPosition *position, UErrorCode *status)
Formats a date/time range using the conventions established for the UDateIntervalFormat object.
udtitvfmt_open
U_CAPI UDateIntervalFormat * udtitvfmt_open(const char *locale, const UChar *skeleton, int32_t skeletonLength, const UChar *tzID, int32_t tzIDLength, UErrorCode *status)
Open a new UDateIntervalFormat object using the predefined rules for a given locale plus a specified ...
udtitvfmt_close
U_CAPI void udtitvfmt_close(UDateIntervalFormat *formatter)
Close a UDateIntervalFormat object.
UDateIntervalFormat
struct UDateIntervalFormat UDateIntervalFormat
C typedef for struct UDateIntervalFormat.
Definition: udateintervalformat.h:88
udtitvfmt_formatToResult
U_CAPI void udtitvfmt_formatToResult(const UDateIntervalFormat *formatter, UDate fromDate, UDate toDate, UFormattedDateInterval *result, UErrorCode *status)
Formats a date/time range using the conventions established for the UDateIntervalFormat object.
udtitvfmt_formatCalendarToResult
U_CAPI void udtitvfmt_formatCalendarToResult(const UDateIntervalFormat *formatter, UCalendar *fromCalendar, UCalendar *toCalendar, UFormattedDateInterval *result, UErrorCode *status)
Formats a date/time range using the conventions established for the UDateIntervalFormat object.
udtitvfmt_closeResult
U_CAPI void udtitvfmt_closeResult(UFormattedDateInterval *uresult)
Releases the UFormattedDateInterval created by udtitvfmt_openResult().
udisplaycontext.h
C API: Display context types (enum values)
UDisplayContextType
UDisplayContextType
Display context types, for getting values of a particular setting.
Definition: udisplaycontext.h:27
UDisplayContext
UDisplayContext
Display context settings.
Definition: udisplaycontext.h:64
uformattedvalue.h
C API: Abstract operations for localized strings.
UFormattedValue
struct UFormattedValue UFormattedValue
An abstract formatted value: a string with associated field attributes.
Definition: uformattedvalue.h:368
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
UChar
char16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:400
umisc.h
C API: Miscellaneous definitions.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:509
UDate
double UDate
Date and Time data type.
Definition: utypes.h:218