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/uenum.h"
00024 #include "unicode/localpointer.h"
00025
00047 typedef void *UDateTimePatternGenerator;
00048
00055 typedef enum UDateTimePatternField {
00057 UDATPG_ERA_FIELD,
00059 UDATPG_YEAR_FIELD,
00061 UDATPG_QUARTER_FIELD,
00063 UDATPG_MONTH_FIELD,
00065 UDATPG_WEEK_OF_YEAR_FIELD,
00067 UDATPG_WEEK_OF_MONTH_FIELD,
00069 UDATPG_WEEKDAY_FIELD,
00071 UDATPG_DAY_OF_YEAR_FIELD,
00073 UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD,
00075 UDATPG_DAY_FIELD,
00077 UDATPG_DAYPERIOD_FIELD,
00079 UDATPG_HOUR_FIELD,
00081 UDATPG_MINUTE_FIELD,
00083 UDATPG_SECOND_FIELD,
00085 UDATPG_FRACTIONAL_SECOND_FIELD,
00087 UDATPG_ZONE_FIELD,
00088
00089
00090
00095 UDATPG_FIELD_COUNT
00096 } UDateTimePatternField;
00097
00105 typedef enum UDateTimePatternMatchOptions {
00107 UDATPG_MATCH_NO_OPTIONS = 0,
00109 UDATPG_MATCH_HOUR_FIELD_LENGTH = 1 << UDATPG_HOUR_FIELD,
00110 #ifndef U_HIDE_INTERNAL_API
00111
00112 UDATPG_MATCH_MINUTE_FIELD_LENGTH = 1 << UDATPG_MINUTE_FIELD,
00114 UDATPG_MATCH_SECOND_FIELD_LENGTH = 1 << UDATPG_SECOND_FIELD,
00115 #endif
00116
00117 UDATPG_MATCH_ALL_FIELDS_LENGTH = (1 << UDATPG_FIELD_COUNT) - 1
00118 } UDateTimePatternMatchOptions;
00119
00124 typedef enum UDateTimePatternConflict {
00126 UDATPG_NO_CONFLICT,
00128 UDATPG_BASE_CONFLICT,
00130 UDATPG_CONFLICT,
00131 #ifndef U_HIDE_DEPRECATED_API
00132
00136 UDATPG_CONFLICT_COUNT
00137 #endif // U_HIDE_DEPRECATED_API
00138 } UDateTimePatternConflict;
00139
00148 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00149 udatpg_open(const char *locale, UErrorCode *pErrorCode);
00150
00158 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00159 udatpg_openEmpty(UErrorCode *pErrorCode);
00160
00166 U_STABLE void U_EXPORT2
00167 udatpg_close(UDateTimePatternGenerator *dtpg);
00168
00169 #if U_SHOW_CPLUSPLUS_API
00170
00171 U_NAMESPACE_BEGIN
00172
00182 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateTimePatternGeneratorPointer, UDateTimePatternGenerator, udatpg_close);
00183
00184 U_NAMESPACE_END
00185
00186 #endif
00187
00196 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00197 udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00198
00222 U_STABLE int32_t U_EXPORT2
00223 udatpg_getBestPattern(UDateTimePatternGenerator *dtpg,
00224 const UChar *skeleton, int32_t length,
00225 UChar *bestPattern, int32_t capacity,
00226 UErrorCode *pErrorCode);
00227
00258 U_STABLE int32_t U_EXPORT2
00259 udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg,
00260 const UChar *skeleton, int32_t length,
00261 UDateTimePatternMatchOptions options,
00262 UChar *bestPattern, int32_t capacity,
00263 UErrorCode *pErrorCode);
00264
00286 U_STABLE int32_t U_EXPORT2
00287 udatpg_getSkeleton(UDateTimePatternGenerator *unusedDtpg,
00288 const UChar *pattern, int32_t length,
00289 UChar *skeleton, int32_t capacity,
00290 UErrorCode *pErrorCode);
00291
00316 U_STABLE int32_t U_EXPORT2
00317 udatpg_getBaseSkeleton(UDateTimePatternGenerator *unusedDtpg,
00318 const UChar *pattern, int32_t length,
00319 UChar *baseSkeleton, int32_t capacity,
00320 UErrorCode *pErrorCode);
00321
00346 U_STABLE UDateTimePatternConflict U_EXPORT2
00347 udatpg_addPattern(UDateTimePatternGenerator *dtpg,
00348 const UChar *pattern, int32_t patternLength,
00349 UBool override,
00350 UChar *conflictingPattern, int32_t capacity, int32_t *pLength,
00351 UErrorCode *pErrorCode);
00352
00373 U_STABLE void U_EXPORT2
00374 udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg,
00375 UDateTimePatternField field,
00376 const UChar *value, int32_t length);
00377
00388 U_STABLE const UChar * U_EXPORT2
00389 udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg,
00390 UDateTimePatternField field,
00391 int32_t *pLength);
00392
00406 U_STABLE void U_EXPORT2
00407 udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg,
00408 UDateTimePatternField field,
00409 const UChar *value, int32_t length);
00410
00421 U_STABLE const UChar * U_EXPORT2
00422 udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
00423 UDateTimePatternField field,
00424 int32_t *pLength);
00425
00449 U_STABLE void U_EXPORT2
00450 udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00451 const UChar *dtFormat, int32_t length);
00452
00460 U_STABLE const UChar * U_EXPORT2
00461 udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00462 int32_t *pLength);
00463
00477 U_STABLE void U_EXPORT2
00478 udatpg_setDecimal(UDateTimePatternGenerator *dtpg,
00479 const UChar *decimal, int32_t length);
00480
00489 U_STABLE const UChar * U_EXPORT2
00490 udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
00491 int32_t *pLength);
00492
00518 U_STABLE int32_t U_EXPORT2
00519 udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg,
00520 const UChar *pattern, int32_t patternLength,
00521 const UChar *skeleton, int32_t skeletonLength,
00522 UChar *dest, int32_t destCapacity,
00523 UErrorCode *pErrorCode);
00524
00555 U_STABLE int32_t U_EXPORT2
00556 udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg,
00557 const UChar *pattern, int32_t patternLength,
00558 const UChar *skeleton, int32_t skeletonLength,
00559 UDateTimePatternMatchOptions options,
00560 UChar *dest, int32_t destCapacity,
00561 UErrorCode *pErrorCode);
00562
00574 U_STABLE UEnumeration * U_EXPORT2
00575 udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00576
00587 U_STABLE UEnumeration * U_EXPORT2
00588 udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00589
00600 U_STABLE const UChar * U_EXPORT2
00601 udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
00602 const UChar *skeleton, int32_t skeletonLength,
00603 int32_t *pLength);
00604
00605 #endif