1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 *******************************************************************************
6 * Copyright (C) 2007-2015, International Business Machines
7 * Corporation and others. All Rights Reserved.
9 *******************************************************************************
12 * tab size: 8 (not used)
15 * created on: 2007jul30
16 * created by: Markus W. Scherer
22 #include "unicode/utypes.h"
23 #include "unicode/uenum.h"
24 #include "unicode/localpointer.h"
28 * \brief C API: Wrapper for icu::DateTimePatternGenerator (unicode/dtptngen.h).
30 * UDateTimePatternGenerator provides flexible generation of date format patterns,
31 * like "yy-MM-dd". The user can build up the generator by adding successive
32 * patterns. Once that is done, a query can be made using a "skeleton", which is
33 * a pattern which just includes the desired fields and lengths. The generator
34 * will return the "best fit" pattern corresponding to that skeleton.
35 * <p>The main method people will use is udatpg_getBestPattern, since normally
36 * UDateTimePatternGenerator is pre-built with data from a particular locale.
37 * However, generators can be built directly from other data as well.
38 * <p><i>Issue: may be useful to also have a function that returns the list of
39 * fields in a pattern, in order, since we have that internally.
40 * That would be useful for getting the UI order of field elements.</i>
44 * Opaque type for a date/time pattern generator object.
47 typedef void *UDateTimePatternGenerator
;
50 * Field number constants for udatpg_getAppendItemFormats() and similar functions.
51 * These constants are separate from UDateFormatField despite semantic overlap
52 * because some fields are merged for the date/time pattern generator.
55 typedef enum UDateTimePatternField
{
56 /** @stable ICU 3.8 */
58 /** @stable ICU 3.8 */
60 /** @stable ICU 3.8 */
62 /** @stable ICU 3.8 */
64 /** @stable ICU 3.8 */
65 UDATPG_WEEK_OF_YEAR_FIELD
,
66 /** @stable ICU 3.8 */
67 UDATPG_WEEK_OF_MONTH_FIELD
,
68 /** @stable ICU 3.8 */
70 /** @stable ICU 3.8 */
71 UDATPG_DAY_OF_YEAR_FIELD
,
72 /** @stable ICU 3.8 */
73 UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD
,
74 /** @stable ICU 3.8 */
76 /** @stable ICU 3.8 */
77 UDATPG_DAYPERIOD_FIELD
,
78 /** @stable ICU 3.8 */
80 /** @stable ICU 3.8 */
82 /** @stable ICU 3.8 */
84 /** @stable ICU 3.8 */
85 UDATPG_FRACTIONAL_SECOND_FIELD
,
86 /** @stable ICU 3.8 */
89 /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
90 * it is needed for layout of DateTimePatternGenerator object. */
91 #ifndef U_FORCE_HIDE_DEPRECATED_API
93 * One more than the highest normal UDateTimePatternField value.
94 * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
97 #endif // U_FORCE_HIDE_DEPRECATED_API
98 } UDateTimePatternField
;
101 * Field display name width constants for udatpg_getFieldDisplayName().
104 typedef enum UDateTimePGDisplayWidth
{
105 /** @stable ICU 61 */
107 /** @stable ICU 61 */
109 /** @stable ICU 61 */
111 } UDateTimePGDisplayWidth
;
114 * Masks to control forcing the length of specified fields in the returned
115 * pattern to match those in the skeleton (when this would not happen
116 * otherwise). These may be combined to force the length of multiple fields.
117 * Used with udatpg_getBestPatternWithOptions, udatpg_replaceFieldTypesWithOptions.
120 typedef enum UDateTimePatternMatchOptions
{
121 /** @stable ICU 4.4 */
122 UDATPG_MATCH_NO_OPTIONS
= 0,
123 /** @stable ICU 4.4 */
124 UDATPG_MATCH_HOUR_FIELD_LENGTH
= 1 << UDATPG_HOUR_FIELD
,
125 #ifndef U_HIDE_INTERNAL_API
126 /** @internal ICU 4.4 */
127 UDATPG_MATCH_MINUTE_FIELD_LENGTH
= 1 << UDATPG_MINUTE_FIELD
,
128 /** @internal ICU 4.4 */
129 UDATPG_MATCH_SECOND_FIELD_LENGTH
= 1 << UDATPG_SECOND_FIELD
,
130 #endif /* U_HIDE_INTERNAL_API */
131 /** @stable ICU 4.4 */
132 UDATPG_MATCH_ALL_FIELDS_LENGTH
= (1 << UDATPG_FIELD_COUNT
) - 1,
133 /** @internal, Apple-specific for now */
134 UADATPG_FORCE_12_HOUR_CYCLE
= 1 << 29,
135 /** @internal, Apple-specific for now */
136 UADATPG_FORCE_24_HOUR_CYCLE
= 1 << 30,
137 /** @internal, Apple-specific for now */
138 UADATPG_FORCE_HOUR_CYCLE_MASK
= 3 << 29,
139 } UDateTimePatternMatchOptions
;
142 * Status return values from udatpg_addPattern().
145 typedef enum UDateTimePatternConflict
{
146 /** @stable ICU 3.8 */
148 /** @stable ICU 3.8 */
149 UDATPG_BASE_CONFLICT
,
150 /** @stable ICU 3.8 */
152 #ifndef U_HIDE_DEPRECATED_API
154 * One more than the highest normal UDateTimePatternConflict value.
155 * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
157 UDATPG_CONFLICT_COUNT
158 #endif // U_HIDE_DEPRECATED_API
159 } UDateTimePatternConflict
;
162 * Open a generator according to a given locale.
164 * @param pErrorCode a pointer to the UErrorCode which must not indicate a
165 * failure before the function call.
166 * @return a pointer to UDateTimePatternGenerator.
169 U_STABLE UDateTimePatternGenerator
* U_EXPORT2
170 udatpg_open(const char *locale
, UErrorCode
*pErrorCode
);
173 * Open an empty generator, to be constructed with udatpg_addPattern(...) etc.
174 * @param pErrorCode a pointer to the UErrorCode which must not indicate a
175 * failure before the function call.
176 * @return a pointer to UDateTimePatternGenerator.
179 U_STABLE UDateTimePatternGenerator
* U_EXPORT2
180 udatpg_openEmpty(UErrorCode
*pErrorCode
);
184 * @param dtpg a pointer to UDateTimePatternGenerator.
187 U_STABLE
void U_EXPORT2
188 udatpg_close(UDateTimePatternGenerator
*dtpg
);
190 #if U_SHOW_CPLUSPLUS_API
195 * \class LocalUDateTimePatternGeneratorPointer
196 * "Smart pointer" class, closes a UDateTimePatternGenerator via udatpg_close().
197 * For most methods see the LocalPointerBase base class.
199 * @see LocalPointerBase
203 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateTimePatternGeneratorPointer
, UDateTimePatternGenerator
, udatpg_close
);
210 * Create a copy pf a generator.
211 * @param dtpg a pointer to UDateTimePatternGenerator to be copied.
212 * @param pErrorCode a pointer to the UErrorCode which must not indicate a
213 * failure before the function call.
214 * @return a pointer to a new UDateTimePatternGenerator.
217 U_STABLE UDateTimePatternGenerator
* U_EXPORT2
218 udatpg_clone(const UDateTimePatternGenerator
*dtpg
, UErrorCode
*pErrorCode
);
221 * Get the best pattern matching the input skeleton. It is guaranteed to
222 * have all of the fields in the skeleton.
224 * Note that this function uses a non-const UDateTimePatternGenerator:
225 * It uses a stateful pattern parser which is set up for each generator object,
226 * rather than creating one for each function call.
227 * Consecutive calls to this function do not affect each other,
228 * but this function cannot be used concurrently on a single generator object.
230 * @param dtpg a pointer to UDateTimePatternGenerator.
232 * The skeleton is a pattern containing only the variable fields.
233 * For example, "MMMdd" and "mmhh" are skeletons.
234 * @param length the length of skeleton
236 * The best pattern found from the given skeleton.
237 * @param capacity the capacity of bestPattern.
238 * @param pErrorCode a pointer to the UErrorCode which must not indicate a
239 * failure before the function call.
240 * @return the length of bestPattern.
243 U_STABLE
int32_t U_EXPORT2
244 udatpg_getBestPattern(UDateTimePatternGenerator
*dtpg
,
245 const UChar
*skeleton
, int32_t length
,
246 UChar
*bestPattern
, int32_t capacity
,
247 UErrorCode
*pErrorCode
);
250 * Get the best pattern matching the input skeleton. It is guaranteed to
251 * have all of the fields in the skeleton.
253 * Note that this function uses a non-const UDateTimePatternGenerator:
254 * It uses a stateful pattern parser which is set up for each generator object,
255 * rather than creating one for each function call.
256 * Consecutive calls to this function do not affect each other,
257 * but this function cannot be used concurrently on a single generator object.
259 * @param dtpg a pointer to UDateTimePatternGenerator.
261 * The skeleton is a pattern containing only the variable fields.
262 * For example, "MMMdd" and "mmhh" are skeletons.
263 * @param length the length of skeleton
265 * Options for forcing the length of specified fields in the
266 * returned pattern to match those in the skeleton (when this
267 * would not happen otherwise). For default behavior, use
268 * UDATPG_MATCH_NO_OPTIONS.
270 * The best pattern found from the given skeleton.
272 * the capacity of bestPattern.
274 * a pointer to the UErrorCode which must not indicate a
275 * failure before the function call.
276 * @return the length of bestPattern.
279 U_STABLE
int32_t U_EXPORT2
280 udatpg_getBestPatternWithOptions(UDateTimePatternGenerator
*dtpg
,
281 const UChar
*skeleton
, int32_t length
,
282 UDateTimePatternMatchOptions options
,
283 UChar
*bestPattern
, int32_t capacity
,
284 UErrorCode
*pErrorCode
);
287 * Get a unique skeleton from a given pattern. For example,
288 * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd".
290 * Note that this function uses a non-const UDateTimePatternGenerator:
291 * It uses a stateful pattern parser which is set up for each generator object,
292 * rather than creating one for each function call.
293 * Consecutive calls to this function do not affect each other,
294 * but this function cannot be used concurrently on a single generator object.
296 * @param unusedDtpg a pointer to UDateTimePatternGenerator.
297 * This parameter is no longer used. Callers may pass NULL.
298 * @param pattern input pattern, such as "dd/MMM".
299 * @param length the length of pattern.
300 * @param skeleton such as "MMMdd"
301 * @param capacity the capacity of skeleton.
302 * @param pErrorCode a pointer to the UErrorCode which must not indicate a
303 * failure before the function call.
304 * @return the length of skeleton.
307 U_STABLE
int32_t U_EXPORT2
308 udatpg_getSkeleton(UDateTimePatternGenerator
*unusedDtpg
,
309 const UChar
*pattern
, int32_t length
,
310 UChar
*skeleton
, int32_t capacity
,
311 UErrorCode
*pErrorCode
);
314 * Get a unique base skeleton from a given pattern. This is the same
315 * as the skeleton, except that differences in length are minimized so
316 * as to only preserve the difference between string and numeric form. So
317 * for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd"
318 * (notice the single d).
320 * Note that this function uses a non-const UDateTimePatternGenerator:
321 * It uses a stateful pattern parser which is set up for each generator object,
322 * rather than creating one for each function call.
323 * Consecutive calls to this function do not affect each other,
324 * but this function cannot be used concurrently on a single generator object.
326 * @param unusedDtpg a pointer to UDateTimePatternGenerator.
327 * This parameter is no longer used. Callers may pass NULL.
328 * @param pattern input pattern, such as "dd/MMM".
329 * @param length the length of pattern.
330 * @param baseSkeleton such as "Md"
331 * @param capacity the capacity of base skeleton.
332 * @param pErrorCode a pointer to the UErrorCode which must not indicate a
333 * failure before the function call.
334 * @return the length of baseSkeleton.
337 U_STABLE
int32_t U_EXPORT2
338 udatpg_getBaseSkeleton(UDateTimePatternGenerator
*unusedDtpg
,
339 const UChar
*pattern
, int32_t length
,
340 UChar
*baseSkeleton
, int32_t capacity
,
341 UErrorCode
*pErrorCode
);
344 * Adds a pattern to the generator. If the pattern has the same skeleton as
345 * an existing pattern, and the override parameter is set, then the previous
346 * value is overriden. Otherwise, the previous value is retained. In either
347 * case, the conflicting status is set and previous vale is stored in
348 * conflicting pattern.
350 * Note that single-field patterns (like "MMM") are automatically added, and
351 * don't need to be added explicitly!
353 * @param dtpg a pointer to UDateTimePatternGenerator.
354 * @param pattern input pattern, such as "dd/MMM"
355 * @param patternLength the length of pattern.
356 * @param override When existing values are to be overridden use true,
357 * otherwise use false.
358 * @param conflictingPattern Previous pattern with the same skeleton.
359 * @param capacity the capacity of conflictingPattern.
360 * @param pLength a pointer to the length of conflictingPattern.
361 * @param pErrorCode a pointer to the UErrorCode which must not indicate a
362 * failure before the function call.
363 * @return conflicting status. The value could be UDATPG_NO_CONFLICT,
364 * UDATPG_BASE_CONFLICT or UDATPG_CONFLICT.
367 U_STABLE UDateTimePatternConflict U_EXPORT2
368 udatpg_addPattern(UDateTimePatternGenerator
*dtpg
,
369 const UChar
*pattern
, int32_t patternLength
,
371 UChar
*conflictingPattern
, int32_t capacity
, int32_t *pLength
,
372 UErrorCode
*pErrorCode
);
375 * An AppendItem format is a pattern used to append a field if there is no
376 * good match. For example, suppose that the input skeleton is "GyyyyMMMd",
377 * and there is no matching pattern internally, but there is a pattern
378 * matching "yyyyMMMd", say "d-MM-yyyy". Then that pattern is used, plus the
379 * G. The way these two are conjoined is by using the AppendItemFormat for G
380 * (era). So if that value is, say "{0}, {1}" then the final resulting
381 * pattern is "d-MM-yyyy, G".
383 * There are actually three available variables: {0} is the pattern so far,
384 * {1} is the element we are adding, and {2} is the name of the element.
386 * This reflects the way that the CLDR data is organized.
388 * @param dtpg a pointer to UDateTimePatternGenerator.
389 * @param field UDateTimePatternField, such as UDATPG_ERA_FIELD
390 * @param value pattern, such as "{0}, {1}"
391 * @param length the length of value.
394 U_STABLE
void U_EXPORT2
395 udatpg_setAppendItemFormat(UDateTimePatternGenerator
*dtpg
,
396 UDateTimePatternField field
,
397 const UChar
*value
, int32_t length
);
400 * Getter corresponding to setAppendItemFormat. Values below 0 or at or
401 * above UDATPG_FIELD_COUNT are illegal arguments.
403 * @param dtpg A pointer to UDateTimePatternGenerator.
404 * @param field UDateTimePatternField, such as UDATPG_ERA_FIELD
405 * @param pLength A pointer that will receive the length of appendItemFormat.
406 * @return appendItemFormat for field.
409 U_STABLE
const UChar
* U_EXPORT2
410 udatpg_getAppendItemFormat(const UDateTimePatternGenerator
*dtpg
,
411 UDateTimePatternField field
,
415 * Set the name of field, eg "era" in English for ERA. These are only
416 * used if the corresponding AppendItemFormat is used, and if it contains a
419 * This reflects the way that the CLDR data is organized.
421 * @param dtpg a pointer to UDateTimePatternGenerator.
422 * @param field UDateTimePatternField
423 * @param value name for the field.
424 * @param length the length of value.
427 U_STABLE
void U_EXPORT2
428 udatpg_setAppendItemName(UDateTimePatternGenerator
*dtpg
,
429 UDateTimePatternField field
,
430 const UChar
*value
, int32_t length
);
433 * Getter corresponding to setAppendItemNames. Values below 0 or at or above
434 * UDATPG_FIELD_COUNT are illegal arguments. Note: The more general function
435 * for getting date/time field display names is udatpg_getFieldDisplayName.
437 * @param dtpg a pointer to UDateTimePatternGenerator.
438 * @param field UDateTimePatternField, such as UDATPG_ERA_FIELD
439 * @param pLength A pointer that will receive the length of the name for field.
440 * @return name for field
441 * @see udatpg_getFieldDisplayName
444 U_STABLE
const UChar
* U_EXPORT2
445 udatpg_getAppendItemName(const UDateTimePatternGenerator
*dtpg
,
446 UDateTimePatternField field
,
450 * The general interface to get a display name for a particular date/time field,
451 * in one of several possible display widths.
454 * A pointer to the UDateTimePatternGenerator object with the localized
457 * The desired UDateTimePatternField, such as UDATPG_ERA_FIELD.
459 * The desired UDateTimePGDisplayWidth, such as UDATPG_ABBREVIATED.
461 * A pointer to a buffer to receive the NULL-terminated display name. If the name
462 * fits into fieldName but cannot be NULL-terminated (length == capacity) then
463 * the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the name doesn't
464 * fit into fieldName then the error code is set to U_BUFFER_OVERFLOW_ERROR.
466 * The size of fieldName (in UChars).
468 * A pointer to a UErrorCode to receive any errors
470 * The full length of the name; if greater than capacity, fieldName contains a
474 U_STABLE
int32_t U_EXPORT2
475 udatpg_getFieldDisplayName(const UDateTimePatternGenerator
*dtpg
,
476 UDateTimePatternField field
,
477 UDateTimePGDisplayWidth width
,
478 UChar
*fieldName
, int32_t capacity
,
479 UErrorCode
*pErrorCode
);
482 * The DateTimeFormat is a message format pattern used to compose date and
483 * time patterns. The default pattern in the root locale is "{1} {0}", where
484 * {1} will be replaced by the date pattern and {0} will be replaced by the
485 * time pattern; however, other locales may specify patterns such as
486 * "{1}, {0}" or "{1} 'at' {0}", etc.
488 * This is used when the input skeleton contains both date and time fields,
489 * but there is not a close match among the added patterns. For example,
490 * suppose that this object was created by adding "dd-MMM" and "hh:mm", and
491 * its DateTimeFormat is the default "{1} {0}". Then if the input skeleton
492 * is "MMMdhmm", there is not an exact match, so the input skeleton is
493 * broken up into two components "MMMd" and "hmm". There are close matches
494 * for those two skeletons, so the result is put together with this pattern,
495 * resulting in "d-MMM h:mm".
497 * @param dtpg a pointer to UDateTimePatternGenerator.
499 * message format pattern, here {1} will be replaced by the date
500 * pattern and {0} will be replaced by the time pattern.
501 * @param length the length of dtFormat.
504 U_STABLE
void U_EXPORT2
505 udatpg_setDateTimeFormat(const UDateTimePatternGenerator
*dtpg
,
506 const UChar
*dtFormat
, int32_t length
);
509 * Getter corresponding to setDateTimeFormat.
510 * @param dtpg a pointer to UDateTimePatternGenerator.
511 * @param pLength A pointer that will receive the length of the format
512 * @return dateTimeFormat.
515 U_STABLE
const UChar
* U_EXPORT2
516 udatpg_getDateTimeFormat(const UDateTimePatternGenerator
*dtpg
,
520 * The decimal value is used in formatting fractions of seconds. If the
521 * skeleton contains fractional seconds, then this is used with the
522 * fractional seconds. For example, suppose that the input pattern is
523 * "hhmmssSSSS", and the best matching pattern internally is "H:mm:ss", and
524 * the decimal string is ",". Then the resulting pattern is modified to be
527 * @param dtpg a pointer to UDateTimePatternGenerator.
529 * @param length the length of decimal.
532 U_STABLE
void U_EXPORT2
533 udatpg_setDecimal(UDateTimePatternGenerator
*dtpg
,
534 const UChar
*decimal
, int32_t length
);
537 * Getter corresponding to setDecimal.
539 * @param dtpg a pointer to UDateTimePatternGenerator.
540 * @param pLength A pointer that will receive the length of the decimal string.
541 * @return corresponding to the decimal point.
544 U_STABLE
const UChar
* U_EXPORT2
545 udatpg_getDecimal(const UDateTimePatternGenerator
*dtpg
,
549 * Adjusts the field types (width and subtype) of a pattern to match what is
550 * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a
551 * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be
552 * "dd-MMMM hh:mm". This is used internally to get the best match for the
553 * input skeleton, but can also be used externally.
555 * Note that this function uses a non-const UDateTimePatternGenerator:
556 * It uses a stateful pattern parser which is set up for each generator object,
557 * rather than creating one for each function call.
558 * Consecutive calls to this function do not affect each other,
559 * but this function cannot be used concurrently on a single generator object.
561 * @param dtpg a pointer to UDateTimePatternGenerator.
562 * @param pattern Input pattern
563 * @param patternLength the length of input pattern.
565 * @param skeletonLength the length of input skeleton.
566 * @param dest pattern adjusted to match the skeleton fields widths and subtypes.
567 * @param destCapacity the capacity of dest.
568 * @param pErrorCode a pointer to the UErrorCode which must not indicate a
569 * failure before the function call.
570 * @return the length of dest.
573 U_STABLE
int32_t U_EXPORT2
574 udatpg_replaceFieldTypes(UDateTimePatternGenerator
*dtpg
,
575 const UChar
*pattern
, int32_t patternLength
,
576 const UChar
*skeleton
, int32_t skeletonLength
,
577 UChar
*dest
, int32_t destCapacity
,
578 UErrorCode
*pErrorCode
);
581 * Adjusts the field types (width and subtype) of a pattern to match what is
582 * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a
583 * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be
584 * "dd-MMMM hh:mm". This is used internally to get the best match for the
585 * input skeleton, but can also be used externally.
587 * Note that this function uses a non-const UDateTimePatternGenerator:
588 * It uses a stateful pattern parser which is set up for each generator object,
589 * rather than creating one for each function call.
590 * Consecutive calls to this function do not affect each other,
591 * but this function cannot be used concurrently on a single generator object.
593 * @param dtpg a pointer to UDateTimePatternGenerator.
594 * @param pattern Input pattern
595 * @param patternLength the length of input pattern.
597 * @param skeletonLength the length of input skeleton.
599 * Options controlling whether the length of specified fields in the
600 * pattern are adjusted to match those in the skeleton (when this
601 * would not happen otherwise). For default behavior, use
602 * UDATPG_MATCH_NO_OPTIONS.
603 * @param dest pattern adjusted to match the skeleton fields widths and subtypes.
604 * @param destCapacity the capacity of dest.
605 * @param pErrorCode a pointer to the UErrorCode which must not indicate a
606 * failure before the function call.
607 * @return the length of dest.
610 U_STABLE
int32_t U_EXPORT2
611 udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator
*dtpg
,
612 const UChar
*pattern
, int32_t patternLength
,
613 const UChar
*skeleton
, int32_t skeletonLength
,
614 UDateTimePatternMatchOptions options
,
615 UChar
*dest
, int32_t destCapacity
,
616 UErrorCode
*pErrorCode
);
619 * Return a UEnumeration list of all the skeletons in canonical form.
620 * Call udatpg_getPatternForSkeleton() to get the corresponding pattern.
622 * @param dtpg a pointer to UDateTimePatternGenerator.
623 * @param pErrorCode a pointer to the UErrorCode which must not indicate a
624 * failure before the function call
625 * @return a UEnumeration list of all the skeletons
626 * The caller must close the object.
629 U_STABLE UEnumeration
* U_EXPORT2
630 udatpg_openSkeletons(const UDateTimePatternGenerator
*dtpg
, UErrorCode
*pErrorCode
);
633 * Return a UEnumeration list of all the base skeletons in canonical form.
635 * @param dtpg a pointer to UDateTimePatternGenerator.
636 * @param pErrorCode a pointer to the UErrorCode which must not indicate a
637 * failure before the function call.
638 * @return a UEnumeration list of all the base skeletons
639 * The caller must close the object.
642 U_STABLE UEnumeration
* U_EXPORT2
643 udatpg_openBaseSkeletons(const UDateTimePatternGenerator
*dtpg
, UErrorCode
*pErrorCode
);
646 * Get the pattern corresponding to a given skeleton.
648 * @param dtpg a pointer to UDateTimePatternGenerator.
650 * @param skeletonLength pointer to the length of skeleton.
651 * @param pLength pointer to the length of return pattern.
652 * @return pattern corresponding to a given skeleton.
655 U_STABLE
const UChar
* U_EXPORT2
656 udatpg_getPatternForSkeleton(const UDateTimePatternGenerator
*dtpg
,
657 const UChar
*skeleton
, int32_t skeletonLength
,
661 * Remap a pattern per the options (Apple-specific for now).
662 * Currently this will only remap the time to force an alternate time
663 * cycle (12-hour instead of 24-hour or vice versa), handling updating
664 * the pattern characters, insertion/removal of AM/PM marker, etc. in
665 * a locale-appropriate way. It calls udatpg_getBestPatternWithOptions
666 * as part of updating the time format.
668 * @param dtpg a pointer to UDateTimePatternGenerator.
670 * The pattern to remap.
671 * @param patternLength
672 * The length of the pattern (may be -1 to indicate that it
673 * is zero-terminated).
675 * Options for forcing the hour cycle and for forcing the
676 * length of specified fields in the
677 * returned pattern to match those in the skeleton (when this
678 * would not happen otherwise). For default behavior, use
679 * UDATPG_MATCH_NO_OPTIONS.
681 * The remapped pattern.
682 * @param newPatternCapacity
683 * The capacity of newPattern.
685 * A pointer to the UErrorCode. If at entry it indicates a
686 * failure, the call will return immediately.
688 * The length of newPattern. If this is greater than
689 * newPatternCapacity an error will be set and the contents of
690 * newPattern are undefined.
693 U_INTERNAL
int32_t U_EXPORT2
694 uadatpg_remapPatternWithOptions(UDateTimePatternGenerator
*dtpg
,
695 const UChar
*pattern
, int32_t patternLength
,
696 UDateTimePatternMatchOptions options
,
697 UChar
*newPattern
, int32_t newPatternCapacity
,
698 UErrorCode
*pErrorCode
);