1 /*
2 *******************************************************************************
3 *
4 *   Copyright (C) 2007-2015, International Business Machines
5 *   Corporation and others.  All Rights Reserved.
6 *
7 *******************************************************************************
8 *   file name:  udatpg.h
9 *   encoding:   US-ASCII
10 *   tab size:   8 (not used)
11 *   indentation:4
12 *
13 *   created on: 2007jul30
14 *   created by: Markus W. Scherer
15 */
16 
17 #ifndef __UDATPG_H__
18 #define __UDATPG_H__
19 
20 #include "unicode/utypes.h"
21 #include "unicode/uenum.h"
22 #include "unicode/localpointer.h"
23 
24 /**
25  * \file
26  * \brief C API: Wrapper for icu::DateTimePatternGenerator (unicode/dtptngen.h).
27  *
28  * UDateTimePatternGenerator provides flexible generation of date format patterns,
29  * like "yy-MM-dd". The user can build up the generator by adding successive
30  * patterns. Once that is done, a query can be made using a "skeleton", which is
31  * a pattern which just includes the desired fields and lengths. The generator
32  * will return the "best fit" pattern corresponding to that skeleton.
33  * <p>The main method people will use is udatpg_getBestPattern, since normally
34  * UDateTimePatternGenerator is pre-built with data from a particular locale.
35  * However, generators can be built directly from other data as well.
36  * <p><i>Issue: may be useful to also have a function that returns the list of
37  * fields in a pattern, in order, since we have that internally.
38  * That would be useful for getting the UI order of field elements.</i>
39  */
40 
41 /**
42  * Opaque type for a date/time pattern generator object.
43  * @stable ICU 3.8
44  */
45 typedef void *UDateTimePatternGenerator;
46 
47 /**
48  * Field number constants for udatpg_getAppendItemFormats() and similar functions.
49  * These constants are separate from UDateFormatField despite semantic overlap
50  * because some fields are merged for the date/time pattern generator.
51  * @stable ICU 3.8
52  */
53 typedef enum UDateTimePatternField {
54     /** @stable ICU 3.8 */
55     UDATPG_ERA_FIELD,
56     /** @stable ICU 3.8 */
57     UDATPG_YEAR_FIELD,
58     /** @stable ICU 3.8 */
59     UDATPG_QUARTER_FIELD,
60     /** @stable ICU 3.8 */
61     UDATPG_MONTH_FIELD,
62     /** @stable ICU 3.8 */
63     UDATPG_WEEK_OF_YEAR_FIELD,
64     /** @stable ICU 3.8 */
65     UDATPG_WEEK_OF_MONTH_FIELD,
66     /** @stable ICU 3.8 */
67     UDATPG_WEEKDAY_FIELD,
68     /** @stable ICU 3.8 */
69     UDATPG_DAY_OF_YEAR_FIELD,
70     /** @stable ICU 3.8 */
71     UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD,
72     /** @stable ICU 3.8 */
73     UDATPG_DAY_FIELD,
74     /** @stable ICU 3.8 */
75     UDATPG_DAYPERIOD_FIELD,
76     /** @stable ICU 3.8 */
77     UDATPG_HOUR_FIELD,
78     /** @stable ICU 3.8 */
79     UDATPG_MINUTE_FIELD,
80     /** @stable ICU 3.8 */
81     UDATPG_SECOND_FIELD,
82     /** @stable ICU 3.8 */
83     UDATPG_FRACTIONAL_SECOND_FIELD,
84     /** @stable ICU 3.8 */
85     UDATPG_ZONE_FIELD,
86     /** @stable ICU 3.8 */
87     UDATPG_FIELD_COUNT
88 } UDateTimePatternField;
89 
90 /**
91  * Masks to control forcing the length of specified fields in the returned
92  * pattern to match those in the skeleton (when this would not happen
93  * otherwise). These may be combined to force the length of multiple fields.
94  * Used with udatpg_getBestPatternWithOptions, udatpg_replaceFieldTypesWithOptions.
95  * @stable ICU 4.4
96  */
97 typedef enum UDateTimePatternMatchOptions {
98     /** @stable ICU 4.4 */
99     UDATPG_MATCH_NO_OPTIONS = 0,
100     /** @stable ICU 4.4 */
101     UDATPG_MATCH_HOUR_FIELD_LENGTH = 1 << UDATPG_HOUR_FIELD,
102 #ifndef U_HIDE_INTERNAL_API
103     /** @internal ICU 4.4 */
104     UDATPG_MATCH_MINUTE_FIELD_LENGTH = 1 << UDATPG_MINUTE_FIELD,
105     /** @internal ICU 4.4 */
106     UDATPG_MATCH_SECOND_FIELD_LENGTH = 1 << UDATPG_SECOND_FIELD,
107 #endif  /* U_HIDE_INTERNAL_API */
108     /** @stable ICU 4.4 */
109     UDATPG_MATCH_ALL_FIELDS_LENGTH = (1 << UDATPG_FIELD_COUNT) - 1
110 } UDateTimePatternMatchOptions;
111 
112 /**
113  * Status return values from udatpg_addPattern().
114  * @stable ICU 3.8
115  */
116 typedef enum UDateTimePatternConflict {
117     /** @stable ICU 3.8 */
118     UDATPG_NO_CONFLICT,
119     /** @stable ICU 3.8 */
120     UDATPG_BASE_CONFLICT,
121     /** @stable ICU 3.8 */
122     UDATPG_CONFLICT,
123     /** @stable ICU 3.8 */
124     UDATPG_CONFLICT_COUNT
125 } UDateTimePatternConflict;
126 
127 /**
128   * Open a generator according to a given locale.
129   * @param locale
130   * @param pErrorCode a pointer to the UErrorCode which must not indicate a
131   *                   failure before the function call.
132   * @return a pointer to UDateTimePatternGenerator.
133   * @stable ICU 3.8
134   */
135 U_STABLE UDateTimePatternGenerator * U_EXPORT2
136 udatpg_open(const char *locale, UErrorCode *pErrorCode);
137 
138 /**
139   * Open an empty generator, to be constructed with udatpg_addPattern(...) etc.
140   * @param pErrorCode a pointer to the UErrorCode which must not indicate a
141   *                   failure before the function call.
142   * @return a pointer to UDateTimePatternGenerator.
143   * @stable ICU 3.8
144   */
145 U_STABLE UDateTimePatternGenerator * U_EXPORT2
146 udatpg_openEmpty(UErrorCode *pErrorCode);
147 
148 /**
149   * Close a generator.
150   * @param dtpg a pointer to UDateTimePatternGenerator.
151   * @stable ICU 3.8
152   */
153 U_STABLE void U_EXPORT2
154 udatpg_close(UDateTimePatternGenerator *dtpg);
155 
156 #if U_SHOW_CPLUSPLUS_API
157 
158 U_NAMESPACE_BEGIN
159 
160 /**
161  * \class LocalUDateTimePatternGeneratorPointer
162  * "Smart pointer" class, closes a UDateTimePatternGenerator via udatpg_close().
163  * For most methods see the LocalPointerBase base class.
164  *
165  * @see LocalPointerBase
166  * @see LocalPointer
167  * @stable ICU 4.4
168  */
169 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateTimePatternGeneratorPointer, UDateTimePatternGenerator, udatpg_close);
170 
171 U_NAMESPACE_END
172 
173 #endif
174 
175 /**
176   * Create a copy pf a generator.
177   * @param dtpg a pointer to UDateTimePatternGenerator to be copied.
178   * @param pErrorCode a pointer to the UErrorCode which must not indicate a
179   *                   failure before the function call.
180   * @return a pointer to a new UDateTimePatternGenerator.
181   * @stable ICU 3.8
182  */
183 U_STABLE UDateTimePatternGenerator * U_EXPORT2
184 udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
185 
186 /**
187  * Get the best pattern matching the input skeleton. It is guaranteed to
188  * have all of the fields in the skeleton.
189  *
190  * Note that this function uses a non-const UDateTimePatternGenerator:
191  * It uses a stateful pattern parser which is set up for each generator object,
192  * rather than creating one for each function call.
193  * Consecutive calls to this function do not affect each other,
194  * but this function cannot be used concurrently on a single generator object.
195  *
196  * @param dtpg a pointer to UDateTimePatternGenerator.
197  * @param skeleton
198  *            The skeleton is a pattern containing only the variable fields.
199  *            For example, "MMMdd" and "mmhh" are skeletons.
200  * @param length the length of skeleton
201  * @param bestPattern
202  *            The best pattern found from the given skeleton.
203  * @param capacity the capacity of bestPattern.
204  * @param pErrorCode a pointer to the UErrorCode which must not indicate a
205  *                   failure before the function call.
206  * @return the length of bestPattern.
207  * @stable ICU 3.8
208  */
209 U_STABLE int32_t U_EXPORT2
210 udatpg_getBestPattern(UDateTimePatternGenerator *dtpg,
211                       const UChar *skeleton, int32_t length,
212                       UChar *bestPattern, int32_t capacity,
213                       UErrorCode *pErrorCode);
214 
215 /**
216  * Get the best pattern matching the input skeleton. It is guaranteed to
217  * have all of the fields in the skeleton.
218  *
219  * Note that this function uses a non-const UDateTimePatternGenerator:
220  * It uses a stateful pattern parser which is set up for each generator object,
221  * rather than creating one for each function call.
222  * Consecutive calls to this function do not affect each other,
223  * but this function cannot be used concurrently on a single generator object.
224  *
225  * @param dtpg a pointer to UDateTimePatternGenerator.
226  * @param skeleton
227  *            The skeleton is a pattern containing only the variable fields.
228  *            For example, "MMMdd" and "mmhh" are skeletons.
229  * @param length the length of skeleton
230  * @param options
231  *            Options for forcing the length of specified fields in the
232  *            returned pattern to match those in the skeleton (when this
233  *            would not happen otherwise). For default behavior, use
234  *            UDATPG_MATCH_NO_OPTIONS.
235  * @param bestPattern
236  *            The best pattern found from the given skeleton.
237  * @param capacity
238  *            the capacity of bestPattern.
239  * @param pErrorCode
240  *            a pointer to the UErrorCode which must not indicate a
241  *            failure before the function call.
242  * @return the length of bestPattern.
243  * @stable ICU 4.4
244  */
245 U_STABLE int32_t U_EXPORT2
246 udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg,
247                                  const UChar *skeleton, int32_t length,
248                                  UDateTimePatternMatchOptions options,
249                                  UChar *bestPattern, int32_t capacity,
250                                  UErrorCode *pErrorCode);
251 
252 /**
253   * Get a unique skeleton from a given pattern. For example,
254   * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd".
255   *
256   * Note that this function uses a non-const UDateTimePatternGenerator:
257   * It uses a stateful pattern parser which is set up for each generator object,
258   * rather than creating one for each function call.
259   * Consecutive calls to this function do not affect each other,
260   * but this function cannot be used concurrently on a single generator object.
261   *
262   * @param unusedDtpg     a pointer to UDateTimePatternGenerator.
263   *    This parameter is no longer used. Callers may pass NULL.
264   * @param pattern  input pattern, such as "dd/MMM".
265   * @param length   the length of pattern.
266   * @param skeleton such as "MMMdd"
267   * @param capacity the capacity of skeleton.
268   * @param pErrorCode a pointer to the UErrorCode which must not indicate a
269   *                  failure before the function call.
270   * @return the length of skeleton.
271   * @stable ICU 3.8
272   */
273 U_STABLE int32_t U_EXPORT2
274 udatpg_getSkeleton(UDateTimePatternGenerator *unusedDtpg,
275                    const UChar *pattern, int32_t length,
276                    UChar *skeleton, int32_t capacity,
277                    UErrorCode *pErrorCode);
278 
279 /**
280  * Get a unique base skeleton from a given pattern. This is the same
281  * as the skeleton, except that differences in length are minimized so
282  * as to only preserve the difference between string and numeric form. So
283  * for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd"
284  * (notice the single d).
285  *
286  * Note that this function uses a non-const UDateTimePatternGenerator:
287  * It uses a stateful pattern parser which is set up for each generator object,
288  * rather than creating one for each function call.
289  * Consecutive calls to this function do not affect each other,
290  * but this function cannot be used concurrently on a single generator object.
291  *
292  * @param unusedDtpg     a pointer to UDateTimePatternGenerator.
293  *    This parameter is no longer used. Callers may pass NULL.
294  * @param pattern  input pattern, such as "dd/MMM".
295  * @param length   the length of pattern.
296  * @param baseSkeleton such as "Md"
297  * @param capacity the capacity of base skeleton.
298  * @param pErrorCode a pointer to the UErrorCode which must not indicate a
299  *                  failure before the function call.
300  * @return the length of baseSkeleton.
301  * @stable ICU 3.8
302  */
303 U_STABLE int32_t U_EXPORT2
304 udatpg_getBaseSkeleton(UDateTimePatternGenerator *unusedDtpg,
305                        const UChar *pattern, int32_t length,
306                        UChar *baseSkeleton, int32_t capacity,
307                        UErrorCode *pErrorCode);
308 
309 /**
310  * Adds a pattern to the generator. If the pattern has the same skeleton as
311  * an existing pattern, and the override parameter is set, then the previous
312  * value is overriden. Otherwise, the previous value is retained. In either
313  * case, the conflicting status is set and previous vale is stored in
314  * conflicting pattern.
315  * <p>
316  * Note that single-field patterns (like "MMM") are automatically added, and
317  * don't need to be added explicitly!
318  *
319  * @param dtpg     a pointer to UDateTimePatternGenerator.
320  * @param pattern  input pattern, such as "dd/MMM"
321  * @param patternLength the length of pattern.
322  * @param override  When existing values are to be overridden use true,
323  *                  otherwise use false.
324  * @param conflictingPattern  Previous pattern with the same skeleton.
325  * @param capacity the capacity of conflictingPattern.
326  * @param pLength a pointer to the length of conflictingPattern.
327  * @param pErrorCode a pointer to the UErrorCode which must not indicate a
328  *                  failure before the function call.
329  * @return conflicting status. The value could be UDATPG_NO_CONFLICT,
330  *                  UDATPG_BASE_CONFLICT or UDATPG_CONFLICT.
331  * @stable ICU 3.8
332  */
333 U_STABLE UDateTimePatternConflict U_EXPORT2
334 udatpg_addPattern(UDateTimePatternGenerator *dtpg,
335                   const UChar *pattern, int32_t patternLength,
336                   UBool override,
337                   UChar *conflictingPattern, int32_t capacity, int32_t *pLength,
338                   UErrorCode *pErrorCode);
339 
340 /**
341   * An AppendItem format is a pattern used to append a field if there is no
342   * good match. For example, suppose that the input skeleton is "GyyyyMMMd",
343   * and there is no matching pattern internally, but there is a pattern
344   * matching "yyyyMMMd", say "d-MM-yyyy". Then that pattern is used, plus the
345   * G. The way these two are conjoined is by using the AppendItemFormat for G
346   * (era). So if that value is, say "{0}, {1}" then the final resulting
347   * pattern is "d-MM-yyyy, G".
348   * <p>
349   * There are actually three available variables: {0} is the pattern so far,
350   * {1} is the element we are adding, and {2} is the name of the element.
351   * <p>
352   * This reflects the way that the CLDR data is organized.
353   *
354   * @param dtpg   a pointer to UDateTimePatternGenerator.
355   * @param field  UDateTimePatternField, such as UDATPG_ERA_FIELD
356   * @param value  pattern, such as "{0}, {1}"
357   * @param length the length of value.
358   * @stable ICU 3.8
359   */
360 U_STABLE void U_EXPORT2
361 udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg,
362                            UDateTimePatternField field,
363                            const UChar *value, int32_t length);
364 
365 /**
366  * Getter corresponding to setAppendItemFormat. Values below 0 or at or
367  * above UDATPG_FIELD_COUNT are illegal arguments.
368  *
369  * @param dtpg   A pointer to UDateTimePatternGenerator.
370  * @param field  UDateTimePatternField, such as UDATPG_ERA_FIELD
371  * @param pLength A pointer that will receive the length of appendItemFormat.
372  * @return appendItemFormat for field.
373  * @stable ICU 3.8
374  */
375 U_STABLE const UChar * U_EXPORT2
376 udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg,
377                            UDateTimePatternField field,
378                            int32_t *pLength);
379 
380 /**
381    * Set the name of field, eg "era" in English for ERA. These are only
382    * used if the corresponding AppendItemFormat is used, and if it contains a
383    * {2} variable.
384    * <p>
385    * This reflects the way that the CLDR data is organized.
386    *
387    * @param dtpg   a pointer to UDateTimePatternGenerator.
388    * @param field  UDateTimePatternField
389    * @param value  name for the field.
390    * @param length the length of value.
391    * @stable ICU 3.8
392    */
393 U_STABLE void U_EXPORT2
394 udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg,
395                          UDateTimePatternField field,
396                          const UChar *value, int32_t length);
397 
398 /**
399  * Getter corresponding to setAppendItemNames. Values below 0 or at or above
400  * UDATPG_FIELD_COUNT are illegal arguments.
401  *
402  * @param dtpg   a pointer to UDateTimePatternGenerator.
403  * @param field  UDateTimePatternField, such as UDATPG_ERA_FIELD
404  * @param pLength A pointer that will receive the length of the name for field.
405  * @return name for field
406  * @stable ICU 3.8
407  */
408 U_STABLE const UChar * U_EXPORT2
409 udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
410                          UDateTimePatternField field,
411                          int32_t *pLength);
412 
413 /**
414  * The DateTimeFormat is a message format pattern used to compose date and
415  * time patterns. The default pattern in the root locale is "{1} {0}", where
416  * {1} will be replaced by the date pattern and {0} will be replaced by the
417  * time pattern; however, other locales may specify patterns such as
418  * "{1}, {0}" or "{1} 'at' {0}", etc.
419  * <p>
420  * This is used when the input skeleton contains both date and time fields,
421  * but there is not a close match among the added patterns. For example,
422  * suppose that this object was created by adding "dd-MMM" and "hh:mm", and
423  * its DateTimeFormat is the default "{1} {0}". Then if the input skeleton
424  * is "MMMdhmm", there is not an exact match, so the input skeleton is
425  * broken up into two components "MMMd" and "hmm". There are close matches
426  * for those two skeletons, so the result is put together with this pattern,
427  * resulting in "d-MMM h:mm".
428  *
429  * @param dtpg a pointer to UDateTimePatternGenerator.
430  * @param dtFormat
431  *            message format pattern, here {1} will be replaced by the date
432  *            pattern and {0} will be replaced by the time pattern.
433  * @param length the length of dtFormat.
434  * @stable ICU 3.8
435  */
436 U_STABLE void U_EXPORT2
437 udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
438                          const UChar *dtFormat, int32_t length);
439 
440 /**
441  * Getter corresponding to setDateTimeFormat.
442  * @param dtpg   a pointer to UDateTimePatternGenerator.
443  * @param pLength A pointer that will receive the length of the format
444  * @return dateTimeFormat.
445  * @stable ICU 3.8
446  */
447 U_STABLE const UChar * U_EXPORT2
448 udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg,
449                          int32_t *pLength);
450 
451 /**
452  * The decimal value is used in formatting fractions of seconds. If the
453  * skeleton contains fractional seconds, then this is used with the
454  * fractional seconds. For example, suppose that the input pattern is
455  * "hhmmssSSSS", and the best matching pattern internally is "H:mm:ss", and
456  * the decimal string is ",". Then the resulting pattern is modified to be
457  * "H:mm:ss,SSSS"
458  *
459  * @param dtpg a pointer to UDateTimePatternGenerator.
460  * @param decimal
461  * @param length the length of decimal.
462  * @stable ICU 3.8
463  */
464 U_STABLE void U_EXPORT2
465 udatpg_setDecimal(UDateTimePatternGenerator *dtpg,
466                   const UChar *decimal, int32_t length);
467 
468 /**
469  * Getter corresponding to setDecimal.
470  *
471  * @param dtpg a pointer to UDateTimePatternGenerator.
472  * @param pLength A pointer that will receive the length of the decimal string.
473  * @return corresponding to the decimal point.
474  * @stable ICU 3.8
475  */
476 U_STABLE const UChar * U_EXPORT2
477 udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
478                   int32_t *pLength);
479 
480 /**
481  * Adjusts the field types (width and subtype) of a pattern to match what is
482  * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a
483  * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be
484  * "dd-MMMM hh:mm". This is used internally to get the best match for the
485  * input skeleton, but can also be used externally.
486  *
487  * Note that this function uses a non-const UDateTimePatternGenerator:
488  * It uses a stateful pattern parser which is set up for each generator object,
489  * rather than creating one for each function call.
490  * Consecutive calls to this function do not affect each other,
491  * but this function cannot be used concurrently on a single generator object.
492  *
493  * @param dtpg a pointer to UDateTimePatternGenerator.
494  * @param pattern Input pattern
495  * @param patternLength the length of input pattern.
496  * @param skeleton
497  * @param skeletonLength the length of input skeleton.
498  * @param dest  pattern adjusted to match the skeleton fields widths and subtypes.
499  * @param destCapacity the capacity of dest.
500  * @param pErrorCode a pointer to the UErrorCode which must not indicate a
501  *                  failure before the function call.
502  * @return the length of dest.
503  * @stable ICU 3.8
504  */
505 U_STABLE int32_t U_EXPORT2
506 udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg,
507                          const UChar *pattern, int32_t patternLength,
508                          const UChar *skeleton, int32_t skeletonLength,
509                          UChar *dest, int32_t destCapacity,
510                          UErrorCode *pErrorCode);
511 
512 /**
513  * Adjusts the field types (width and subtype) of a pattern to match what is
514  * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a
515  * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be
516  * "dd-MMMM hh:mm". This is used internally to get the best match for the
517  * input skeleton, but can also be used externally.
518  *
519  * Note that this function uses a non-const UDateTimePatternGenerator:
520  * It uses a stateful pattern parser which is set up for each generator object,
521  * rather than creating one for each function call.
522  * Consecutive calls to this function do not affect each other,
523  * but this function cannot be used concurrently on a single generator object.
524  *
525  * @param dtpg a pointer to UDateTimePatternGenerator.
526  * @param pattern Input pattern
527  * @param patternLength the length of input pattern.
528  * @param skeleton
529  * @param skeletonLength the length of input skeleton.
530  * @param options
531  *            Options controlling whether the length of specified fields in the
532  *            pattern are adjusted to match those in the skeleton (when this
533  *            would not happen otherwise). For default behavior, use
534  *            UDATPG_MATCH_NO_OPTIONS.
535  * @param dest  pattern adjusted to match the skeleton fields widths and subtypes.
536  * @param destCapacity the capacity of dest.
537  * @param pErrorCode a pointer to the UErrorCode which must not indicate a
538  *                  failure before the function call.
539  * @return the length of dest.
540  * @stable ICU 4.4
541  */
542 U_STABLE int32_t U_EXPORT2
543 udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg,
544                                     const UChar *pattern, int32_t patternLength,
545                                     const UChar *skeleton, int32_t skeletonLength,
546                                     UDateTimePatternMatchOptions options,
547                                     UChar *dest, int32_t destCapacity,
548                                     UErrorCode *pErrorCode);
549 
550 /**
551  * Return a UEnumeration list of all the skeletons in canonical form.
552  * Call udatpg_getPatternForSkeleton() to get the corresponding pattern.
553  *
554  * @param dtpg a pointer to UDateTimePatternGenerator.
555  * @param pErrorCode a pointer to the UErrorCode which must not indicate a
556  *                  failure before the function call
557  * @return a UEnumeration list of all the skeletons
558  *         The caller must close the object.
559  * @stable ICU 3.8
560  */
561 U_STABLE UEnumeration * U_EXPORT2
562 udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
563 
564 /**
565  * Return a UEnumeration list of all the base skeletons in canonical form.
566  *
567  * @param dtpg a pointer to UDateTimePatternGenerator.
568  * @param pErrorCode a pointer to the UErrorCode which must not indicate a
569  *             failure before the function call.
570  * @return a UEnumeration list of all the base skeletons
571  *             The caller must close the object.
572  * @stable ICU 3.8
573  */
574 U_STABLE UEnumeration * U_EXPORT2
575 udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
576 
577 /**
578  * Get the pattern corresponding to a given skeleton.
579  *
580  * @param dtpg a pointer to UDateTimePatternGenerator.
581  * @param skeleton
582  * @param skeletonLength pointer to the length of skeleton.
583  * @param pLength pointer to the length of return pattern.
584  * @return pattern corresponding to a given skeleton.
585  * @stable ICU 3.8
586  */
587 U_STABLE const UChar * U_EXPORT2
588 udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
589                              const UChar *skeleton, int32_t skeletonLength,
590                              int32_t *pLength);
591 
592 #endif
593