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