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,
00103 UDATPG_MATCH_MINUTE_FIELD_LENGTH = 1 << UDATPG_MINUTE_FIELD,
00105 UDATPG_MATCH_SECOND_FIELD_LENGTH = 1 << UDATPG_SECOND_FIELD,
00107 UDATPG_MATCH_ALL_FIELDS_LENGTH = (1 << UDATPG_FIELD_COUNT) - 1
00108 } UDateTimePatternMatchOptions;
00109
00114 typedef enum UDateTimePatternConflict {
00116 UDATPG_NO_CONFLICT,
00118 UDATPG_BASE_CONFLICT,
00120 UDATPG_CONFLICT,
00122 UDATPG_CONFLICT_COUNT
00123 } UDateTimePatternConflict;
00124
00133 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00134 udatpg_open(const char *locale, UErrorCode *pErrorCode);
00135
00143 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00144 udatpg_openEmpty(UErrorCode *pErrorCode);
00145
00151 U_STABLE void U_EXPORT2
00152 udatpg_close(UDateTimePatternGenerator *dtpg);
00153
00154 #if U_SHOW_CPLUSPLUS_API
00155
00156 U_NAMESPACE_BEGIN
00157
00167 U_DEFINE_LOCAL_OPEN_POINTER(LocalUDateTimePatternGeneratorPointer, UDateTimePatternGenerator, udatpg_close);
00168
00169 U_NAMESPACE_END
00170
00171 #endif
00172
00181 U_STABLE UDateTimePatternGenerator * U_EXPORT2
00182 udatpg_clone(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00183
00207 U_STABLE int32_t U_EXPORT2
00208 udatpg_getBestPattern(UDateTimePatternGenerator *dtpg,
00209 const UChar *skeleton, int32_t length,
00210 UChar *bestPattern, int32_t capacity,
00211 UErrorCode *pErrorCode);
00212
00243 U_DRAFT int32_t U_EXPORT2
00244 udatpg_getBestPatternWithOptions(UDateTimePatternGenerator *dtpg,
00245 const UChar *skeleton, int32_t length,
00246 UDateTimePatternMatchOptions options,
00247 UChar *bestPattern, int32_t capacity,
00248 UErrorCode *pErrorCode);
00249
00270 U_STABLE int32_t U_EXPORT2
00271 udatpg_getSkeleton(UDateTimePatternGenerator *dtpg,
00272 const UChar *pattern, int32_t length,
00273 UChar *skeleton, int32_t capacity,
00274 UErrorCode *pErrorCode);
00275
00299 U_STABLE int32_t U_EXPORT2
00300 udatpg_getBaseSkeleton(UDateTimePatternGenerator *dtpg,
00301 const UChar *pattern, int32_t length,
00302 UChar *baseSkeleton, int32_t capacity,
00303 UErrorCode *pErrorCode);
00304
00329 U_STABLE UDateTimePatternConflict U_EXPORT2
00330 udatpg_addPattern(UDateTimePatternGenerator *dtpg,
00331 const UChar *pattern, int32_t patternLength,
00332 UBool override,
00333 UChar *conflictingPattern, int32_t capacity, int32_t *pLength,
00334 UErrorCode *pErrorCode);
00335
00356 U_STABLE void U_EXPORT2
00357 udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg,
00358 UDateTimePatternField field,
00359 const UChar *value, int32_t length);
00360
00371 U_STABLE const UChar * U_EXPORT2
00372 udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg,
00373 UDateTimePatternField field,
00374 int32_t *pLength);
00375
00389 U_STABLE void U_EXPORT2
00390 udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg,
00391 UDateTimePatternField field,
00392 const UChar *value, int32_t length);
00393
00404 U_STABLE const UChar * U_EXPORT2
00405 udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
00406 UDateTimePatternField field,
00407 int32_t *pLength);
00408
00430 U_STABLE void U_EXPORT2
00431 udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00432 const UChar *dtFormat, int32_t length);
00433
00441 U_STABLE const UChar * U_EXPORT2
00442 udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg,
00443 int32_t *pLength);
00444
00458 U_STABLE void U_EXPORT2
00459 udatpg_setDecimal(UDateTimePatternGenerator *dtpg,
00460 const UChar *decimal, int32_t length);
00461
00470 U_STABLE const UChar * U_EXPORT2
00471 udatpg_getDecimal(const UDateTimePatternGenerator *dtpg,
00472 int32_t *pLength);
00473
00499 U_STABLE int32_t U_EXPORT2
00500 udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg,
00501 const UChar *pattern, int32_t patternLength,
00502 const UChar *skeleton, int32_t skeletonLength,
00503 UChar *dest, int32_t destCapacity,
00504 UErrorCode *pErrorCode);
00505
00536 U_DRAFT int32_t U_EXPORT2
00537 udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg,
00538 const UChar *pattern, int32_t patternLength,
00539 const UChar *skeleton, int32_t skeletonLength,
00540 UDateTimePatternMatchOptions options,
00541 UChar *dest, int32_t destCapacity,
00542 UErrorCode *pErrorCode);
00543
00555 U_STABLE UEnumeration * U_EXPORT2
00556 udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00557
00568 U_STABLE UEnumeration * U_EXPORT2
00569 udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode);
00570
00581 U_STABLE const UChar * U_EXPORT2
00582 udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg,
00583 const UChar *skeleton, int32_t skeletonLength,
00584 int32_t *pLength);
00585
00586 #endif