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
00098 #ifndef U_HIDE_DRAFT_API
00099
00103 typedef enum UDateTimePGDisplayWidth {
00105 UDATPG_WIDE,
00107 UDATPG_ABBREVIATED,
00109 UDATPG_NARROW
00110 } UDateTimePGDisplayWidth;
00111 #endif // U_HIDE_DRAFT_API
00112
00120 typedef enum UDateTimePatternMatchOptions {
00122 UDATPG_MATCH_NO_OPTIONS = 0,
00124 UDATPG_MATCH_HOUR_FIELD_LENGTH = 1 << UDATPG_HOUR_FIELD,
00125 #ifndef U_HIDE_INTERNAL_API
00126
00127 UDATPG_MATCH_MINUTE_FIELD_LENGTH = 1 << UDATPG_MINUTE_FIELD,
00129 UDATPG_MATCH_SECOND_FIELD_LENGTH = 1 << UDATPG_SECOND_FIELD,
00130 #endif
00131
00132 UDATPG_MATCH_ALL_FIELDS_LENGTH = (1 << UDATPG_FIELD_COUNT) - 1
00133 } UDateTimePatternMatchOptions;
00134
00139 typedef enum UDateTimePatternConflict {
00141 UDATPG_NO_CONFLICT,
00143 UDATPG_BASE_CONFLICT,
00145 UDATPG_CONFLICT,
00146 #ifndef U_HIDE_DEPRECATED_API
00147
00151 UDATPG_CONFLICT_COUNT
00152 #endif // U_HIDE_DEPRECATED_API
00153 } UDateTimePatternConflict;
00154
00163 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00164 udatpg_open(const char *locale, UErrorCode *pErrorCode);
00165
00173 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00174 udatpg_openEmpty(UErrorCode *pErrorCode);
00175
00181 U_STABLE void U_EXPORT2
00182 udatpg_close(UDateTimePatternGenerator *dtpg);
00183
00184 #if U_SHOW_CPLUSPLUS_API
00185
00186 U_NAMESPACE_BEGIN
00187
00197 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateTimePatternGeneratorPointer, UDateTimePatternGenerator, udatpg_close);
00198
00199 U_NAMESPACE_END
00200
00201 #endif
00202
00211 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00212 udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00213
00237 U_STABLE int32_t U_EXPORT2
00238 udatpg_getBestPattern(UDateTimePatternGenerator *dtpg,
00239 const UChar *skeleton, int32_t length,
00240 UChar *bestPattern, int32_t capacity,
00241 UErrorCode *pErrorCode);
00242
00273 U_STABLE int32_t U_EXPORT2
00274 udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg,
00275 const UChar *skeleton, int32_t length,
00276 UDateTimePatternMatchOptions options,
00277 UChar *bestPattern, int32_t capacity,
00278 UErrorCode *pErrorCode);
00279
00301 U_STABLE int32_t U_EXPORT2
00302 udatpg_getSkeleton(UDateTimePatternGenerator *unusedDtpg,
00303 const UChar *pattern, int32_t length,
00304 UChar *skeleton, int32_t capacity,
00305 UErrorCode *pErrorCode);
00306
00331 U_STABLE int32_t U_EXPORT2
00332 udatpg_getBaseSkeleton(UDateTimePatternGenerator *unusedDtpg,
00333 const UChar *pattern, int32_t length,
00334 UChar *baseSkeleton, int32_t capacity,
00335 UErrorCode *pErrorCode);
00336
00361 U_STABLE UDateTimePatternConflict U_EXPORT2
00362 udatpg_addPattern(UDateTimePatternGenerator *dtpg,
00363 const UChar *pattern, int32_t patternLength,
00364 UBool override,
00365 UChar *conflictingPattern, int32_t capacity, int32_t *pLength,
00366 UErrorCode *pErrorCode);
00367
00388 U_STABLE void U_EXPORT2
00389 udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg,
00390 UDateTimePatternField field,
00391 const UChar *value, int32_t length);
00392
00403 U_STABLE const UChar * U_EXPORT2
00404 udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg,
00405 UDateTimePatternField field,
00406 int32_t *pLength);
00407
00421 U_STABLE void U_EXPORT2
00422 udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg,
00423 UDateTimePatternField field,
00424 const UChar *value, int32_t length);
00425
00438 U_STABLE const UChar * U_EXPORT2
00439 udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
00440 UDateTimePatternField field,
00441 int32_t *pLength);
00442
00443 #ifndef U_HIDE_DRAFT_API
00444
00469 U_DRAFT int32_t U_EXPORT2
00470 udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg,
00471 UDateTimePatternField field,
00472 UDateTimePGDisplayWidth width,
00473 UChar *fieldName, int32_t capacity,
00474 UErrorCode *pErrorCode);
00475 #endif // U_HIDE_DRAFT_API
00476
00500 U_STABLE void U_EXPORT2
00501 udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00502 const UChar *dtFormat, int32_t length);
00503
00511 U_STABLE const UChar * U_EXPORT2
00512 udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00513 int32_t *pLength);
00514
00528 U_STABLE void U_EXPORT2
00529 udatpg_setDecimal(UDateTimePatternGenerator *dtpg,
00530 const UChar *decimal, int32_t length);
00531
00540 U_STABLE const UChar * U_EXPORT2
00541 udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
00542 int32_t *pLength);
00543
00569 U_STABLE int32_t U_EXPORT2
00570 udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg,
00571 const UChar *pattern, int32_t patternLength,
00572 const UChar *skeleton, int32_t skeletonLength,
00573 UChar *dest, int32_t destCapacity,
00574 UErrorCode *pErrorCode);
00575
00606 U_STABLE int32_t U_EXPORT2
00607 udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg,
00608 const UChar *pattern, int32_t patternLength,
00609 const UChar *skeleton, int32_t skeletonLength,
00610 UDateTimePatternMatchOptions options,
00611 UChar *dest, int32_t destCapacity,
00612 UErrorCode *pErrorCode);
00613
00625 U_STABLE UEnumeration * U_EXPORT2
00626 udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00627
00638 U_STABLE UEnumeration * U_EXPORT2
00639 udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00640
00651 U_STABLE const UChar * U_EXPORT2
00652 udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
00653 const UChar *skeleton, int32_t skeletonLength,
00654 int32_t *pLength);
00655
00656 #endif