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
00091 #ifndef U_FORCE_HIDE_DEPRECATED_API
00092
00096 UDATPG_FIELD_COUNT
00097 #endif // U_FORCE_HIDE_DEPRECATED_API
00098 } UDateTimePatternField;
00099
00104 typedef enum UDateTimePGDisplayWidth {
00106 UDATPG_WIDE,
00108 UDATPG_ABBREVIATED,
00110 UDATPG_NARROW
00111 } UDateTimePGDisplayWidth;
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
00468 U_STABLE int32_t U_EXPORT2
00469 udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg,
00470 UDateTimePatternField field,
00471 UDateTimePGDisplayWidth width,
00472 UChar *fieldName, int32_t capacity,
00473 UErrorCode *pErrorCode);
00474
00498 U_STABLE void U_EXPORT2
00499 udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00500 const UChar *dtFormat, int32_t length);
00501
00509 U_STABLE const UChar * U_EXPORT2
00510 udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00511 int32_t *pLength);
00512
00526 U_STABLE void U_EXPORT2
00527 udatpg_setDecimal(UDateTimePatternGenerator *dtpg,
00528 const UChar *decimal, int32_t length);
00529
00538 U_STABLE const UChar * U_EXPORT2
00539 udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
00540 int32_t *pLength);
00541
00567 U_STABLE int32_t U_EXPORT2
00568 udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg,
00569 const UChar *pattern, int32_t patternLength,
00570 const UChar *skeleton, int32_t skeletonLength,
00571 UChar *dest, int32_t destCapacity,
00572 UErrorCode *pErrorCode);
00573
00604 U_STABLE int32_t U_EXPORT2
00605 udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg,
00606 const UChar *pattern, int32_t patternLength,
00607 const UChar *skeleton, int32_t skeletonLength,
00608 UDateTimePatternMatchOptions options,
00609 UChar *dest, int32_t destCapacity,
00610 UErrorCode *pErrorCode);
00611
00623 U_STABLE UEnumeration * U_EXPORT2
00624 udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00625
00636 U_STABLE UEnumeration * U_EXPORT2
00637 udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00638
00649 U_STABLE const UChar * U_EXPORT2
00650 udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
00651 const UChar *skeleton, int32_t skeletonLength,
00652 int32_t *pLength);
00653
00654 #endif