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 #include "unicode/localpointer.h"
00026
00048 typedef void *UDateTimePatternGenerator;
00049
00056 typedef enum UDateTimePatternField {
00058 UDATPG_ERA_FIELD,
00060 UDATPG_YEAR_FIELD,
00062 UDATPG_QUARTER_FIELD,
00064 UDATPG_MONTH_FIELD,
00066 UDATPG_WEEK_OF_YEAR_FIELD,
00068 UDATPG_WEEK_OF_MONTH_FIELD,
00070 UDATPG_WEEKDAY_FIELD,
00072 UDATPG_DAY_OF_YEAR_FIELD,
00074 UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD,
00076 UDATPG_DAY_FIELD,
00078 UDATPG_DAYPERIOD_FIELD,
00080 UDATPG_HOUR_FIELD,
00082 UDATPG_MINUTE_FIELD,
00084 UDATPG_SECOND_FIELD,
00086 UDATPG_FRACTIONAL_SECOND_FIELD,
00088 UDATPG_ZONE_FIELD,
00089
00090
00091
00092 #ifndef U_FORCE_HIDE_DEPRECATED_API
00093
00097 UDATPG_FIELD_COUNT
00098 #endif // U_FORCE_HIDE_DEPRECATED_API
00099 } UDateTimePatternField;
00100
00105 typedef enum UDateTimePGDisplayWidth {
00107 UDATPG_WIDE,
00109 UDATPG_ABBREVIATED,
00111 UDATPG_NARROW
00112 } UDateTimePGDisplayWidth;
00113
00121 typedef enum UDateTimePatternMatchOptions {
00123 UDATPG_MATCH_NO_OPTIONS = 0,
00125 UDATPG_MATCH_HOUR_FIELD_LENGTH = 1 << UDATPG_HOUR_FIELD,
00126 #ifndef U_HIDE_INTERNAL_API
00127
00128 UDATPG_MATCH_MINUTE_FIELD_LENGTH = 1 << UDATPG_MINUTE_FIELD,
00130 UDATPG_MATCH_SECOND_FIELD_LENGTH = 1 << UDATPG_SECOND_FIELD,
00131 #endif
00132
00133 UDATPG_MATCH_ALL_FIELDS_LENGTH = (1 << UDATPG_FIELD_COUNT) - 1
00134 } UDateTimePatternMatchOptions;
00135
00140 typedef enum UDateTimePatternConflict {
00142 UDATPG_NO_CONFLICT,
00144 UDATPG_BASE_CONFLICT,
00146 UDATPG_CONFLICT,
00147 #ifndef U_HIDE_DEPRECATED_API
00148
00152 UDATPG_CONFLICT_COUNT
00153 #endif // U_HIDE_DEPRECATED_API
00154 } UDateTimePatternConflict;
00155
00164 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00165 udatpg_open(const char *locale, UErrorCode *pErrorCode);
00166
00174 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00175 udatpg_openEmpty(UErrorCode *pErrorCode);
00176
00182 U_STABLE void U_EXPORT2
00183 udatpg_close(UDateTimePatternGenerator *dtpg);
00184
00185 #if U_SHOW_CPLUSPLUS_API
00186
00187 U_NAMESPACE_BEGIN
00188
00198 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateTimePatternGeneratorPointer, UDateTimePatternGenerator, udatpg_close);
00199
00200 U_NAMESPACE_END
00201
00202 #endif
00203
00212 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00213 udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00214
00238 U_STABLE int32_t U_EXPORT2
00239 udatpg_getBestPattern(UDateTimePatternGenerator *dtpg,
00240 const UChar *skeleton, int32_t length,
00241 UChar *bestPattern, int32_t capacity,
00242 UErrorCode *pErrorCode);
00243
00274 U_STABLE int32_t U_EXPORT2
00275 udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg,
00276 const UChar *skeleton, int32_t length,
00277 UDateTimePatternMatchOptions options,
00278 UChar *bestPattern, int32_t capacity,
00279 UErrorCode *pErrorCode);
00280
00302 U_STABLE int32_t U_EXPORT2
00303 udatpg_getSkeleton(UDateTimePatternGenerator *unusedDtpg,
00304 const UChar *pattern, int32_t length,
00305 UChar *skeleton, int32_t capacity,
00306 UErrorCode *pErrorCode);
00307
00332 U_STABLE int32_t U_EXPORT2
00333 udatpg_getBaseSkeleton(UDateTimePatternGenerator *unusedDtpg,
00334 const UChar *pattern, int32_t length,
00335 UChar *baseSkeleton, int32_t capacity,
00336 UErrorCode *pErrorCode);
00337
00362 U_STABLE UDateTimePatternConflict U_EXPORT2
00363 udatpg_addPattern(UDateTimePatternGenerator *dtpg,
00364 const UChar *pattern, int32_t patternLength,
00365 UBool override,
00366 UChar *conflictingPattern, int32_t capacity, int32_t *pLength,
00367 UErrorCode *pErrorCode);
00368
00389 U_STABLE void U_EXPORT2
00390 udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg,
00391 UDateTimePatternField field,
00392 const UChar *value, int32_t length);
00393
00404 U_STABLE const UChar * U_EXPORT2
00405 udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg,
00406 UDateTimePatternField field,
00407 int32_t *pLength);
00408
00422 U_STABLE void U_EXPORT2
00423 udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg,
00424 UDateTimePatternField field,
00425 const UChar *value, int32_t length);
00426
00439 U_STABLE const UChar * U_EXPORT2
00440 udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
00441 UDateTimePatternField field,
00442 int32_t *pLength);
00443
00469 U_STABLE 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
00499 U_STABLE void U_EXPORT2
00500 udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00501 const UChar *dtFormat, int32_t length);
00502
00510 U_STABLE const UChar * U_EXPORT2
00511 udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00512 int32_t *pLength);
00513
00527 U_STABLE void U_EXPORT2
00528 udatpg_setDecimal(UDateTimePatternGenerator *dtpg,
00529 const UChar *decimal, int32_t length);
00530
00539 U_STABLE const UChar * U_EXPORT2
00540 udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
00541 int32_t *pLength);
00542
00568 U_STABLE int32_t U_EXPORT2
00569 udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg,
00570 const UChar *pattern, int32_t patternLength,
00571 const UChar *skeleton, int32_t skeletonLength,
00572 UChar *dest, int32_t destCapacity,
00573 UErrorCode *pErrorCode);
00574
00605 U_STABLE int32_t U_EXPORT2
00606 udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg,
00607 const UChar *pattern, int32_t patternLength,
00608 const UChar *skeleton, int32_t skeletonLength,
00609 UDateTimePatternMatchOptions options,
00610 UChar *dest, int32_t destCapacity,
00611 UErrorCode *pErrorCode);
00612
00624 U_STABLE UEnumeration * U_EXPORT2
00625 udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00626
00637 U_STABLE UEnumeration * U_EXPORT2
00638 udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00639
00650 U_STABLE const UChar * U_EXPORT2
00651 udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
00652 const UChar *skeleton, int32_t skeletonLength,
00653 int32_t *pLength);
00654
00655 #if !UCONFIG_NO_FORMATTING
00656
00657 #ifndef U_HIDE_DRAFT_API
00658
00671 U_DRAFT UDateFormatHourCycle U_EXPORT2
00672 udatpg_getDefaultHourCycle(const UDateTimePatternGenerator *dtpg, UErrorCode* pErrorCode);
00673 #endif
00674
00675 #endif
00676
00677 #endif