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
00102 typedef enum UDateTimePGDisplayWidth {
00104 UDATPG_WIDE,
00106 UDATPG_ABBREVIATED,
00108 UDATPG_NARROW
00109 } UDateTimePGDisplayWidth;
00110
00118 typedef enum UDateTimePatternMatchOptions {
00120 UDATPG_MATCH_NO_OPTIONS = 0,
00122 UDATPG_MATCH_HOUR_FIELD_LENGTH = 1 << UDATPG_HOUR_FIELD,
00123 #ifndef U_HIDE_INTERNAL_API
00124
00125 UDATPG_MATCH_MINUTE_FIELD_LENGTH = 1 << UDATPG_MINUTE_FIELD,
00127 UDATPG_MATCH_SECOND_FIELD_LENGTH = 1 << UDATPG_SECOND_FIELD,
00128 #endif
00129
00130 UDATPG_MATCH_ALL_FIELDS_LENGTH = (1 << UDATPG_FIELD_COUNT) - 1
00131 } UDateTimePatternMatchOptions;
00132
00137 typedef enum UDateTimePatternConflict {
00139 UDATPG_NO_CONFLICT,
00141 UDATPG_BASE_CONFLICT,
00143 UDATPG_CONFLICT,
00144 #ifndef U_HIDE_DEPRECATED_API
00145
00149 UDATPG_CONFLICT_COUNT
00150 #endif // U_HIDE_DEPRECATED_API
00151 } UDateTimePatternConflict;
00152
00161 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00162 udatpg_open(const char *locale, UErrorCode *pErrorCode);
00163
00171 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00172 udatpg_openEmpty(UErrorCode *pErrorCode);
00173
00179 U_STABLE void U_EXPORT2
00180 udatpg_close(UDateTimePatternGenerator *dtpg);
00181
00182 #if U_SHOW_CPLUSPLUS_API
00183
00184 U_NAMESPACE_BEGIN
00185
00195 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateTimePatternGeneratorPointer, UDateTimePatternGenerator, udatpg_close);
00196
00197 U_NAMESPACE_END
00198
00199 #endif
00200
00209 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00210 udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00211
00235 U_STABLE int32_t U_EXPORT2
00236 udatpg_getBestPattern(UDateTimePatternGenerator *dtpg,
00237 const UChar *skeleton, int32_t length,
00238 UChar *bestPattern, int32_t capacity,
00239 UErrorCode *pErrorCode);
00240
00271 U_STABLE int32_t U_EXPORT2
00272 udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg,
00273 const UChar *skeleton, int32_t length,
00274 UDateTimePatternMatchOptions options,
00275 UChar *bestPattern, int32_t capacity,
00276 UErrorCode *pErrorCode);
00277
00299 U_STABLE int32_t U_EXPORT2
00300 udatpg_getSkeleton(UDateTimePatternGenerator *unusedDtpg,
00301 const UChar *pattern, int32_t length,
00302 UChar *skeleton, int32_t capacity,
00303 UErrorCode *pErrorCode);
00304
00329 U_STABLE int32_t U_EXPORT2
00330 udatpg_getBaseSkeleton(UDateTimePatternGenerator *unusedDtpg,
00331 const UChar *pattern, int32_t length,
00332 UChar *baseSkeleton, int32_t capacity,
00333 UErrorCode *pErrorCode);
00334
00359 U_STABLE UDateTimePatternConflict U_EXPORT2
00360 udatpg_addPattern(UDateTimePatternGenerator *dtpg,
00361 const UChar *pattern, int32_t patternLength,
00362 UBool override,
00363 UChar *conflictingPattern, int32_t capacity, int32_t *pLength,
00364 UErrorCode *pErrorCode);
00365
00386 U_STABLE void U_EXPORT2
00387 udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg,
00388 UDateTimePatternField field,
00389 const UChar *value, int32_t length);
00390
00401 U_STABLE const UChar * U_EXPORT2
00402 udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg,
00403 UDateTimePatternField field,
00404 int32_t *pLength);
00405
00419 U_STABLE void U_EXPORT2
00420 udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg,
00421 UDateTimePatternField field,
00422 const UChar *value, int32_t length);
00423
00436 U_STABLE const UChar * U_EXPORT2
00437 udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
00438 UDateTimePatternField field,
00439 int32_t *pLength);
00440
00466 U_STABLE int32_t U_EXPORT2
00467 udatpg_getFieldDisplayName(const UDateTimePatternGenerator *dtpg,
00468 UDateTimePatternField field,
00469 UDateTimePGDisplayWidth width,
00470 UChar *fieldName, int32_t capacity,
00471 UErrorCode *pErrorCode);
00472
00496 U_STABLE void U_EXPORT2
00497 udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00498 const UChar *dtFormat, int32_t length);
00499
00507 U_STABLE const UChar * U_EXPORT2
00508 udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00509 int32_t *pLength);
00510
00524 U_STABLE void U_EXPORT2
00525 udatpg_setDecimal(UDateTimePatternGenerator *dtpg,
00526 const UChar *decimal, int32_t length);
00527
00536 U_STABLE const UChar * U_EXPORT2
00537 udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
00538 int32_t *pLength);
00539
00565 U_STABLE int32_t U_EXPORT2
00566 udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg,
00567 const UChar *pattern, int32_t patternLength,
00568 const UChar *skeleton, int32_t skeletonLength,
00569 UChar *dest, int32_t destCapacity,
00570 UErrorCode *pErrorCode);
00571
00602 U_STABLE int32_t U_EXPORT2
00603 udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg,
00604 const UChar *pattern, int32_t patternLength,
00605 const UChar *skeleton, int32_t skeletonLength,
00606 UDateTimePatternMatchOptions options,
00607 UChar *dest, int32_t destCapacity,
00608 UErrorCode *pErrorCode);
00609
00621 U_STABLE UEnumeration * U_EXPORT2
00622 udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00623
00634 U_STABLE UEnumeration * U_EXPORT2
00635 udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00636
00647 U_STABLE const UChar * U_EXPORT2
00648 udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
00649 const UChar *skeleton, int32_t skeletonLength,
00650 int32_t *pLength);
00651
00652 #endif