00001
00002
00003
00004
00005
00006
00007
00008 #ifndef UDAT_H
00009 #define UDAT_H
00010
00011 #include "unicode/utypes.h"
00012
00013 #if !UCONFIG_NO_FORMATTING
00014
00015 #include "unicode/ucal.h"
00016 #include "unicode/unum.h"
00138 typedef void* UDateFormat;
00139
00143 typedef enum UDateFormatStyle {
00145 UDAT_FULL,
00147 UDAT_LONG,
00149 UDAT_MEDIUM,
00151 UDAT_SHORT,
00153 UDAT_DEFAULT = UDAT_MEDIUM,
00154
00156 UDAT_RELATIVE = (1 << 7),
00157
00158 UDAT_FULL_RELATIVE = UDAT_FULL | UDAT_RELATIVE,
00159
00160 UDAT_LONG_RELATIVE = UDAT_LONG | UDAT_RELATIVE,
00161
00162 UDAT_MEDIUM_RELATIVE = UDAT_MEDIUM | UDAT_RELATIVE,
00163
00164 UDAT_SHORT_RELATIVE = UDAT_SHORT | UDAT_RELATIVE,
00165
00166
00168 UDAT_NONE = -1,
00170 UDAT_IGNORE = -2
00171
00172 } UDateFormatStyle;
00173
00179 typedef enum UDateFormatField {
00185 UDAT_ERA_FIELD = 0,
00186
00192 UDAT_YEAR_FIELD = 1,
00193
00199 UDAT_MONTH_FIELD = 2,
00200
00206 UDAT_DATE_FIELD = 3,
00207
00215 UDAT_HOUR_OF_DAY1_FIELD = 4,
00216
00224 UDAT_HOUR_OF_DAY0_FIELD = 5,
00225
00231 UDAT_MINUTE_FIELD = 6,
00232
00238 UDAT_SECOND_FIELD = 7,
00239
00245 UDAT_FRACTIONAL_SECOND_FIELD = 8,
00246
00252 UDAT_DAY_OF_WEEK_FIELD = 9,
00253
00259 UDAT_DAY_OF_YEAR_FIELD = 10,
00260
00266 UDAT_DAY_OF_WEEK_IN_MONTH_FIELD = 11,
00267
00273 UDAT_WEEK_OF_YEAR_FIELD = 12,
00274
00280 UDAT_WEEK_OF_MONTH_FIELD = 13,
00281
00287 UDAT_AM_PM_FIELD = 14,
00288
00296 UDAT_HOUR1_FIELD = 15,
00297
00305 UDAT_HOUR0_FIELD = 16,
00306
00313 UDAT_TIMEZONE_FIELD = 17,
00314
00320 UDAT_YEAR_WOY_FIELD = 18,
00321
00327 UDAT_DOW_LOCAL_FIELD = 19,
00328
00334 UDAT_EXTENDED_YEAR_FIELD = 20,
00335
00341 UDAT_JULIAN_DAY_FIELD = 21,
00342
00348 UDAT_MILLISECONDS_IN_DAY_FIELD = 22,
00349
00356 UDAT_TIMEZONE_RFC_FIELD = 23,
00357
00358 #ifndef U_HIDE_DRAFT_API
00359
00365 UDAT_TIMEZONE_GENERIC_FIELD = 24,
00372 UDAT_STANDALONE_DAY_FIELD = 25,
00373
00380 UDAT_STANDALONE_MONTH_FIELD = 26,
00381
00389 UDAT_QUARTER_FIELD = 27,
00390
00398 UDAT_STANDALONE_QUARTER_FIELD = 28,
00399
00400 #endif
00401
00410 UDAT_FIELD_COUNT = 29
00411
00412 } UDateFormatField;
00413
00433 U_STABLE UDateFormat* U_EXPORT2
00434 udat_open(UDateFormatStyle timeStyle,
00435 UDateFormatStyle dateStyle,
00436 const char *locale,
00437 const UChar *tzID,
00438 int32_t tzIDLength,
00439 const UChar *pattern,
00440 int32_t patternLength,
00441 UErrorCode *status);
00442
00443
00450 U_STABLE void U_EXPORT2
00451 udat_close(UDateFormat* format);
00452
00461 U_STABLE UDateFormat* U_EXPORT2
00462 udat_clone(const UDateFormat *fmt,
00463 UErrorCode *status);
00464
00483 U_STABLE int32_t U_EXPORT2
00484 udat_format( const UDateFormat* format,
00485 UDate dateToFormat,
00486 UChar* result,
00487 int32_t resultLength,
00488 UFieldPosition* position,
00489 UErrorCode* status);
00490
00504 U_STABLE UDate U_EXPORT2
00505 udat_parse( const UDateFormat* format,
00506 const UChar* text,
00507 int32_t textLength,
00508 int32_t *parsePos,
00509 UErrorCode *status);
00510
00524 U_STABLE void U_EXPORT2
00525 udat_parseCalendar(const UDateFormat* format,
00526 UCalendar* calendar,
00527 const UChar* text,
00528 int32_t textLength,
00529 int32_t *parsePos,
00530 UErrorCode *status);
00531
00541 U_STABLE UBool U_EXPORT2
00542 udat_isLenient(const UDateFormat* fmt);
00543
00553 U_STABLE void U_EXPORT2
00554 udat_setLenient( UDateFormat* fmt,
00555 UBool isLenient);
00556
00566 U_STABLE const UCalendar* U_EXPORT2
00567 udat_getCalendar(const UDateFormat* fmt);
00568
00578 U_STABLE void U_EXPORT2
00579 udat_setCalendar( UDateFormat* fmt,
00580 const UCalendar* calendarToSet);
00581
00591 U_STABLE const UNumberFormat* U_EXPORT2
00592 udat_getNumberFormat(const UDateFormat* fmt);
00593
00603 U_STABLE void U_EXPORT2
00604 udat_setNumberFormat( UDateFormat* fmt,
00605 const UNumberFormat* numberFormatToSet);
00606
00616 U_STABLE const char* U_EXPORT2
00617 udat_getAvailable(int32_t index);
00618
00627 U_STABLE int32_t U_EXPORT2
00628 udat_countAvailable(void);
00629
00640 U_STABLE UDate U_EXPORT2
00641 udat_get2DigitYearStart( const UDateFormat *fmt,
00642 UErrorCode *status);
00643
00654 U_STABLE void U_EXPORT2
00655 udat_set2DigitYearStart( UDateFormat *fmt,
00656 UDate d,
00657 UErrorCode *status);
00658
00671 U_STABLE int32_t U_EXPORT2
00672 udat_toPattern( const UDateFormat *fmt,
00673 UBool localized,
00674 UChar *result,
00675 int32_t resultLength,
00676 UErrorCode *status);
00677
00688 U_STABLE void U_EXPORT2
00689 udat_applyPattern( UDateFormat *format,
00690 UBool localized,
00691 const UChar *pattern,
00692 int32_t patternLength);
00693
00698 typedef enum UDateFormatSymbolType {
00700 UDAT_ERAS,
00702 UDAT_MONTHS,
00704 UDAT_SHORT_MONTHS,
00706 UDAT_WEEKDAYS,
00708 UDAT_SHORT_WEEKDAYS,
00710 UDAT_AM_PMS,
00712 UDAT_LOCALIZED_CHARS,
00714 UDAT_ERA_NAMES,
00716 UDAT_NARROW_MONTHS,
00718 UDAT_NARROW_WEEKDAYS,
00720 UDAT_STANDALONE_MONTHS,
00721 UDAT_STANDALONE_SHORT_MONTHS,
00722 UDAT_STANDALONE_NARROW_MONTHS,
00724 UDAT_STANDALONE_WEEKDAYS,
00725 UDAT_STANDALONE_SHORT_WEEKDAYS,
00726 UDAT_STANDALONE_NARROW_WEEKDAYS,
00728 UDAT_QUARTERS,
00730 UDAT_SHORT_QUARTERS,
00732 UDAT_STANDALONE_QUARTERS,
00733 UDAT_STANDALONE_SHORT_QUARTERS
00734
00735 } UDateFormatSymbolType;
00736
00737 struct UDateFormatSymbols;
00742 typedef struct UDateFormatSymbols UDateFormatSymbols;
00743
00760 U_STABLE int32_t U_EXPORT2
00761 udat_getSymbols(const UDateFormat *fmt,
00762 UDateFormatSymbolType type,
00763 int32_t index,
00764 UChar *result,
00765 int32_t resultLength,
00766 UErrorCode *status);
00767
00780 U_STABLE int32_t U_EXPORT2
00781 udat_countSymbols( const UDateFormat *fmt,
00782 UDateFormatSymbolType type);
00783
00799 U_STABLE void U_EXPORT2
00800 udat_setSymbols( UDateFormat *format,
00801 UDateFormatSymbolType type,
00802 int32_t index,
00803 UChar *value,
00804 int32_t valueLength,
00805 UErrorCode *status);
00806
00816 U_STABLE const char* U_EXPORT2
00817 udat_getLocaleByType(const UDateFormat *fmt,
00818 ULocDataLocaleType type,
00819 UErrorCode* status);
00820
00821 #endif
00822
00823 #endif