ICU 73.2  73.2
udatpg.h
Go to the documentation of this file.
00001 // © 2016 and later: Unicode, Inc. and others.
00002 // License & terms of use: http://www.unicode.org/copyright.html
00003 /*
00004 *******************************************************************************
00005 *
00006 *   Copyright (C) 2007-2015, International Business Machines
00007 *   Corporation and others.  All Rights Reserved.
00008 *
00009 *******************************************************************************
00010 *   file name:  udatpg.h
00011 *   encoding:   UTF-8
00012 *   tab size:   8 (not used)
00013 *   indentation:4
00014 *
00015 *   created on: 2007jul30
00016 *   created by: Markus W. Scherer
00017 */
00018 
00019 #ifndef __UDATPG_H__
00020 #define __UDATPG_H__
00021 
00022 #include "unicode/utypes.h"
00023 #include "unicode/udat.h"
00024 #include "unicode/uenum.h"
00025 
00026 #if U_SHOW_CPLUSPLUS_API
00027 #include "unicode/localpointer.h"
00028 #endif   // U_SHOW_CPLUSPLUS_API
00029 
00051 typedef void *UDateTimePatternGenerator;
00052 
00059 typedef enum UDateTimePatternField {
00061     UDATPG_ERA_FIELD,
00063     UDATPG_YEAR_FIELD,
00065     UDATPG_QUARTER_FIELD,
00067     UDATPG_MONTH_FIELD,
00069     UDATPG_WEEK_OF_YEAR_FIELD,
00071     UDATPG_WEEK_OF_MONTH_FIELD,
00073     UDATPG_WEEKDAY_FIELD,
00075     UDATPG_DAY_OF_YEAR_FIELD,
00077     UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD,
00079     UDATPG_DAY_FIELD,
00081     UDATPG_DAYPERIOD_FIELD,
00083     UDATPG_HOUR_FIELD,
00085     UDATPG_MINUTE_FIELD,
00087     UDATPG_SECOND_FIELD,
00089     UDATPG_FRACTIONAL_SECOND_FIELD,
00091     UDATPG_ZONE_FIELD,
00092 
00093     /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
00094      * it is needed for layout of DateTimePatternGenerator object. */
00095 #ifndef U_FORCE_HIDE_DEPRECATED_API
00096 
00100     UDATPG_FIELD_COUNT
00101 #endif  // U_FORCE_HIDE_DEPRECATED_API
00102 } UDateTimePatternField;
00103 
00108 typedef enum UDateTimePGDisplayWidth {
00110     UDATPG_WIDE,
00112     UDATPG_ABBREVIATED,
00114     UDATPG_NARROW
00115 } UDateTimePGDisplayWidth;
00116 
00124 typedef enum UDateTimePatternMatchOptions {
00126     UDATPG_MATCH_NO_OPTIONS = 0,
00128     UDATPG_MATCH_HOUR_FIELD_LENGTH = 1 << UDATPG_HOUR_FIELD,
00129 #ifndef U_HIDE_INTERNAL_API
00130 
00131     UDATPG_MATCH_MINUTE_FIELD_LENGTH = 1 << UDATPG_MINUTE_FIELD,
00133     UDATPG_MATCH_SECOND_FIELD_LENGTH = 1 << UDATPG_SECOND_FIELD,
00134 #endif  /* U_HIDE_INTERNAL_API */
00135 
00136     UDATPG_MATCH_ALL_FIELDS_LENGTH = (1 << UDATPG_FIELD_COUNT) - 1
00137 } UDateTimePatternMatchOptions;
00138 
00143 typedef enum UDateTimePatternConflict {
00145     UDATPG_NO_CONFLICT,
00147     UDATPG_BASE_CONFLICT,
00149     UDATPG_CONFLICT,
00150 #ifndef U_HIDE_DEPRECATED_API
00151 
00155     UDATPG_CONFLICT_COUNT
00156 #endif  // U_HIDE_DEPRECATED_API
00157 } UDateTimePatternConflict;
00158 
00167 U_CAPI UDateTimePatternGenerator * U_EXPORT2
00168 udatpg_open(const char *locale, UErrorCode *pErrorCode);
00169 
00177 U_CAPI UDateTimePatternGenerator * U_EXPORT2
00178 udatpg_openEmpty(UErrorCode *pErrorCode);
00179 
00185 U_CAPI void U_EXPORT2
00186 udatpg_close(UDateTimePatternGenerator *dtpg);
00187 
00188 #if U_SHOW_CPLUSPLUS_API
00189 
00190 U_NAMESPACE_BEGIN
00191 
00201 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateTimePatternGeneratorPointer, UDateTimePatternGenerator, udatpg_close);
00202 
00203 U_NAMESPACE_END
00204 
00205 #endif
00206 
00215 U_CAPI UDateTimePatternGenerator * U_EXPORT2
00216 udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00217 
00241 U_CAPI int32_t U_EXPORT2
00242 udatpg_getBestPattern(UDateTimePatternGenerator *dtpg,
00243                       const UChar *skeleton, int32_t length,
00244                       UChar *bestPattern, int32_t capacity,
00245                       UErrorCode *pErrorCode);
00246 
00277 U_CAPI int32_t U_EXPORT2
00278 udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg,
00279                                  const UChar *skeleton, int32_t length,
00280                                  UDateTimePatternMatchOptions options,
00281                                  UChar *bestPattern, int32_t capacity,
00282                                  UErrorCode *pErrorCode);
00283 
00305 U_CAPI int32_t U_EXPORT2
00306 udatpg_getSkeleton(UDateTimePatternGenerator *unusedDtpg,
00307                    const UChar *pattern, int32_t length,
00308                    UChar *skeleton, int32_t capacity,
00309                    UErrorCode *pErrorCode);
00310 
00335 U_CAPI int32_t U_EXPORT2
00336 udatpg_getBaseSkeleton(UDateTimePatternGenerator *unusedDtpg,
00337                        const UChar *pattern, int32_t length,
00338                        UChar *baseSkeleton, int32_t capacity,
00339                        UErrorCode *pErrorCode);
00340 
00365 U_CAPI UDateTimePatternConflict U_EXPORT2
00366 udatpg_addPattern(UDateTimePatternGenerator *dtpg,
00367                   const UChar *pattern, int32_t patternLength,
00368                   UBool override,
00369                   UChar *conflictingPattern, int32_t capacity, int32_t *pLength,
00370                   UErrorCode *pErrorCode);
00371 
00392 U_CAPI void U_EXPORT2
00393 udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg,
00394                            UDateTimePatternField field,
00395                            const UChar *value, int32_t length);
00396 
00407 U_CAPI const UChar * U_EXPORT2
00408 udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg,
00409                            UDateTimePatternField field,
00410                            int32_t *pLength);
00411 
00425 U_CAPI void U_EXPORT2
00426 udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg,
00427                          UDateTimePatternField field,
00428                          const UChar *value, int32_t length);
00429 
00442 U_CAPI const UChar * U_EXPORT2
00443 udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
00444                          UDateTimePatternField field,
00445                          int32_t *pLength);
00446 
00472 U_CAPI int32_t U_EXPORT2
00473 udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg,
00474                            UDateTimePatternField field,
00475                            UDateTimePGDisplayWidth width,
00476                            UChar *fieldName, int32_t capacity,
00477                            UErrorCode *pErrorCode);
00478 
00507 U_CAPI void U_EXPORT2
00508 udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00509                          const UChar *dtFormat, int32_t length);
00510 
00524 U_CAPI const UChar * U_EXPORT2
00525 udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00526                          int32_t *pLength);
00527 
00528 #if !UCONFIG_NO_FORMATTING
00529 
00556 U_CAPI void U_EXPORT2
00557 udatpg_setDateTimeFormatForStyle(UDateTimePatternGenerator *udtpg,
00558                         UDateFormatStyle style,
00559                         const UChar *dateTimeFormat, int32_t length,
00560                         UErrorCode *pErrorCode);
00561 
00584 U_CAPI const UChar* U_EXPORT2
00585 udatpg_getDateTimeFormatForStyle(const UDateTimePatternGenerator *udtpg,
00586                         UDateFormatStyle style, int32_t *pLength,
00587                         UErrorCode *pErrorCode);
00588 #endif /* #if !UCONFIG_NO_FORMATTING */
00589 
00603 U_CAPI void U_EXPORT2
00604 udatpg_setDecimal(UDateTimePatternGenerator *dtpg,
00605                   const UChar *decimal, int32_t length);
00606 
00615 U_CAPI const UChar * U_EXPORT2
00616 udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
00617                   int32_t *pLength);
00618 
00644 U_CAPI int32_t U_EXPORT2
00645 udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg,
00646                          const UChar *pattern, int32_t patternLength,
00647                          const UChar *skeleton, int32_t skeletonLength,
00648                          UChar *dest, int32_t destCapacity,
00649                          UErrorCode *pErrorCode);
00650 
00681 U_CAPI int32_t U_EXPORT2
00682 udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg,
00683                                     const UChar *pattern, int32_t patternLength,
00684                                     const UChar *skeleton, int32_t skeletonLength,
00685                                     UDateTimePatternMatchOptions options,
00686                                     UChar *dest, int32_t destCapacity,
00687                                     UErrorCode *pErrorCode);
00688 
00700 U_CAPI UEnumeration * U_EXPORT2
00701 udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00702 
00713 U_CAPI UEnumeration * U_EXPORT2
00714 udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00715 
00726 U_CAPI const UChar * U_EXPORT2
00727 udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
00728                              const UChar *skeleton, int32_t skeletonLength,
00729                              int32_t *pLength);
00730 
00731 #if !UCONFIG_NO_FORMATTING
00732 
00746 U_CAPI UDateFormatHourCycle U_EXPORT2
00747 udatpg_getDefaultHourCycle(const UDateTimePatternGenerator *dtpg, UErrorCode* pErrorCode);
00748 
00749 #endif /* #if !UCONFIG_NO_FORMATTING */
00750 
00751 #endif