00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
00094
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
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 #ifndef U_HIDE_DRAFT_API
00530
00557 U_CAPI void U_EXPORT2
00558 udatpg_setDateTimeFormatForStyle(UDateTimePatternGenerator *udtpg,
00559 UDateFormatStyle style,
00560 const UChar *dateTimeFormat, int32_t length,
00561 UErrorCode *pErrorCode);
00562
00585 U_CAPI const UChar* U_EXPORT2
00586 udatpg_getDateTimeFormatForStyle(const UDateTimePatternGenerator *udtpg,
00587 UDateFormatStyle style, int32_t *pLength,
00588 UErrorCode *pErrorCode);
00589 #endif
00590 #endif
00591
00605 U_CAPI void U_EXPORT2
00606 udatpg_setDecimal(UDateTimePatternGenerator *dtpg,
00607 const UChar *decimal, int32_t length);
00608
00617 U_CAPI const UChar * U_EXPORT2
00618 udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
00619 int32_t *pLength);
00620
00646 U_CAPI int32_t U_EXPORT2
00647 udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg,
00648 const UChar *pattern, int32_t patternLength,
00649 const UChar *skeleton, int32_t skeletonLength,
00650 UChar *dest, int32_t destCapacity,
00651 UErrorCode *pErrorCode);
00652
00683 U_CAPI int32_t U_EXPORT2
00684 udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg,
00685 const UChar *pattern, int32_t patternLength,
00686 const UChar *skeleton, int32_t skeletonLength,
00687 UDateTimePatternMatchOptions options,
00688 UChar *dest, int32_t destCapacity,
00689 UErrorCode *pErrorCode);
00690
00702 U_CAPI UEnumeration * U_EXPORT2
00703 udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00704
00715 U_CAPI UEnumeration * U_EXPORT2
00716 udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00717
00728 U_CAPI const UChar * U_EXPORT2
00729 udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
00730 const UChar *skeleton, int32_t skeletonLength,
00731 int32_t *pLength);
00732
00733 #if !UCONFIG_NO_FORMATTING
00734
00748 U_CAPI UDateFormatHourCycle U_EXPORT2
00749 udatpg_getDefaultHourCycle(const UDateTimePatternGenerator *dtpg, UErrorCode* pErrorCode);
00750
00751 #endif
00752
00753 #endif