ICU 64.2 64.2

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/umisc.h"
18 #include "unicode/localpointer.h"
19 #include "unicode/uformattedvalue.h"
20
82 struct UDateIntervalFormat;
83 typedef struct UDateIntervalFormat UDateIntervalFormat;
85 #ifndef U_HIDE_DRAFT_API
86 struct UFormattedDateInterval;
91 typedef struct UFormattedDateInterval UFormattedDateInterval;
92 #endif /* U_HIDE_DRAFT_API */
93
118 U_STABLE UDateIntervalFormat* U_EXPORT2
119 udtitvfmt_open(const char* locale,
120 const UChar* skeleton,
121 int32_t skeletonLength,
122 const UChar* tzID,
123 int32_t tzIDLength,
124 UErrorCode* status);
125
132 U_STABLE void U_EXPORT2
133 udtitvfmt_close(UDateIntervalFormat *formatter);
134
135
136 #ifndef U_HIDE_DRAFT_API
137
146 U_CAPI UFormattedDateInterval* U_EXPORT2
147 udtitvfmt_openResult(UErrorCode* ec);
148
171 U_CAPI const UFormattedValue* U_EXPORT2
172 udtitvfmt_resultAsValue(const UFormattedDateInterval* uresult, UErrorCode* ec);
173
180 U_CAPI void U_EXPORT2
181 udtitvfmt_closeResult(UFormattedDateInterval* uresult);
182 #endif /* U_HIDE_DRAFT_API */
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
200 #ifndef U_HIDE_DRAFT_API
201
210 U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattedDateIntervalPointer, UFormattedDateInterval, udtitvfmt_closeResult);
211 #endif /* U_HIDE_DRAFT_API */
212
213 U_NAMESPACE_END
214
215 #endif
216
217
247 U_STABLE int32_t U_EXPORT2
248 udtitvfmt_format(const UDateIntervalFormat* formatter,
249 UDate fromDate,
250 UDate toDate,
251 UChar* result,
252 int32_t resultCapacity,
253 UFieldPosition* position,
254 UErrorCode* status);
255
256
257 #ifndef U_HIDE_DRAFT_API
258
274 U_DRAFT void U_EXPORT2
275 udtitvfmt_formatToResult(
276 const UDateIntervalFormat* formatter,
277 UFormattedDateInterval* result,
278 UDate fromDate,
279 UDate toDate,
280 UErrorCode* status);
281 #endif /* U_HIDE_DRAFT_API */
282
283
284 #endif /* #if !UCONFIG_NO_FORMATTING */
285
286 #endif
uformattedvalue.h
C API: Abstract operations for localized strings.
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:109
udtitvfmt_formatToResult
void udtitvfmt_formatToResult(const UDateIntervalFormat *formatter, UFormattedDateInterval *result, UDate fromDate, UDate toDate, UErrorCode *status)
Formats a date/time range using the conventions established for the UDateIntervalFormat object.
UDate
double UDate
Date and Time data type.
Definition: utypes.h:203
umisc.h
C API:misc definitions.
udtitvfmt_format
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_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 ...
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:137
LocalUDateIntervalFormatPointer
"Smart pointer" class, closes a UDateIntervalFormat via udtitvfmt_close().
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:562
UDateIntervalFormat
struct UDateIntervalFormat UDateIntervalFormat
C typedef for struct UDateIntervalFormat.
Definition: udateintervalformat.h:83
UFieldPosition
A struct representing a range of text containing a specific field.
Definition: umisc.h:34
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
udtitvfmt_openResult
U_CAPI UFormattedDateInterval * udtitvfmt_openResult(UErrorCode *ec)
Creates an object to hold the result of a UDateIntervalFormat operation.
UChar
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:342
UFormattedDateInterval
struct UFormattedDateInterval UFormattedDateInterval
Opaque struct to contain the results of a UDateIntervalFormat operation.
Definition: udateintervalformat.h:91
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:138
LocalUFormattedDateIntervalPointer
"Smart pointer" class, closes a UFormattedDateInterval via udtitvfmt_close().
Definition: udateintervalformat.h:198
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:401
udtitvfmt_close
void udtitvfmt_close(UDateIntervalFormat *formatter)
Close a UDateIntervalFormat object.
udtitvfmt_open
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 ...
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UFormattedValue
struct UFormattedValue UFormattedValue
An abstract formatted value: a string with associated field attributes.
Definition: uformattedvalue.h:362
U_DRAFT
#define U_DRAFT
This is used to declare a function as a draft public ICU C API.
Definition: umachine.h:113
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:111
udtitvfmt_closeResult
U_CAPI void udtitvfmt_closeResult(UFormattedDateInterval *uresult)
Releases the UFormattedDateInterval created by udtitvfmt_openResult().