ICU 49.1.1
49.1.1
|
00001 /* 00002 ******************************************************************************* 00003 * 00004 * Copyright (C) 2007-2011, International Business Machines 00005 * Corporation and others. All Rights Reserved. 00006 * 00007 ******************************************************************************* 00008 * file name: udatpg.h 00009 * encoding: US-ASCII 00010 * tab size: 8 (not used) 00011 * indentation:4 00012 * 00013 * created on: 2007jul30 00014 * created by: Markus W. Scherer 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 /* U_HIDE_INTERNAL_API */ 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 00272 U_STABLE int32_t U_EXPORT2 00273 udatpg_getSkeleton(UDateTimePatternGenerator *dtpg, 00274 const UChar *pattern, int32_t length, 00275 UChar *skeleton, int32_t capacity, 00276 UErrorCode *pErrorCode); 00277 00301 U_STABLE int32_t U_EXPORT2 00302 udatpg_getBaseSkeleton(UDateTimePatternGenerator *dtpg, 00303 const UChar *pattern, int32_t length, 00304 UChar *baseSkeleton, int32_t capacity, 00305 UErrorCode *pErrorCode); 00306 00331 U_STABLE UDateTimePatternConflict U_EXPORT2 00332 udatpg_addPattern(UDateTimePatternGenerator *dtpg, 00333 const UChar *pattern, int32_t patternLength, 00334 UBool override, 00335 UChar *conflictingPattern, int32_t capacity, int32_t *pLength, 00336 UErrorCode *pErrorCode); 00337 00358 U_STABLE void U_EXPORT2 00359 udatpg_setAppendItemFormat(UDateTimePatternGenerator *dtpg, 00360 UDateTimePatternField field, 00361 const UChar *value, int32_t length); 00362 00373 U_STABLE const UChar * U_EXPORT2 00374 udatpg_getAppendItemFormat(const UDateTimePatternGenerator *dtpg, 00375 UDateTimePatternField field, 00376 int32_t *pLength); 00377 00391 U_STABLE void U_EXPORT2 00392 udatpg_setAppendItemName(UDateTimePatternGenerator *dtpg, 00393 UDateTimePatternField field, 00394 const UChar *value, int32_t length); 00395 00406 U_STABLE const UChar * U_EXPORT2 00407 udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg, 00408 UDateTimePatternField field, 00409 int32_t *pLength); 00410 00432 U_STABLE void U_EXPORT2 00433 udatpg_setDateTimeFormat(const UDateTimePatternGenerator *dtpg, 00434 const UChar *dtFormat, int32_t length); 00435 00443 U_STABLE const UChar * U_EXPORT2 00444 udatpg_getDateTimeFormat(const UDateTimePatternGenerator *dtpg, 00445 int32_t *pLength); 00446 00460 U_STABLE void U_EXPORT2 00461 udatpg_setDecimal(UDateTimePatternGenerator *dtpg, 00462 const UChar *decimal, int32_t length); 00463 00472 U_STABLE const UChar * U_EXPORT2 00473 udatpg_getDecimal(const UDateTimePatternGenerator *dtpg, 00474 int32_t *pLength); 00475 00501 U_STABLE int32_t U_EXPORT2 00502 udatpg_replaceFieldTypes(UDateTimePatternGenerator *dtpg, 00503 const UChar *pattern, int32_t patternLength, 00504 const UChar *skeleton, int32_t skeletonLength, 00505 UChar *dest, int32_t destCapacity, 00506 UErrorCode *pErrorCode); 00507 00538 U_STABLE int32_t U_EXPORT2 00539 udatpg_replaceFieldTypesWithOptions(UDateTimePatternGenerator *dtpg, 00540 const UChar *pattern, int32_t patternLength, 00541 const UChar *skeleton, int32_t skeletonLength, 00542 UDateTimePatternMatchOptions options, 00543 UChar *dest, int32_t destCapacity, 00544 UErrorCode *pErrorCode); 00545 00557 U_STABLE UEnumeration * U_EXPORT2 00558 udatpg_openSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode); 00559 00570 U_STABLE UEnumeration * U_EXPORT2 00571 udatpg_openBaseSkeletons(const UDateTimePatternGenerator *dtpg, UErrorCode *pErrorCode); 00572 00583 U_STABLE const UChar * U_EXPORT2 00584 udatpg_getPatternForSkeleton(const UDateTimePatternGenerator *dtpg, 00585 const UChar *skeleton, int32_t skeletonLength, 00586 int32_t *pLength); 00587 00588 #endif