12e5b6d6dSopenharmony_ci// © 2016 and later: Unicode, Inc. and others.
22e5b6d6dSopenharmony_ci// License & terms of use: http://www.unicode.org/copyright.html
32e5b6d6dSopenharmony_ci/*
42e5b6d6dSopenharmony_ci*******************************************************************************
52e5b6d6dSopenharmony_ci*
62e5b6d6dSopenharmony_ci*   Copyright (C) 2007-2015, International Business Machines
72e5b6d6dSopenharmony_ci*   Corporation and others.  All Rights Reserved.
82e5b6d6dSopenharmony_ci*
92e5b6d6dSopenharmony_ci*******************************************************************************
102e5b6d6dSopenharmony_ci*   file name:  udatpg.h
112e5b6d6dSopenharmony_ci*   encoding:   UTF-8
122e5b6d6dSopenharmony_ci*   tab size:   8 (not used)
132e5b6d6dSopenharmony_ci*   indentation:4
142e5b6d6dSopenharmony_ci*
152e5b6d6dSopenharmony_ci*   created on: 2007jul30
162e5b6d6dSopenharmony_ci*   created by: Markus W. Scherer
172e5b6d6dSopenharmony_ci*/
182e5b6d6dSopenharmony_ci
192e5b6d6dSopenharmony_ci#ifndef __UDATPG_H__
202e5b6d6dSopenharmony_ci#define __UDATPG_H__
212e5b6d6dSopenharmony_ci
222e5b6d6dSopenharmony_ci#include "unicode/utypes.h"
232e5b6d6dSopenharmony_ci#include "unicode/udat.h"
242e5b6d6dSopenharmony_ci#include "unicode/uenum.h"
252e5b6d6dSopenharmony_ci
262e5b6d6dSopenharmony_ci#if U_SHOW_CPLUSPLUS_API
272e5b6d6dSopenharmony_ci#include "unicode/localpointer.h"
282e5b6d6dSopenharmony_ci#endif   // U_SHOW_CPLUSPLUS_API
292e5b6d6dSopenharmony_ci
302e5b6d6dSopenharmony_ci/**
312e5b6d6dSopenharmony_ci * \file
322e5b6d6dSopenharmony_ci * \brief C API: Wrapper for icu::DateTimePatternGenerator (unicode/dtptngen.h).
332e5b6d6dSopenharmony_ci *
342e5b6d6dSopenharmony_ci * UDateTimePatternGenerator provides flexible generation of date format patterns,
352e5b6d6dSopenharmony_ci * like "yy-MM-dd". The user can build up the generator by adding successive
362e5b6d6dSopenharmony_ci * patterns. Once that is done, a query can be made using a "skeleton", which is
372e5b6d6dSopenharmony_ci * a pattern which just includes the desired fields and lengths. The generator
382e5b6d6dSopenharmony_ci * will return the "best fit" pattern corresponding to that skeleton.
392e5b6d6dSopenharmony_ci * <p>The main method people will use is udatpg_getBestPattern, since normally
402e5b6d6dSopenharmony_ci * UDateTimePatternGenerator is pre-built with data from a particular locale.
412e5b6d6dSopenharmony_ci * However, generators can be built directly from other data as well.
422e5b6d6dSopenharmony_ci * <p><i>Issue: may be useful to also have a function that returns the list of
432e5b6d6dSopenharmony_ci * fields in a pattern, in order, since we have that internally.
442e5b6d6dSopenharmony_ci * That would be useful for getting the UI order of field elements.</i>
452e5b6d6dSopenharmony_ci */
462e5b6d6dSopenharmony_ci
472e5b6d6dSopenharmony_ci/**
482e5b6d6dSopenharmony_ci * Opaque type for a date/time pattern generator object.
492e5b6d6dSopenharmony_ci * @stable ICU 3.8
502e5b6d6dSopenharmony_ci */
512e5b6d6dSopenharmony_citypedef void *UDateTimePatternGenerator;
522e5b6d6dSopenharmony_ci
532e5b6d6dSopenharmony_ci/**
542e5b6d6dSopenharmony_ci * Field number constants for udatpg_getAppendItemFormats() and similar functions.
552e5b6d6dSopenharmony_ci * These constants are separate from UDateFormatField despite semantic overlap
562e5b6d6dSopenharmony_ci * because some fields are merged for the date/time pattern generator.
572e5b6d6dSopenharmony_ci * @stable ICU 3.8
582e5b6d6dSopenharmony_ci */
592e5b6d6dSopenharmony_citypedef enum UDateTimePatternField {
602e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
612e5b6d6dSopenharmony_ci    UDATPG_ERA_FIELD,
622e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
632e5b6d6dSopenharmony_ci    UDATPG_YEAR_FIELD,
642e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
652e5b6d6dSopenharmony_ci    UDATPG_QUARTER_FIELD,
662e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
672e5b6d6dSopenharmony_ci    UDATPG_MONTH_FIELD,
682e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
692e5b6d6dSopenharmony_ci    UDATPG_WEEK_OF_YEAR_FIELD,
702e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
712e5b6d6dSopenharmony_ci    UDATPG_WEEK_OF_MONTH_FIELD,
722e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
732e5b6d6dSopenharmony_ci    UDATPG_WEEKDAY_FIELD,
742e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
752e5b6d6dSopenharmony_ci    UDATPG_DAY_OF_YEAR_FIELD,
762e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
772e5b6d6dSopenharmony_ci    UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD,
782e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
792e5b6d6dSopenharmony_ci    UDATPG_DAY_FIELD,
802e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
812e5b6d6dSopenharmony_ci    UDATPG_DAYPERIOD_FIELD,
822e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
832e5b6d6dSopenharmony_ci    UDATPG_HOUR_FIELD,
842e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
852e5b6d6dSopenharmony_ci    UDATPG_MINUTE_FIELD,
862e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
872e5b6d6dSopenharmony_ci    UDATPG_SECOND_FIELD,
882e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
892e5b6d6dSopenharmony_ci    UDATPG_FRACTIONAL_SECOND_FIELD,
902e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
912e5b6d6dSopenharmony_ci    UDATPG_ZONE_FIELD,
922e5b6d6dSopenharmony_ci
932e5b6d6dSopenharmony_ci    /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
942e5b6d6dSopenharmony_ci     * it is needed for layout of DateTimePatternGenerator object. */
952e5b6d6dSopenharmony_ci#ifndef U_FORCE_HIDE_DEPRECATED_API
962e5b6d6dSopenharmony_ci    /**
972e5b6d6dSopenharmony_ci     * One more than the highest normal UDateTimePatternField value.
982e5b6d6dSopenharmony_ci     * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
992e5b6d6dSopenharmony_ci     */
1002e5b6d6dSopenharmony_ci    UDATPG_FIELD_COUNT
1012e5b6d6dSopenharmony_ci#endif  // U_FORCE_HIDE_DEPRECATED_API
1022e5b6d6dSopenharmony_ci} UDateTimePatternField;
1032e5b6d6dSopenharmony_ci
1042e5b6d6dSopenharmony_ci/**
1052e5b6d6dSopenharmony_ci * Field display name width constants for udatpg_getFieldDisplayName().
1062e5b6d6dSopenharmony_ci * @stable ICU 61
1072e5b6d6dSopenharmony_ci */
1082e5b6d6dSopenharmony_citypedef enum UDateTimePGDisplayWidth {
1092e5b6d6dSopenharmony_ci    /** @stable ICU 61 */
1102e5b6d6dSopenharmony_ci    UDATPG_WIDE,
1112e5b6d6dSopenharmony_ci    /** @stable ICU 61 */
1122e5b6d6dSopenharmony_ci    UDATPG_ABBREVIATED,
1132e5b6d6dSopenharmony_ci    /** @stable ICU 61 */
1142e5b6d6dSopenharmony_ci    UDATPG_NARROW
1152e5b6d6dSopenharmony_ci} UDateTimePGDisplayWidth;
1162e5b6d6dSopenharmony_ci
1172e5b6d6dSopenharmony_ci/**
1182e5b6d6dSopenharmony_ci * Masks to control forcing the length of specified fields in the returned
1192e5b6d6dSopenharmony_ci * pattern to match those in the skeleton (when this would not happen
1202e5b6d6dSopenharmony_ci * otherwise). These may be combined to force the length of multiple fields.
1212e5b6d6dSopenharmony_ci * Used with udatpg_getBestPatternWithOptions, udatpg_replaceFieldTypesWithOptions.
1222e5b6d6dSopenharmony_ci * @stable ICU 4.4
1232e5b6d6dSopenharmony_ci */
1242e5b6d6dSopenharmony_citypedef enum UDateTimePatternMatchOptions {
1252e5b6d6dSopenharmony_ci    /** @stable ICU 4.4 */
1262e5b6d6dSopenharmony_ci    UDATPG_MATCH_NO_OPTIONS = 0,
1272e5b6d6dSopenharmony_ci    /** @stable ICU 4.4 */
1282e5b6d6dSopenharmony_ci    UDATPG_MATCH_HOUR_FIELD_LENGTH = 1 << UDATPG_HOUR_FIELD,
1292e5b6d6dSopenharmony_ci#ifndef U_HIDE_INTERNAL_API
1302e5b6d6dSopenharmony_ci    /** @internal ICU 4.4 */
1312e5b6d6dSopenharmony_ci    UDATPG_MATCH_MINUTE_FIELD_LENGTH = 1 << UDATPG_MINUTE_FIELD,
1322e5b6d6dSopenharmony_ci    /** @internal ICU 4.4 */
1332e5b6d6dSopenharmony_ci    UDATPG_MATCH_SECOND_FIELD_LENGTH = 1 << UDATPG_SECOND_FIELD,
1342e5b6d6dSopenharmony_ci#endif  /* U_HIDE_INTERNAL_API */
1352e5b6d6dSopenharmony_ci    /** @stable ICU 4.4 */
1362e5b6d6dSopenharmony_ci    UDATPG_MATCH_ALL_FIELDS_LENGTH = (1 << UDATPG_FIELD_COUNT) - 1
1372e5b6d6dSopenharmony_ci} UDateTimePatternMatchOptions;
1382e5b6d6dSopenharmony_ci
1392e5b6d6dSopenharmony_ci/**
1402e5b6d6dSopenharmony_ci * Status return values from udatpg_addPattern().
1412e5b6d6dSopenharmony_ci * @stable ICU 3.8
1422e5b6d6dSopenharmony_ci */
1432e5b6d6dSopenharmony_citypedef enum UDateTimePatternConflict {
1442e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
1452e5b6d6dSopenharmony_ci    UDATPG_NO_CONFLICT,
1462e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
1472e5b6d6dSopenharmony_ci    UDATPG_BASE_CONFLICT,
1482e5b6d6dSopenharmony_ci    /** @stable ICU 3.8 */
1492e5b6d6dSopenharmony_ci    UDATPG_CONFLICT,
1502e5b6d6dSopenharmony_ci#ifndef U_HIDE_DEPRECATED_API
1512e5b6d6dSopenharmony_ci    /**
1522e5b6d6dSopenharmony_ci     * One more than the highest normal UDateTimePatternConflict value.
1532e5b6d6dSopenharmony_ci     * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
1542e5b6d6dSopenharmony_ci     */
1552e5b6d6dSopenharmony_ci    UDATPG_CONFLICT_COUNT
1562e5b6d6dSopenharmony_ci#endif  // U_HIDE_DEPRECATED_API
1572e5b6d6dSopenharmony_ci} UDateTimePatternConflict;
1582e5b6d6dSopenharmony_ci
1592e5b6d6dSopenharmony_ci/**
1602e5b6d6dSopenharmony_ci  * Open a generator according to a given locale.
1612e5b6d6dSopenharmony_ci  * @param locale
1622e5b6d6dSopenharmony_ci  * @param pErrorCode a pointer to the UErrorCode which must not indicate a
1632e5b6d6dSopenharmony_ci  *                   failure before the function call.
1642e5b6d6dSopenharmony_ci  * @return a pointer to UDateTimePatternGenerator.
1652e5b6d6dSopenharmony_ci  * @stable ICU 3.8
1662e5b6d6dSopenharmony_ci  */
1672e5b6d6dSopenharmony_ciU_CAPI UDateTimePatternGenerator * U_EXPORT2
1682e5b6d6dSopenharmony_ciudatpg_open(const char *locale, UErrorCode *pErrorCode);
1692e5b6d6dSopenharmony_ci
1702e5b6d6dSopenharmony_ci/**
1712e5b6d6dSopenharmony_ci  * Open an empty generator, to be constructed with udatpg_addPattern(...) etc.
1722e5b6d6dSopenharmony_ci  * @param pErrorCode a pointer to the UErrorCode which must not indicate a
1732e5b6d6dSopenharmony_ci  *                   failure before the function call.
1742e5b6d6dSopenharmony_ci  * @return a pointer to UDateTimePatternGenerator.
1752e5b6d6dSopenharmony_ci  * @stable ICU 3.8
1762e5b6d6dSopenharmony_ci  */
1772e5b6d6dSopenharmony_ciU_CAPI UDateTimePatternGenerator * U_EXPORT2
1782e5b6d6dSopenharmony_ciudatpg_openEmpty(UErrorCode *pErrorCode);
1792e5b6d6dSopenharmony_ci
1802e5b6d6dSopenharmony_ci/**
1812e5b6d6dSopenharmony_ci  * Close a generator.
1822e5b6d6dSopenharmony_ci  * @param dtpg a pointer to UDateTimePatternGenerator.
1832e5b6d6dSopenharmony_ci  * @stable ICU 3.8
1842e5b6d6dSopenharmony_ci  */
1852e5b6d6dSopenharmony_ciU_CAPI void U_EXPORT2
1862e5b6d6dSopenharmony_ciudatpg_close(UDateTimePatternGenerator *dtpg);
1872e5b6d6dSopenharmony_ci
1882e5b6d6dSopenharmony_ci#if U_SHOW_CPLUSPLUS_API
1892e5b6d6dSopenharmony_ci
1902e5b6d6dSopenharmony_ciU_NAMESPACE_BEGIN
1912e5b6d6dSopenharmony_ci
1922e5b6d6dSopenharmony_ci/**
1932e5b6d6dSopenharmony_ci * \class LocalUDateTimePatternGeneratorPointer
1942e5b6d6dSopenharmony_ci * "Smart pointer" class, closes a UDateTimePatternGenerator via udatpg_close().
1952e5b6d6dSopenharmony_ci * For most methods see the LocalPointerBase base class.
1962e5b6d6dSopenharmony_ci *
1972e5b6d6dSopenharmony_ci * @see LocalPointerBase
1982e5b6d6dSopenharmony_ci * @see LocalPointer
1992e5b6d6dSopenharmony_ci * @stable ICU 4.4
2002e5b6d6dSopenharmony_ci */
2012e5b6d6dSopenharmony_ciU_DEFINE_LOCAL_OPEN_POINTER(LocalUDateTimePatternGeneratorPointer, UDateTimePatternGenerator, udatpg_close);
2022e5b6d6dSopenharmony_ci
2032e5b6d6dSopenharmony_ciU_NAMESPACE_END
2042e5b6d6dSopenharmony_ci
2052e5b6d6dSopenharmony_ci#endif
2062e5b6d6dSopenharmony_ci
2072e5b6d6dSopenharmony_ci/**
2082e5b6d6dSopenharmony_ci  * Create a copy pf a generator.
2092e5b6d6dSopenharmony_ci  * @param dtpg a pointer to UDateTimePatternGenerator to be copied.
2102e5b6d6dSopenharmony_ci  * @param pErrorCode a pointer to the UErrorCode which must not indicate a
2112e5b6d6dSopenharmony_ci  *                   failure before the function call.
2122e5b6d6dSopenharmony_ci  * @return a pointer to a new UDateTimePatternGenerator.
2132e5b6d6dSopenharmony_ci  * @stable ICU 3.8
2142e5b6d6dSopenharmony_ci */
2152e5b6d6dSopenharmony_ciU_CAPI UDateTimePatternGenerator * U_EXPORT2
2162e5b6d6dSopenharmony_ciudatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
2172e5b6d6dSopenharmony_ci
2182e5b6d6dSopenharmony_ci/**
2192e5b6d6dSopenharmony_ci * Get the best pattern matching the input skeleton. It is guaranteed to
2202e5b6d6dSopenharmony_ci * have all of the fields in the skeleton.
2212e5b6d6dSopenharmony_ci *
2222e5b6d6dSopenharmony_ci * Note that this function uses a non-const UDateTimePatternGenerator:
2232e5b6d6dSopenharmony_ci * It uses a stateful pattern parser which is set up for each generator object,
2242e5b6d6dSopenharmony_ci * rather than creating one for each function call.
2252e5b6d6dSopenharmony_ci * Consecutive calls to this function do not affect each other,
2262e5b6d6dSopenharmony_ci * but this function cannot be used concurrently on a single generator object.
2272e5b6d6dSopenharmony_ci *
2282e5b6d6dSopenharmony_ci * @param dtpg a pointer to UDateTimePatternGenerator.
2292e5b6d6dSopenharmony_ci * @param skeleton
2302e5b6d6dSopenharmony_ci *            The skeleton is a pattern containing only the variable fields.
2312e5b6d6dSopenharmony_ci *            For example, "MMMdd" and "mmhh" are skeletons.
2322e5b6d6dSopenharmony_ci * @param length the length of skeleton
2332e5b6d6dSopenharmony_ci * @param bestPattern
2342e5b6d6dSopenharmony_ci *            The best pattern found from the given skeleton.
2352e5b6d6dSopenharmony_ci * @param capacity the capacity of bestPattern.
2362e5b6d6dSopenharmony_ci * @param pErrorCode a pointer to the UErrorCode which must not indicate a
2372e5b6d6dSopenharmony_ci *                   failure before the function call.
2382e5b6d6dSopenharmony_ci * @return the length of bestPattern.
2392e5b6d6dSopenharmony_ci * @stable ICU 3.8
2402e5b6d6dSopenharmony_ci */
2412e5b6d6dSopenharmony_ciU_CAPI int32_t U_EXPORT2
2422e5b6d6dSopenharmony_ciudatpg_getBestPattern(UDateTimePatternGenerator *dtpg,
2432e5b6d6dSopenharmony_ci                      const UChar *skeleton, int32_t length,
2442e5b6d6dSopenharmony_ci                      UChar *bestPattern, int32_t capacity,
2452e5b6d6dSopenharmony_ci                      UErrorCode *pErrorCode);
2462e5b6d6dSopenharmony_ci
2472e5b6d6dSopenharmony_ci/**
2482e5b6d6dSopenharmony_ci * Get the best pattern matching the input skeleton. It is guaranteed to
2492e5b6d6dSopenharmony_ci * have all of the fields in the skeleton.
2502e5b6d6dSopenharmony_ci *
2512e5b6d6dSopenharmony_ci * Note that this function uses a non-const UDateTimePatternGenerator:
2522e5b6d6dSopenharmony_ci * It uses a stateful pattern parser which is set up for each generator object,
2532e5b6d6dSopenharmony_ci * rather than creating one for each function call.
2542e5b6d6dSopenharmony_ci * Consecutive calls to this function do not affect each other,
2552e5b6d6dSopenharmony_ci * but this function cannot be used concurrently on a single generator object.
2562e5b6d6dSopenharmony_ci *
2572e5b6d6dSopenharmony_ci * @param dtpg a pointer to UDateTimePatternGenerator.
2582e5b6d6dSopenharmony_ci * @param skeleton
2592e5b6d6dSopenharmony_ci *            The skeleton is a pattern containing only the variable fields.
2602e5b6d6dSopenharmony_ci *            For example, "MMMdd" and "mmhh" are skeletons.
2612e5b6d6dSopenharmony_ci * @param length the length of skeleton
2622e5b6d6dSopenharmony_ci * @param options
2632e5b6d6dSopenharmony_ci *            Options for forcing the length of specified fields in the
2642e5b6d6dSopenharmony_ci *            returned pattern to match those in the skeleton (when this
2652e5b6d6dSopenharmony_ci *            would not happen otherwise). For default behavior, use
2662e5b6d6dSopenharmony_ci *            UDATPG_MATCH_NO_OPTIONS.
2672e5b6d6dSopenharmony_ci * @param bestPattern
2682e5b6d6dSopenharmony_ci *            The best pattern found from the given skeleton.
2692e5b6d6dSopenharmony_ci * @param capacity
2702e5b6d6dSopenharmony_ci *            the capacity of bestPattern.
2712e5b6d6dSopenharmony_ci * @param pErrorCode
2722e5b6d6dSopenharmony_ci *            a pointer to the UErrorCode which must not indicate a
2732e5b6d6dSopenharmony_ci *            failure before the function call.
2742e5b6d6dSopenharmony_ci * @return the length of bestPattern.
2752e5b6d6dSopenharmony_ci * @stable ICU 4.4
2762e5b6d6dSopenharmony_ci */
2772e5b6d6dSopenharmony_ciU_CAPI int32_t U_EXPORT2
2782e5b6d6dSopenharmony_ciudatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg,
2792e5b6d6dSopenharmony_ci                                 const UChar *skeleton, int32_t length,
2802e5b6d6dSopenharmony_ci                                 UDateTimePatternMatchOptions options,
2812e5b6d6dSopenharmony_ci                                 UChar *bestPattern, int32_t capacity,
2822e5b6d6dSopenharmony_ci                                 UErrorCode *pErrorCode);
2832e5b6d6dSopenharmony_ci
2842e5b6d6dSopenharmony_ci/**
2852e5b6d6dSopenharmony_ci  * Get a unique skeleton from a given pattern. For example,
2862e5b6d6dSopenharmony_ci  * both "MMM-dd" and "dd/MMM" produce the skeleton "MMMdd".
2872e5b6d6dSopenharmony_ci  *
2882e5b6d6dSopenharmony_ci  * Note that this function uses a non-const UDateTimePatternGenerator:
2892e5b6d6dSopenharmony_ci  * It uses a stateful pattern parser which is set up for each generator object,
2902e5b6d6dSopenharmony_ci  * rather than creating one for each function call.
2912e5b6d6dSopenharmony_ci  * Consecutive calls to this function do not affect each other,
2922e5b6d6dSopenharmony_ci  * but this function cannot be used concurrently on a single generator object.
2932e5b6d6dSopenharmony_ci  *
2942e5b6d6dSopenharmony_ci  * @param unusedDtpg     a pointer to UDateTimePatternGenerator.
2952e5b6d6dSopenharmony_ci  *    This parameter is no longer used. Callers may pass NULL.
2962e5b6d6dSopenharmony_ci  * @param pattern  input pattern, such as "dd/MMM".
2972e5b6d6dSopenharmony_ci  * @param length   the length of pattern.
2982e5b6d6dSopenharmony_ci  * @param skeleton such as "MMMdd"
2992e5b6d6dSopenharmony_ci  * @param capacity the capacity of skeleton.
3002e5b6d6dSopenharmony_ci  * @param pErrorCode a pointer to the UErrorCode which must not indicate a
3012e5b6d6dSopenharmony_ci  *                  failure before the function call.
3022e5b6d6dSopenharmony_ci  * @return the length of skeleton.
3032e5b6d6dSopenharmony_ci  * @stable ICU 3.8
3042e5b6d6dSopenharmony_ci  */
3052e5b6d6dSopenharmony_ciU_CAPI int32_t U_EXPORT2
3062e5b6d6dSopenharmony_ciudatpg_getSkeleton(UDateTimePatternGenerator *unusedDtpg,
3072e5b6d6dSopenharmony_ci                   const UChar *pattern, int32_t length,
3082e5b6d6dSopenharmony_ci                   UChar *skeleton, int32_t capacity,
3092e5b6d6dSopenharmony_ci                   UErrorCode *pErrorCode);
3102e5b6d6dSopenharmony_ci
3112e5b6d6dSopenharmony_ci/**
3122e5b6d6dSopenharmony_ci * Get a unique base skeleton from a given pattern. This is the same
3132e5b6d6dSopenharmony_ci * as the skeleton, except that differences in length are minimized so
3142e5b6d6dSopenharmony_ci * as to only preserve the difference between string and numeric form. So
3152e5b6d6dSopenharmony_ci * for example, both "MMM-dd" and "d/MMM" produce the skeleton "MMMd"
3162e5b6d6dSopenharmony_ci * (notice the single d).
3172e5b6d6dSopenharmony_ci *
3182e5b6d6dSopenharmony_ci * Note that this function uses a non-const UDateTimePatternGenerator:
3192e5b6d6dSopenharmony_ci * It uses a stateful pattern parser which is set up for each generator object,
3202e5b6d6dSopenharmony_ci * rather than creating one for each function call.
3212e5b6d6dSopenharmony_ci * Consecutive calls to this function do not affect each other,
3222e5b6d6dSopenharmony_ci * but this function cannot be used concurrently on a single generator object.
3232e5b6d6dSopenharmony_ci *
3242e5b6d6dSopenharmony_ci * @param unusedDtpg     a pointer to UDateTimePatternGenerator.
3252e5b6d6dSopenharmony_ci *    This parameter is no longer used. Callers may pass NULL.
3262e5b6d6dSopenharmony_ci * @param pattern  input pattern, such as "dd/MMM".
3272e5b6d6dSopenharmony_ci * @param length   the length of pattern.
3282e5b6d6dSopenharmony_ci * @param baseSkeleton such as "Md"
3292e5b6d6dSopenharmony_ci * @param capacity the capacity of base skeleton.
3302e5b6d6dSopenharmony_ci * @param pErrorCode a pointer to the UErrorCode which must not indicate a
3312e5b6d6dSopenharmony_ci *                  failure before the function call.
3322e5b6d6dSopenharmony_ci * @return the length of baseSkeleton.
3332e5b6d6dSopenharmony_ci * @stable ICU 3.8
3342e5b6d6dSopenharmony_ci */
3352e5b6d6dSopenharmony_ciU_CAPI int32_t U_EXPORT2
3362e5b6d6dSopenharmony_ciudatpg_getBaseSkeleton(UDateTimePatternGenerator *unusedDtpg,
3372e5b6d6dSopenharmony_ci                       const UChar *pattern, int32_t length,
3382e5b6d6dSopenharmony_ci                       UChar *baseSkeleton, int32_t capacity,
3392e5b6d6dSopenharmony_ci                       UErrorCode *pErrorCode);
3402e5b6d6dSopenharmony_ci
3412e5b6d6dSopenharmony_ci/**
3422e5b6d6dSopenharmony_ci * Adds a pattern to the generator. If the pattern has the same skeleton as
3432e5b6d6dSopenharmony_ci * an existing pattern, and the override parameter is set, then the previous
3442e5b6d6dSopenharmony_ci * value is overridden. Otherwise, the previous value is retained. In either
3452e5b6d6dSopenharmony_ci * case, the conflicting status is set and previous vale is stored in
3462e5b6d6dSopenharmony_ci * conflicting pattern.
3472e5b6d6dSopenharmony_ci * <p>
3482e5b6d6dSopenharmony_ci * Note that single-field patterns (like "MMM") are automatically added, and
3492e5b6d6dSopenharmony_ci * don't need to be added explicitly!
3502e5b6d6dSopenharmony_ci *
3512e5b6d6dSopenharmony_ci * @param dtpg     a pointer to UDateTimePatternGenerator.
3522e5b6d6dSopenharmony_ci * @param pattern  input pattern, such as "dd/MMM"
3532e5b6d6dSopenharmony_ci * @param patternLength the length of pattern.
3542e5b6d6dSopenharmony_ci * @param override  When existing values are to be overridden use true,
3552e5b6d6dSopenharmony_ci *                  otherwise use false.
3562e5b6d6dSopenharmony_ci * @param conflictingPattern  Previous pattern with the same skeleton.
3572e5b6d6dSopenharmony_ci * @param capacity the capacity of conflictingPattern.
3582e5b6d6dSopenharmony_ci * @param pLength a pointer to the length of conflictingPattern.
3592e5b6d6dSopenharmony_ci * @param pErrorCode a pointer to the UErrorCode which must not indicate a
3602e5b6d6dSopenharmony_ci *                  failure before the function call.
3612e5b6d6dSopenharmony_ci * @return conflicting status. The value could be UDATPG_NO_CONFLICT,
3622e5b6d6dSopenharmony_ci *                  UDATPG_BASE_CONFLICT or UDATPG_CONFLICT.
3632e5b6d6dSopenharmony_ci * @stable ICU 3.8
3642e5b6d6dSopenharmony_ci */
3652e5b6d6dSopenharmony_ciU_CAPI UDateTimePatternConflict U_EXPORT2
3662e5b6d6dSopenharmony_ciudatpg_addPattern(UDateTimePatternGenerator *dtpg,
3672e5b6d6dSopenharmony_ci                  const UChar *pattern, int32_t patternLength,
3682e5b6d6dSopenharmony_ci                  UBool override,
3692e5b6d6dSopenharmony_ci                  UChar *conflictingPattern, int32_t capacity, int32_t *pLength,
3702e5b6d6dSopenharmony_ci                  UErrorCode *pErrorCode);
3712e5b6d6dSopenharmony_ci
3722e5b6d6dSopenharmony_ci/**
3732e5b6d6dSopenharmony_ci  * An AppendItem format is a pattern used to append a field if there is no
3742e5b6d6dSopenharmony_ci  * good match. For example, suppose that the input skeleton is "GyyyyMMMd",
3752e5b6d6dSopenharmony_ci  * and there is no matching pattern internally, but there is a pattern
3762e5b6d6dSopenharmony_ci  * matching "yyyyMMMd", say "d-MM-yyyy". Then that pattern is used, plus the
3772e5b6d6dSopenharmony_ci  * G. The way these two are conjoined is by using the AppendItemFormat for G
3782e5b6d6dSopenharmony_ci  * (era). So if that value is, say "{0}, {1}" then the final resulting
3792e5b6d6dSopenharmony_ci  * pattern is "d-MM-yyyy, G".
3802e5b6d6dSopenharmony_ci  * <p>
3812e5b6d6dSopenharmony_ci  * There are actually three available variables: {0} is the pattern so far,
3822e5b6d6dSopenharmony_ci  * {1} is the element we are adding, and {2} is the name of the element.
3832e5b6d6dSopenharmony_ci  * <p>
3842e5b6d6dSopenharmony_ci  * This reflects the way that the CLDR data is organized.
3852e5b6d6dSopenharmony_ci  *
3862e5b6d6dSopenharmony_ci  * @param dtpg   a pointer to UDateTimePatternGenerator.
3872e5b6d6dSopenharmony_ci  * @param field  UDateTimePatternField, such as UDATPG_ERA_FIELD
3882e5b6d6dSopenharmony_ci  * @param value  pattern, such as "{0}, {1}"
3892e5b6d6dSopenharmony_ci  * @param length the length of value.
3902e5b6d6dSopenharmony_ci  * @stable ICU 3.8
3912e5b6d6dSopenharmony_ci  */
3922e5b6d6dSopenharmony_ciU_CAPI void U_EXPORT2
3932e5b6d6dSopenharmony_ciudatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg,
3942e5b6d6dSopenharmony_ci                           UDateTimePatternField field,
3952e5b6d6dSopenharmony_ci                           const UChar *value, int32_t length);
3962e5b6d6dSopenharmony_ci
3972e5b6d6dSopenharmony_ci/**
3982e5b6d6dSopenharmony_ci * Getter corresponding to setAppendItemFormat. Values below 0 or at or
3992e5b6d6dSopenharmony_ci * above UDATPG_FIELD_COUNT are illegal arguments.
4002e5b6d6dSopenharmony_ci *
4012e5b6d6dSopenharmony_ci * @param dtpg   A pointer to UDateTimePatternGenerator.
4022e5b6d6dSopenharmony_ci * @param field  UDateTimePatternField, such as UDATPG_ERA_FIELD
4032e5b6d6dSopenharmony_ci * @param pLength A pointer that will receive the length of appendItemFormat.
4042e5b6d6dSopenharmony_ci * @return appendItemFormat for field.
4052e5b6d6dSopenharmony_ci * @stable ICU 3.8
4062e5b6d6dSopenharmony_ci */
4072e5b6d6dSopenharmony_ciU_CAPI const UChar * U_EXPORT2
4082e5b6d6dSopenharmony_ciudatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg,
4092e5b6d6dSopenharmony_ci                           UDateTimePatternField field,
4102e5b6d6dSopenharmony_ci                           int32_t *pLength);
4112e5b6d6dSopenharmony_ci
4122e5b6d6dSopenharmony_ci/**
4132e5b6d6dSopenharmony_ci   * Set the name of field, eg "era" in English for ERA. These are only
4142e5b6d6dSopenharmony_ci   * used if the corresponding AppendItemFormat is used, and if it contains a
4152e5b6d6dSopenharmony_ci   * {2} variable.
4162e5b6d6dSopenharmony_ci   * <p>
4172e5b6d6dSopenharmony_ci   * This reflects the way that the CLDR data is organized.
4182e5b6d6dSopenharmony_ci   *
4192e5b6d6dSopenharmony_ci   * @param dtpg   a pointer to UDateTimePatternGenerator.
4202e5b6d6dSopenharmony_ci   * @param field  UDateTimePatternField
4212e5b6d6dSopenharmony_ci   * @param value  name for the field.
4222e5b6d6dSopenharmony_ci   * @param length the length of value.
4232e5b6d6dSopenharmony_ci   * @stable ICU 3.8
4242e5b6d6dSopenharmony_ci   */
4252e5b6d6dSopenharmony_ciU_CAPI void U_EXPORT2
4262e5b6d6dSopenharmony_ciudatpg_setAppendItemName(UDateTimePatternGenerator *dtpg,
4272e5b6d6dSopenharmony_ci                         UDateTimePatternField field,
4282e5b6d6dSopenharmony_ci                         const UChar *value, int32_t length);
4292e5b6d6dSopenharmony_ci
4302e5b6d6dSopenharmony_ci/**
4312e5b6d6dSopenharmony_ci * Getter corresponding to setAppendItemNames. Values below 0 or at or above
4322e5b6d6dSopenharmony_ci * UDATPG_FIELD_COUNT are illegal arguments. Note: The more general function
4332e5b6d6dSopenharmony_ci * for getting date/time field display names is udatpg_getFieldDisplayName.
4342e5b6d6dSopenharmony_ci *
4352e5b6d6dSopenharmony_ci * @param dtpg   a pointer to UDateTimePatternGenerator.
4362e5b6d6dSopenharmony_ci * @param field  UDateTimePatternField, such as UDATPG_ERA_FIELD
4372e5b6d6dSopenharmony_ci * @param pLength A pointer that will receive the length of the name for field.
4382e5b6d6dSopenharmony_ci * @return name for field
4392e5b6d6dSopenharmony_ci * @see udatpg_getFieldDisplayName
4402e5b6d6dSopenharmony_ci * @stable ICU 3.8
4412e5b6d6dSopenharmony_ci */
4422e5b6d6dSopenharmony_ciU_CAPI const UChar * U_EXPORT2
4432e5b6d6dSopenharmony_ciudatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
4442e5b6d6dSopenharmony_ci                         UDateTimePatternField field,
4452e5b6d6dSopenharmony_ci                         int32_t *pLength);
4462e5b6d6dSopenharmony_ci
4472e5b6d6dSopenharmony_ci/**
4482e5b6d6dSopenharmony_ci * The general interface to get a display name for a particular date/time field,
4492e5b6d6dSopenharmony_ci * in one of several possible display widths.
4502e5b6d6dSopenharmony_ci *
4512e5b6d6dSopenharmony_ci * @param dtpg
4522e5b6d6dSopenharmony_ci *          A pointer to the UDateTimePatternGenerator object with the localized
4532e5b6d6dSopenharmony_ci *          display names.
4542e5b6d6dSopenharmony_ci * @param field
4552e5b6d6dSopenharmony_ci *          The desired UDateTimePatternField, such as UDATPG_ERA_FIELD.
4562e5b6d6dSopenharmony_ci * @param width
4572e5b6d6dSopenharmony_ci *          The desired UDateTimePGDisplayWidth, such as UDATPG_ABBREVIATED.
4582e5b6d6dSopenharmony_ci * @param fieldName
4592e5b6d6dSopenharmony_ci *          A pointer to a buffer to receive the NULL-terminated display name. If the name
4602e5b6d6dSopenharmony_ci *          fits into fieldName but cannot be  NULL-terminated (length == capacity) then
4612e5b6d6dSopenharmony_ci *          the error code is set to U_STRING_NOT_TERMINATED_WARNING. If the name doesn't
4622e5b6d6dSopenharmony_ci *          fit into fieldName then the error code is set to U_BUFFER_OVERFLOW_ERROR.
4632e5b6d6dSopenharmony_ci * @param capacity
4642e5b6d6dSopenharmony_ci *          The size of fieldName (in UChars).
4652e5b6d6dSopenharmony_ci * @param pErrorCode
4662e5b6d6dSopenharmony_ci *          A pointer to a UErrorCode to receive any errors
4672e5b6d6dSopenharmony_ci * @return
4682e5b6d6dSopenharmony_ci *         The full length of the name; if greater than capacity, fieldName contains a
4692e5b6d6dSopenharmony_ci *         truncated result.
4702e5b6d6dSopenharmony_ci * @stable ICU 61
4712e5b6d6dSopenharmony_ci */
4722e5b6d6dSopenharmony_ciU_CAPI int32_t U_EXPORT2
4732e5b6d6dSopenharmony_ciudatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg,
4742e5b6d6dSopenharmony_ci                           UDateTimePatternField field,
4752e5b6d6dSopenharmony_ci                           UDateTimePGDisplayWidth width,
4762e5b6d6dSopenharmony_ci                           UChar *fieldName, int32_t capacity,
4772e5b6d6dSopenharmony_ci                           UErrorCode *pErrorCode);
4782e5b6d6dSopenharmony_ci
4792e5b6d6dSopenharmony_ci/**
4802e5b6d6dSopenharmony_ci * The DateTimeFormat is a message format pattern used to compose date and
4812e5b6d6dSopenharmony_ci * time patterns. The default pattern in the root locale is "{1} {0}", where
4822e5b6d6dSopenharmony_ci * {1} will be replaced by the date pattern and {0} will be replaced by the
4832e5b6d6dSopenharmony_ci * time pattern; however, other locales may specify patterns such as
4842e5b6d6dSopenharmony_ci * "{1}, {0}" or "{1} 'at' {0}", etc.
4852e5b6d6dSopenharmony_ci * <p>
4862e5b6d6dSopenharmony_ci * This is used when the input skeleton contains both date and time fields,
4872e5b6d6dSopenharmony_ci * but there is not a close match among the added patterns. For example,
4882e5b6d6dSopenharmony_ci * suppose that this object was created by adding "dd-MMM" and "hh:mm", and
4892e5b6d6dSopenharmony_ci * its DateTimeFormat is the default "{1} {0}". Then if the input skeleton
4902e5b6d6dSopenharmony_ci * is "MMMdhmm", there is not an exact match, so the input skeleton is
4912e5b6d6dSopenharmony_ci * broken up into two components "MMMd" and "hmm". There are close matches
4922e5b6d6dSopenharmony_ci * for those two skeletons, so the result is put together with this pattern,
4932e5b6d6dSopenharmony_ci * resulting in "d-MMM h:mm".
4942e5b6d6dSopenharmony_ci *
4952e5b6d6dSopenharmony_ci * There are four DateTimeFormats in a UDateTimePatternGenerator object,
4962e5b6d6dSopenharmony_ci * corresponding to date styles UDAT_FULL..UDAT_SHORT. This method sets
4972e5b6d6dSopenharmony_ci * all of them to the specified pattern. To set them individually, see
4982e5b6d6dSopenharmony_ci * udatpg_setDateTimeFormatForStyle.
4992e5b6d6dSopenharmony_ci *
5002e5b6d6dSopenharmony_ci * @param dtpg a pointer to UDateTimePatternGenerator.
5012e5b6d6dSopenharmony_ci * @param dtFormat
5022e5b6d6dSopenharmony_ci *            message format pattern, here {1} will be replaced by the date
5032e5b6d6dSopenharmony_ci *            pattern and {0} will be replaced by the time pattern.
5042e5b6d6dSopenharmony_ci * @param length the length of dtFormat.
5052e5b6d6dSopenharmony_ci * @stable ICU 3.8
5062e5b6d6dSopenharmony_ci */
5072e5b6d6dSopenharmony_ciU_CAPI void U_EXPORT2
5082e5b6d6dSopenharmony_ciudatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
5092e5b6d6dSopenharmony_ci                         const UChar *dtFormat, int32_t length);
5102e5b6d6dSopenharmony_ci
5112e5b6d6dSopenharmony_ci/**
5122e5b6d6dSopenharmony_ci * Getter corresponding to setDateTimeFormat.
5132e5b6d6dSopenharmony_ci *
5142e5b6d6dSopenharmony_ci * There are four DateTimeFormats in a UDateTimePatternGenerator object,
5152e5b6d6dSopenharmony_ci * corresponding to date styles UDAT_FULL..UDAT_SHORT. This method gets
5162e5b6d6dSopenharmony_ci * the style for UDAT_MEDIUM (the default). To get them individually, see
5172e5b6d6dSopenharmony_ci * udatpg_getDateTimeFormatForStyle.
5182e5b6d6dSopenharmony_ci *
5192e5b6d6dSopenharmony_ci * @param dtpg   a pointer to UDateTimePatternGenerator.
5202e5b6d6dSopenharmony_ci * @param pLength A pointer that will receive the length of the format
5212e5b6d6dSopenharmony_ci * @return dateTimeFormat.
5222e5b6d6dSopenharmony_ci * @stable ICU 3.8
5232e5b6d6dSopenharmony_ci */
5242e5b6d6dSopenharmony_ciU_CAPI const UChar * U_EXPORT2
5252e5b6d6dSopenharmony_ciudatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg,
5262e5b6d6dSopenharmony_ci                         int32_t *pLength);
5272e5b6d6dSopenharmony_ci
5282e5b6d6dSopenharmony_ci#if !UCONFIG_NO_FORMATTING
5292e5b6d6dSopenharmony_ci#ifndef U_HIDE_DRAFT_API
5302e5b6d6dSopenharmony_ci/**
5312e5b6d6dSopenharmony_ci * dateTimeFormats are message patterns used to compose combinations of date
5322e5b6d6dSopenharmony_ci * and time patterns. There are four length styles, corresponding to the
5332e5b6d6dSopenharmony_ci * inferred style of the date pattern; these are UDateFormatStyle values:
5342e5b6d6dSopenharmony_ci *  - UDAT_FULL (for date pattern with weekday and long month), else
5352e5b6d6dSopenharmony_ci *  - UDAT_LONG (for a date pattern with long month), else
5362e5b6d6dSopenharmony_ci *  - UDAT_MEDIUM (for a date pattern with abbreviated month), else
5372e5b6d6dSopenharmony_ci *  - UDAT_SHORT (for any other date pattern).
5382e5b6d6dSopenharmony_ci * For details on dateTimeFormats, see
5392e5b6d6dSopenharmony_ci * https://www.unicode.org/reports/tr35/tr35-dates.html#dateTimeFormats.
5402e5b6d6dSopenharmony_ci * The default pattern in the root locale for all styles is "{1} {0}".
5412e5b6d6dSopenharmony_ci *
5422e5b6d6dSopenharmony_ci * @param udtpg
5432e5b6d6dSopenharmony_ci *              a pointer to the UDateTimePatternGenerator
5442e5b6d6dSopenharmony_ci * @param style
5452e5b6d6dSopenharmony_ci *              one of UDAT_FULL..UDAT_SHORT. Error if out of range.
5462e5b6d6dSopenharmony_ci * @param dateTimeFormat
5472e5b6d6dSopenharmony_ci *              the new dateTimeFormat to set for the the specified style
5482e5b6d6dSopenharmony_ci * @param length
5492e5b6d6dSopenharmony_ci *              the length of dateTimeFormat, or -1 if unknown and pattern
5502e5b6d6dSopenharmony_ci *              is null-terminated
5512e5b6d6dSopenharmony_ci * @param pErrorCode
5522e5b6d6dSopenharmony_ci *              a pointer to the UErrorCode (in/out parameter); if no failure
5532e5b6d6dSopenharmony_ci *              status is already set, it will be set according to result of the
5542e5b6d6dSopenharmony_ci *              function (e.g. U_ILLEGAL_ARGUMENT_ERROR for style out of range).
5552e5b6d6dSopenharmony_ci * @draft ICU 71
5562e5b6d6dSopenharmony_ci */
5572e5b6d6dSopenharmony_ciU_CAPI void U_EXPORT2
5582e5b6d6dSopenharmony_ciudatpg_setDateTimeFormatForStyle(UDateTimePatternGenerator *udtpg,
5592e5b6d6dSopenharmony_ci                        UDateFormatStyle style,
5602e5b6d6dSopenharmony_ci                        const UChar *dateTimeFormat, int32_t length,
5612e5b6d6dSopenharmony_ci                        UErrorCode *pErrorCode);
5622e5b6d6dSopenharmony_ci
5632e5b6d6dSopenharmony_ci/**
5642e5b6d6dSopenharmony_ci * Getter corresponding to udatpg_setDateTimeFormatForStyle.
5652e5b6d6dSopenharmony_ci *
5662e5b6d6dSopenharmony_ci * @param udtpg
5672e5b6d6dSopenharmony_ci *              a pointer to the UDateTimePatternGenerator
5682e5b6d6dSopenharmony_ci * @param style
5692e5b6d6dSopenharmony_ci *              one of UDAT_FULL..UDAT_SHORT. Error if out of range.
5702e5b6d6dSopenharmony_ci * @param pLength
5712e5b6d6dSopenharmony_ci *              a pointer that will receive the length of the format. May be NULL
5722e5b6d6dSopenharmony_ci *              if length is not desired.
5732e5b6d6dSopenharmony_ci * @param pErrorCode
5742e5b6d6dSopenharmony_ci *              a pointer to the UErrorCode (in/out parameter); if no failure
5752e5b6d6dSopenharmony_ci *              status is already set, it will be set according to result of the
5762e5b6d6dSopenharmony_ci *              function (e.g. U_ILLEGAL_ARGUMENT_ERROR for style out of range).
5772e5b6d6dSopenharmony_ci * @return
5782e5b6d6dSopenharmony_ci *              pointer to the current dateTimeFormat (0 terminated) for the specified
5792e5b6d6dSopenharmony_ci *              style, or empty string in case of error. The pointer and its contents
5802e5b6d6dSopenharmony_ci *              may no longer be valid if udatpg_setDateTimeFormat is called, or
5812e5b6d6dSopenharmony_ci *              udatpg_setDateTimeFormatForStyle for the same style is called, or the
5822e5b6d6dSopenharmony_ci *              UDateTimePatternGenerator object is closed.
5832e5b6d6dSopenharmony_ci * @draft ICU 71
5842e5b6d6dSopenharmony_ci */
5852e5b6d6dSopenharmony_ciU_CAPI const UChar* U_EXPORT2
5862e5b6d6dSopenharmony_ciudatpg_getDateTimeFormatForStyle(const UDateTimePatternGenerator *udtpg,
5872e5b6d6dSopenharmony_ci                        UDateFormatStyle style, int32_t *pLength,
5882e5b6d6dSopenharmony_ci                        UErrorCode *pErrorCode);
5892e5b6d6dSopenharmony_ci#endif /* U_HIDE_DRAFT_API */
5902e5b6d6dSopenharmony_ci#endif /* #if !UCONFIG_NO_FORMATTING */
5912e5b6d6dSopenharmony_ci
5922e5b6d6dSopenharmony_ci/**
5932e5b6d6dSopenharmony_ci * The decimal value is used in formatting fractions of seconds. If the
5942e5b6d6dSopenharmony_ci * skeleton contains fractional seconds, then this is used with the
5952e5b6d6dSopenharmony_ci * fractional seconds. For example, suppose that the input pattern is
5962e5b6d6dSopenharmony_ci * "hhmmssSSSS", and the best matching pattern internally is "H:mm:ss", and
5972e5b6d6dSopenharmony_ci * the decimal string is ",". Then the resulting pattern is modified to be
5982e5b6d6dSopenharmony_ci * "H:mm:ss,SSSS"
5992e5b6d6dSopenharmony_ci *
6002e5b6d6dSopenharmony_ci * @param dtpg a pointer to UDateTimePatternGenerator.
6012e5b6d6dSopenharmony_ci * @param decimal
6022e5b6d6dSopenharmony_ci * @param length the length of decimal.
6032e5b6d6dSopenharmony_ci * @stable ICU 3.8
6042e5b6d6dSopenharmony_ci */
6052e5b6d6dSopenharmony_ciU_CAPI void U_EXPORT2
6062e5b6d6dSopenharmony_ciudatpg_setDecimal(UDateTimePatternGenerator *dtpg,
6072e5b6d6dSopenharmony_ci                  const UChar *decimal, int32_t length);
6082e5b6d6dSopenharmony_ci
6092e5b6d6dSopenharmony_ci/**
6102e5b6d6dSopenharmony_ci * Getter corresponding to setDecimal.
6112e5b6d6dSopenharmony_ci *
6122e5b6d6dSopenharmony_ci * @param dtpg a pointer to UDateTimePatternGenerator.
6132e5b6d6dSopenharmony_ci * @param pLength A pointer that will receive the length of the decimal string.
6142e5b6d6dSopenharmony_ci * @return corresponding to the decimal point.
6152e5b6d6dSopenharmony_ci * @stable ICU 3.8
6162e5b6d6dSopenharmony_ci */
6172e5b6d6dSopenharmony_ciU_CAPI const UChar * U_EXPORT2
6182e5b6d6dSopenharmony_ciudatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
6192e5b6d6dSopenharmony_ci                  int32_t *pLength);
6202e5b6d6dSopenharmony_ci
6212e5b6d6dSopenharmony_ci/**
6222e5b6d6dSopenharmony_ci * Adjusts the field types (width and subtype) of a pattern to match what is
6232e5b6d6dSopenharmony_ci * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a
6242e5b6d6dSopenharmony_ci * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be
6252e5b6d6dSopenharmony_ci * "dd-MMMM hh:mm". This is used internally to get the best match for the
6262e5b6d6dSopenharmony_ci * input skeleton, but can also be used externally.
6272e5b6d6dSopenharmony_ci *
6282e5b6d6dSopenharmony_ci * Note that this function uses a non-const UDateTimePatternGenerator:
6292e5b6d6dSopenharmony_ci * It uses a stateful pattern parser which is set up for each generator object,
6302e5b6d6dSopenharmony_ci * rather than creating one for each function call.
6312e5b6d6dSopenharmony_ci * Consecutive calls to this function do not affect each other,
6322e5b6d6dSopenharmony_ci * but this function cannot be used concurrently on a single generator object.
6332e5b6d6dSopenharmony_ci *
6342e5b6d6dSopenharmony_ci * @param dtpg a pointer to UDateTimePatternGenerator.
6352e5b6d6dSopenharmony_ci * @param pattern Input pattern
6362e5b6d6dSopenharmony_ci * @param patternLength the length of input pattern.
6372e5b6d6dSopenharmony_ci * @param skeleton
6382e5b6d6dSopenharmony_ci * @param skeletonLength the length of input skeleton.
6392e5b6d6dSopenharmony_ci * @param dest  pattern adjusted to match the skeleton fields widths and subtypes.
6402e5b6d6dSopenharmony_ci * @param destCapacity the capacity of dest.
6412e5b6d6dSopenharmony_ci * @param pErrorCode a pointer to the UErrorCode which must not indicate a
6422e5b6d6dSopenharmony_ci *                  failure before the function call.
6432e5b6d6dSopenharmony_ci * @return the length of dest.
6442e5b6d6dSopenharmony_ci * @stable ICU 3.8
6452e5b6d6dSopenharmony_ci */
6462e5b6d6dSopenharmony_ciU_CAPI int32_t U_EXPORT2
6472e5b6d6dSopenharmony_ciudatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg,
6482e5b6d6dSopenharmony_ci                         const UChar *pattern, int32_t patternLength,
6492e5b6d6dSopenharmony_ci                         const UChar *skeleton, int32_t skeletonLength,
6502e5b6d6dSopenharmony_ci                         UChar *dest, int32_t destCapacity,
6512e5b6d6dSopenharmony_ci                         UErrorCode *pErrorCode);
6522e5b6d6dSopenharmony_ci
6532e5b6d6dSopenharmony_ci/**
6542e5b6d6dSopenharmony_ci * Adjusts the field types (width and subtype) of a pattern to match what is
6552e5b6d6dSopenharmony_ci * in a skeleton. That is, if you supply a pattern like "d-M H:m", and a
6562e5b6d6dSopenharmony_ci * skeleton of "MMMMddhhmm", then the input pattern is adjusted to be
6572e5b6d6dSopenharmony_ci * "dd-MMMM hh:mm". This is used internally to get the best match for the
6582e5b6d6dSopenharmony_ci * input skeleton, but can also be used externally.
6592e5b6d6dSopenharmony_ci *
6602e5b6d6dSopenharmony_ci * Note that this function uses a non-const UDateTimePatternGenerator:
6612e5b6d6dSopenharmony_ci * It uses a stateful pattern parser which is set up for each generator object,
6622e5b6d6dSopenharmony_ci * rather than creating one for each function call.
6632e5b6d6dSopenharmony_ci * Consecutive calls to this function do not affect each other,
6642e5b6d6dSopenharmony_ci * but this function cannot be used concurrently on a single generator object.
6652e5b6d6dSopenharmony_ci *
6662e5b6d6dSopenharmony_ci * @param dtpg a pointer to UDateTimePatternGenerator.
6672e5b6d6dSopenharmony_ci * @param pattern Input pattern
6682e5b6d6dSopenharmony_ci * @param patternLength the length of input pattern.
6692e5b6d6dSopenharmony_ci * @param skeleton
6702e5b6d6dSopenharmony_ci * @param skeletonLength the length of input skeleton.
6712e5b6d6dSopenharmony_ci * @param options
6722e5b6d6dSopenharmony_ci *            Options controlling whether the length of specified fields in the
6732e5b6d6dSopenharmony_ci *            pattern are adjusted to match those in the skeleton (when this
6742e5b6d6dSopenharmony_ci *            would not happen otherwise). For default behavior, use
6752e5b6d6dSopenharmony_ci *            UDATPG_MATCH_NO_OPTIONS.
6762e5b6d6dSopenharmony_ci * @param dest  pattern adjusted to match the skeleton fields widths and subtypes.
6772e5b6d6dSopenharmony_ci * @param destCapacity the capacity of dest.
6782e5b6d6dSopenharmony_ci * @param pErrorCode a pointer to the UErrorCode which must not indicate a
6792e5b6d6dSopenharmony_ci *                  failure before the function call.
6802e5b6d6dSopenharmony_ci * @return the length of dest.
6812e5b6d6dSopenharmony_ci * @stable ICU 4.4
6822e5b6d6dSopenharmony_ci */
6832e5b6d6dSopenharmony_ciU_CAPI int32_t U_EXPORT2
6842e5b6d6dSopenharmony_ciudatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg,
6852e5b6d6dSopenharmony_ci                                    const UChar *pattern, int32_t patternLength,
6862e5b6d6dSopenharmony_ci                                    const UChar *skeleton, int32_t skeletonLength,
6872e5b6d6dSopenharmony_ci                                    UDateTimePatternMatchOptions options,
6882e5b6d6dSopenharmony_ci                                    UChar *dest, int32_t destCapacity,
6892e5b6d6dSopenharmony_ci                                    UErrorCode *pErrorCode);
6902e5b6d6dSopenharmony_ci
6912e5b6d6dSopenharmony_ci/**
6922e5b6d6dSopenharmony_ci * Return a UEnumeration list of all the skeletons in canonical form.
6932e5b6d6dSopenharmony_ci * Call udatpg_getPatternForSkeleton() to get the corresponding pattern.
6942e5b6d6dSopenharmony_ci *
6952e5b6d6dSopenharmony_ci * @param dtpg a pointer to UDateTimePatternGenerator.
6962e5b6d6dSopenharmony_ci * @param pErrorCode a pointer to the UErrorCode which must not indicate a
6972e5b6d6dSopenharmony_ci *                  failure before the function call
6982e5b6d6dSopenharmony_ci * @return a UEnumeration list of all the skeletons
6992e5b6d6dSopenharmony_ci *         The caller must close the object.
7002e5b6d6dSopenharmony_ci * @stable ICU 3.8
7012e5b6d6dSopenharmony_ci */
7022e5b6d6dSopenharmony_ciU_CAPI UEnumeration * U_EXPORT2
7032e5b6d6dSopenharmony_ciudatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
7042e5b6d6dSopenharmony_ci
7052e5b6d6dSopenharmony_ci/**
7062e5b6d6dSopenharmony_ci * Return a UEnumeration list of all the base skeletons in canonical form.
7072e5b6d6dSopenharmony_ci *
7082e5b6d6dSopenharmony_ci * @param dtpg a pointer to UDateTimePatternGenerator.
7092e5b6d6dSopenharmony_ci * @param pErrorCode a pointer to the UErrorCode which must not indicate a
7102e5b6d6dSopenharmony_ci *             failure before the function call.
7112e5b6d6dSopenharmony_ci * @return a UEnumeration list of all the base skeletons
7122e5b6d6dSopenharmony_ci *             The caller must close the object.
7132e5b6d6dSopenharmony_ci * @stable ICU 3.8
7142e5b6d6dSopenharmony_ci */
7152e5b6d6dSopenharmony_ciU_CAPI UEnumeration * U_EXPORT2
7162e5b6d6dSopenharmony_ciudatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
7172e5b6d6dSopenharmony_ci
7182e5b6d6dSopenharmony_ci/**
7192e5b6d6dSopenharmony_ci * Get the pattern corresponding to a given skeleton.
7202e5b6d6dSopenharmony_ci *
7212e5b6d6dSopenharmony_ci * @param dtpg a pointer to UDateTimePatternGenerator.
7222e5b6d6dSopenharmony_ci * @param skeleton
7232e5b6d6dSopenharmony_ci * @param skeletonLength pointer to the length of skeleton.
7242e5b6d6dSopenharmony_ci * @param pLength pointer to the length of return pattern.
7252e5b6d6dSopenharmony_ci * @return pattern corresponding to a given skeleton.
7262e5b6d6dSopenharmony_ci * @stable ICU 3.8
7272e5b6d6dSopenharmony_ci */
7282e5b6d6dSopenharmony_ciU_CAPI const UChar * U_EXPORT2
7292e5b6d6dSopenharmony_ciudatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
7302e5b6d6dSopenharmony_ci                             const UChar *skeleton, int32_t skeletonLength,
7312e5b6d6dSopenharmony_ci                             int32_t *pLength);
7322e5b6d6dSopenharmony_ci
7332e5b6d6dSopenharmony_ci#if !UCONFIG_NO_FORMATTING
7342e5b6d6dSopenharmony_ci
7352e5b6d6dSopenharmony_ci/**
7362e5b6d6dSopenharmony_ci * Return the default hour cycle for a locale. Uses the locale that the
7372e5b6d6dSopenharmony_ci * UDateTimePatternGenerator was initially created with.
7382e5b6d6dSopenharmony_ci *
7392e5b6d6dSopenharmony_ci * Cannot be used on an empty UDateTimePatternGenerator instance.
7402e5b6d6dSopenharmony_ci *
7412e5b6d6dSopenharmony_ci * @param dtpg a pointer to UDateTimePatternGenerator.
7422e5b6d6dSopenharmony_ci * @param pErrorCode a pointer to the UErrorCode which must not indicate a
7432e5b6d6dSopenharmony_ci *                   failure before the function call. Set to U_UNSUPPORTED_ERROR
7442e5b6d6dSopenharmony_ci *                   if used on an empty instance.
7452e5b6d6dSopenharmony_ci * @return the default hour cycle.
7462e5b6d6dSopenharmony_ci * @stable ICU 67
7472e5b6d6dSopenharmony_ci */
7482e5b6d6dSopenharmony_ciU_CAPI UDateFormatHourCycle U_EXPORT2
7492e5b6d6dSopenharmony_ciudatpg_getDefaultHourCycle(const UDateTimePatternGenerator *dtpg, UErrorCode* pErrorCode);
7502e5b6d6dSopenharmony_ci
7512e5b6d6dSopenharmony_ci#endif /* #if !UCONFIG_NO_FORMATTING */
7522e5b6d6dSopenharmony_ci
7532e5b6d6dSopenharmony_ci#endif
754