2 ******************************************************************************
3 * Copyright (C) 2010-2011 Apple Inc. All Rights Reserved.
4 ******************************************************************************
10 #include "unicode/utypes.h"
12 #if !UCONFIG_NO_FORMATTING
14 #include "unicode/umisc.h"
15 #include "unicode/udateintervalformat.h"
18 * NOTE - THE TEMPORARY APPLE INTERFACES DECLARED HERE ARE OBSOLETE, PLEASE USE
19 * THE REAL ICU EQUIVALENTS IN udateintervalformat.h
21 * A UDateIntervalFormat is used to format the range between two UDate values
22 * in a locale-sensitive way, using a skeleton that specifies the precision and
23 * completeness of the information to show. If the range smaller than the resolution
24 * specified by the skeleton, a single date format will be produced. If the range
25 * is larger than the format specified by the skeleton, a locale-specific fallback
26 * will be used to format the items missing from the skeleton.
28 * For example, if the range is 2010-03-04 07:56 - 2010-03-04 19:56 (12 hours)
29 * - The skeleton jm will produce
30 * for en_US, "7:56 AM – 7:56 PM"
31 * for en_GB, "7:56 – 19:56"
32 * - The skeleton MMMd will produce
35 * If the range is 2010-03-04 07:56 - 2010-03-08 16:11 (4 days, 8 hours, 15 minutes)
36 * - The skeleton jm will produce
37 * for en_US, "3/4/2010 7:56 AM – 3/8/2010 4:11 PM"
38 * for en_GB, "4/3/2010 7:56 – 8/3/2010 16:11"
39 * - The skeleton MMMd will produce
40 * for en_US, "Mar 4–8"
41 * for en_GB, "4-8 Mar"
43 * Note, in ICU 4.4 the standard skeletons for which date interval format data
44 * is usually available are as follows; best results will be obtained by using
45 * skeletons from this set, or those formed by combining these standard skeletons
46 * (note that for these skeletons, the length of digit field such as d, y, or
47 * M vs MM is irrelevant (but for non-digit fields such as MMM vs MMMM it is
48 * relevant). Note that a skeleton involving h or H generally explicitly requests
49 * that time style (12- or 24-hour time respectively). For a skeleton that
50 * requests the locale's default time style (h or H), use 'j' instead of h or H.
62 * Locales for which ICU 4.4 seems to have a reasonable amount of this data
64 * af, am, ar, be, bg, bn, ca, cs, da, de (_AT), el, en (_AU,_CA,_GB,_IE,_IN...),
65 * eo, es (_AR,_CL,_CO,...,_US) et, fa, fi, fo, fr (_BE,_CH,_CA), fur, gsw, he,
66 * hr, hu, hy, is, it (_CH), ja, kk, km, ko, lt, lv, mk, ml, mt, nb, nl )_BE),
67 * nn, pl, pt (_PT), rm, ro, ru (_UA), sk, sl, so, sq, sr, sr_Latn, sv, th, to,
68 * tr, uk, ur, vi, zh (_SG), zh_Hant (_HK,_MO)
72 * A UDateIntervalFormat object for use in C programs.
73 * struct UDateIntervalFormat; defined in udateintervalformat.h
77 * Open a new UDateIntervalFormat object using the predefined rules for a
78 * given locale plus a specified skeleton.
80 * The locale for whose rules should be used; may be NULL for
83 * A pattern containing only the fields desired for the interval
84 * format, for example "Hm", "yMMMd", or "yMMMEdHm".
86 * The length of skeleton; may be -1 if the skeleton is zero-terminated.
88 * A pointer to a UErrorCode to receive any errors.
90 * A UDateIntervalFormat object for the specified locale, or NULL
91 * if an error occurred.
92 * @internal/obsolete, use udtitvfmt_open in udateintervalformat.h
94 U_INTERNAL UDateIntervalFormat
* U_EXPORT2
95 udatintv_open(const char* locale
,
96 const UChar
* skeleton
,
97 int32_t skeletonLength
,
101 * Close a UDateIntervalFormat object. Once closed it may no longer be used.
103 * The UDateIntervalFormat object to close.
104 * @internal/obsolete, use udtitvfmt_close in udateintervalformat.h
106 U_INTERNAL
void U_EXPORT2
107 udatintv_close(UDateIntervalFormat
*datintv
);
110 * Formats a date/time range using the conventions established for the
111 * UDateIntervalFormat object.
113 * The UDateIntervalFormat object specifying the format conventions.
115 * The starting point of the range.
117 * The ending point of the range.
119 * A pointer to a buffer to receive the formatted range.
120 * @param resultCapacity
121 * The maximum size of result.
123 * A pointer to a UFieldPosition. On input, position->field is read.
124 * On output, position->beginIndex and position->endIndex indicate
125 * the beginning and ending indices of field number position->field,
126 * if such a field exists. This parameter may be NULL, in which case
127 * no field position data is returned.
129 * A pointer to a UErrorCode to receive any errors.
131 * The total buffer size needed; if greater than resultLength, the
132 * output was truncated.
133 * @internal/obsolete, use udtitvfmt_format in udateintervalformat.h
135 U_INTERNAL
int32_t U_EXPORT2
136 udatintv_format(const UDateIntervalFormat
* datintv
,
140 int32_t resultCapacity
,
141 UFieldPosition
* position
,
144 #endif /* #if !UCONFIG_NO_FORMATTING */