00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __UDATPG_H__
00018 #define __UDATPG_H__
00019
00020 #include "unicode/utypes.h"
00021 #include "unicode/uenum.h"
00022 #include "unicode/localpointer.h"
00023
00045 typedef void *UDateTimePatternGenerator;
00046
00053 typedef enum UDateTimePatternField {
00055 UDATPG_ERA_FIELD,
00057 UDATPG_YEAR_FIELD,
00059 UDATPG_QUARTER_FIELD,
00061 UDATPG_MONTH_FIELD,
00063 UDATPG_WEEK_OF_YEAR_FIELD,
00065 UDATPG_WEEK_OF_MONTH_FIELD,
00067 UDATPG_WEEKDAY_FIELD,
00069 UDATPG_DAY_OF_YEAR_FIELD,
00071 UDATPG_DAY_OF_WEEK_IN_MONTH_FIELD,
00073 UDATPG_DAY_FIELD,
00075 UDATPG_DAYPERIOD_FIELD,
00077 UDATPG_HOUR_FIELD,
00079 UDATPG_MINUTE_FIELD,
00081 UDATPG_SECOND_FIELD,
00083 UDATPG_FRACTIONAL_SECOND_FIELD,
00085 UDATPG_ZONE_FIELD,
00087 UDATPG_FIELD_COUNT
00088 } UDateTimePatternField;
00089
00097 typedef enum UDateTimePatternMatchOptions {
00099 UDATPG_MATCH_NO_OPTIONS = 0,
00101 UDATPG_MATCH_HOUR_FIELD_LENGTH = 1 << UDATPG_HOUR_FIELD,
00102 #ifndef U_HIDE_INTERNAL_API
00103
00104 UDATPG_MATCH_MINUTE_FIELD_LENGTH = 1 << UDATPG_MINUTE_FIELD,
00106 UDATPG_MATCH_SECOND_FIELD_LENGTH = 1 << UDATPG_SECOND_FIELD,
00107 #endif
00108
00109 UDATPG_MATCH_ALL_FIELDS_LENGTH = (1 << UDATPG_FIELD_COUNT) - 1
00110 } UDateTimePatternMatchOptions;
00111
00116 typedef enum UDateTimePatternConflict {
00118 UDATPG_NO_CONFLICT,
00120 UDATPG_BASE_CONFLICT,
00122 UDATPG_CONFLICT,
00124 UDATPG_CONFLICT_COUNT
00125 } UDateTimePatternConflict;
00126
00135 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00136 udatpg_open(const char *locale, UErrorCode *pErrorCode);
00137
00145 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00146 udatpg_openEmpty(UErrorCode *pErrorCode);
00147
00153 U_STABLE void U_EXPORT2
00154 udatpg_close(UDateTimePatternGenerator *dtpg);
00155
00156 #if U_SHOW_CPLUSPLUS_API
00157
00158 U_NAMESPACE_BEGIN
00159
00169 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateTimePatternGeneratorPointer, UDateTimePatternGenerator, udatpg_close);
00170
00171 U_NAMESPACE_END
00172
00173 #endif
00174
00183 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00184 udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00185
00209 U_STABLE int32_t U_EXPORT2
00210 udatpg_getBestPattern(UDateTimePatternGenerator *dtpg,
00211 const UChar *skeleton, int32_t length,
00212 UChar *bestPattern, int32_t capacity,
00213 UErrorCode *pErrorCode);
00214
00245 U_STABLE int32_t U_EXPORT2
00246 udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg,
00247 const UChar *skeleton, int32_t length,
00248 UDateTimePatternMatchOptions options,
00249 UChar *bestPattern, int32_t capacity,
00250 UErrorCode *pErrorCode);
00251
00273 U_STABLE int32_t U_EXPORT2
00274 udatpg_getSkeleton(UDateTimePatternGenerator *unusedDtpg,
00275 const UChar *pattern, int32_t length,
00276 UChar *skeleton, int32_t capacity,
00277 UErrorCode *pErrorCode);
00278
00303 U_STABLE int32_t U_EXPORT2
00304 udatpg_getBaseSkeleton(UDateTimePatternGenerator *unusedDtpg,
00305 const UChar *pattern, int32_t length,
00306 UChar *baseSkeleton, int32_t capacity,
00307 UErrorCode *pErrorCode);
00308
00333 U_STABLE UDateTimePatternConflict U_EXPORT2
00334 udatpg_addPattern(UDateTimePatternGenerator *dtpg,
00335 const UChar *pattern, int32_t patternLength,
00336 UBool override,
00337 UChar *conflictingPattern, int32_t capacity, int32_t *pLength,
00338 UErrorCode *pErrorCode);
00339
00360 U_STABLE void U_EXPORT2
00361 udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg,
00362 UDateTimePatternField field,
00363 const UChar *value, int32_t length);
00364
00375 U_STABLE const UChar * U_EXPORT2
00376 udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg,
00377 UDateTimePatternField field,
00378 int32_t *pLength);
00379
00393 U_STABLE void U_EXPORT2
00394 udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg,
00395 UDateTimePatternField field,
00396 const UChar *value, int32_t length);
00397
00408 U_STABLE const UChar * U_EXPORT2
00409 udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
00410 UDateTimePatternField field,
00411 int32_t *pLength);
00412
00436 U_STABLE void U_EXPORT2
00437 udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00438 const UChar *dtFormat, int32_t length);
00439
00447 U_STABLE const UChar * U_EXPORT2
00448 udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00449 int32_t *pLength);
00450
00464 U_STABLE void U_EXPORT2
00465 udatpg_setDecimal(UDateTimePatternGenerator *dtpg,
00466 const UChar *decimal, int32_t length);
00467
00476 U_STABLE const UChar * U_EXPORT2
00477 udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
00478 int32_t *pLength);
00479
00505 U_STABLE int32_t U_EXPORT2
00506 udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg,
00507 const UChar *pattern, int32_t patternLength,
00508 const UChar *skeleton, int32_t skeletonLength,
00509 UChar *dest, int32_t destCapacity,
00510 UErrorCode *pErrorCode);
00511
00542 U_STABLE int32_t U_EXPORT2
00543 udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg,
00544 const UChar *pattern, int32_t patternLength,
00545 const UChar *skeleton, int32_t skeletonLength,
00546 UDateTimePatternMatchOptions options,
00547 UChar *dest, int32_t destCapacity,
00548 UErrorCode *pErrorCode);
00549
00561 U_STABLE UEnumeration * U_EXPORT2
00562 udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00563
00574 U_STABLE UEnumeration * U_EXPORT2
00575 udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00576
00587 U_STABLE const UChar * U_EXPORT2
00588 udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
00589 const UChar *skeleton, int32_t skeletonLength,
00590 int32_t *pLength);
00591
00592 #endif