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,
00155 UDAT_NONE = -1,
00157 UDAT_IGNORE = -2
00158
00159 } UDateFormatStyle;
00160
00166 typedef enum UDateFormatField {
00172 UDAT_ERA_FIELD = 0,
00173
00179 UDAT_YEAR_FIELD = 1,
00180
00186 UDAT_MONTH_FIELD = 2,
00187
00193 UDAT_DATE_FIELD = 3,
00194
00202 UDAT_HOUR_OF_DAY1_FIELD = 4,
00203
00211 UDAT_HOUR_OF_DAY0_FIELD = 5,
00212
00218 UDAT_MINUTE_FIELD = 6,
00219
00225 UDAT_SECOND_FIELD = 7,
00226
00232 UDAT_FRACTIONAL_SECOND_FIELD = 8,
00233
00239 UDAT_DAY_OF_WEEK_FIELD = 9,
00240
00246 UDAT_DAY_OF_YEAR_FIELD = 10,
00247
00253 UDAT_DAY_OF_WEEK_IN_MONTH_FIELD = 11,
00254
00260 UDAT_WEEK_OF_YEAR_FIELD = 12,
00261
00267 UDAT_WEEK_OF_MONTH_FIELD = 13,
00268
00274 UDAT_AM_PM_FIELD = 14,
00275
00283 UDAT_HOUR1_FIELD = 15,
00284
00292 UDAT_HOUR0_FIELD = 16,
00293
00300 UDAT_TIMEZONE_FIELD = 17,
00301
00307 UDAT_YEAR_WOY_FIELD = 18,
00308
00314 UDAT_DOW_LOCAL_FIELD = 19,
00315
00321 UDAT_EXTENDED_YEAR_FIELD = 20,
00322
00328 UDAT_JULIAN_DAY_FIELD = 21,
00329
00335 UDAT_MILLISECONDS_IN_DAY_FIELD = 22,
00336
00343 UDAT_TIMEZONE_RFC_FIELD = 23,
00344
00345 #ifndef U_HIDE_DRAFT_API
00346
00352 UDAT_TIMEZONE_GENERIC_FIELD = 24,
00359 UDAT_STANDALONE_DAY_FIELD = 25,
00360
00367 UDAT_STANDALONE_MONTH_FIELD = 26,
00368
00376 UDAT_QUARTER_FIELD = 27,
00377
00385 UDAT_STANDALONE_QUARTER_FIELD = 28,
00386
00387 #endif
00388
00397 UDAT_FIELD_COUNT = 29
00398
00399 } UDateFormatField;
00400
00420 U_STABLE UDateFormat* U_EXPORT2
00421 udat_open(UDateFormatStyle timeStyle,
00422 UDateFormatStyle dateStyle,
00423 const char *locale,
00424 const UChar *tzID,
00425 int32_t tzIDLength,
00426 const UChar *pattern,
00427 int32_t patternLength,
00428 UErrorCode *status);
00429
00430
00437 U_STABLE void U_EXPORT2
00438 udat_close(UDateFormat* format);
00439
00448 U_STABLE UDateFormat* U_EXPORT2
00449 udat_clone(const UDateFormat *fmt,
00450 UErrorCode *status);
00451
00470 U_STABLE int32_t U_EXPORT2
00471 udat_format( const UDateFormat* format,
00472 UDate dateToFormat,
00473 UChar* result,
00474 int32_t resultLength,
00475 UFieldPosition* position,
00476 UErrorCode* status);
00477
00491 U_STABLE UDate U_EXPORT2
00492 udat_parse( const UDateFormat* format,
00493 const UChar* text,
00494 int32_t textLength,
00495 int32_t *parsePos,
00496 UErrorCode *status);
00497
00511 U_STABLE void U_EXPORT2
00512 udat_parseCalendar(const UDateFormat* format,
00513 UCalendar* calendar,
00514 const UChar* text,
00515 int32_t textLength,
00516 int32_t *parsePos,
00517 UErrorCode *status);
00518
00528 U_STABLE UBool U_EXPORT2
00529 udat_isLenient(const UDateFormat* fmt);
00530
00540 U_STABLE void U_EXPORT2
00541 udat_setLenient( UDateFormat* fmt,
00542 UBool isLenient);
00543
00553 U_STABLE const UCalendar* U_EXPORT2
00554 udat_getCalendar(const UDateFormat* fmt);
00555
00565 U_STABLE void U_EXPORT2
00566 udat_setCalendar( UDateFormat* fmt,
00567 const UCalendar* calendarToSet);
00568
00578 U_STABLE const UNumberFormat* U_EXPORT2
00579 udat_getNumberFormat(const UDateFormat* fmt);
00580
00590 U_STABLE void U_EXPORT2
00591 udat_setNumberFormat( UDateFormat* fmt,
00592 const UNumberFormat* numberFormatToSet);
00593
00603 U_STABLE const char* U_EXPORT2
00604 udat_getAvailable(int32_t index);
00605
00614 U_STABLE int32_t U_EXPORT2
00615 udat_countAvailable(void);
00616
00627 U_STABLE UDate U_EXPORT2
00628 udat_get2DigitYearStart( const UDateFormat *fmt,
00629 UErrorCode *status);
00630
00641 U_STABLE void U_EXPORT2
00642 udat_set2DigitYearStart( UDateFormat *fmt,
00643 UDate d,
00644 UErrorCode *status);
00645
00658 U_STABLE int32_t U_EXPORT2
00659 udat_toPattern( const UDateFormat *fmt,
00660 UBool localized,
00661 UChar *result,
00662 int32_t resultLength,
00663 UErrorCode *status);
00664
00675 U_STABLE void U_EXPORT2
00676 udat_applyPattern( UDateFormat *format,
00677 UBool localized,
00678 const UChar *pattern,
00679 int32_t patternLength);
00680
00685 typedef enum UDateFormatSymbolType {
00687 UDAT_ERAS,
00689 UDAT_MONTHS,
00691 UDAT_SHORT_MONTHS,
00693 UDAT_WEEKDAYS,
00695 UDAT_SHORT_WEEKDAYS,
00697 UDAT_AM_PMS,
00699 UDAT_LOCALIZED_CHARS,
00701 UDAT_ERA_NAMES,
00703 UDAT_NARROW_MONTHS,
00705 UDAT_NARROW_WEEKDAYS,
00707 UDAT_STANDALONE_MONTHS,
00708 UDAT_STANDALONE_SHORT_MONTHS,
00709 UDAT_STANDALONE_NARROW_MONTHS,
00711 UDAT_STANDALONE_WEEKDAYS,
00712 UDAT_STANDALONE_SHORT_WEEKDAYS,
00713 UDAT_STANDALONE_NARROW_WEEKDAYS,
00715 UDAT_QUARTERS,
00717 UDAT_SHORT_QUARTERS,
00719 UDAT_STANDALONE_QUARTERS,
00720 UDAT_STANDALONE_SHORT_QUARTERS
00721
00722 } UDateFormatSymbolType;
00723
00724 struct UDateFormatSymbols;
00729 typedef struct UDateFormatSymbols UDateFormatSymbols;
00730
00747 U_STABLE int32_t U_EXPORT2
00748 udat_getSymbols(const UDateFormat *fmt,
00749 UDateFormatSymbolType type,
00750 int32_t index,
00751 UChar *result,
00752 int32_t resultLength,
00753 UErrorCode *status);
00754
00767 U_STABLE int32_t U_EXPORT2
00768 udat_countSymbols( const UDateFormat *fmt,
00769 UDateFormatSymbolType type);
00770
00786 U_STABLE void U_EXPORT2
00787 udat_setSymbols( UDateFormat *format,
00788 UDateFormatSymbolType type,
00789 int32_t index,
00790 UChar *value,
00791 int32_t valueLength,
00792 UErrorCode *status);
00793
00803 U_STABLE const char* U_EXPORT2
00804 udat_getLocaleByType(const UDateFormat *fmt,
00805 ULocDataLocaleType type,
00806 UErrorCode* status);
00807
00808 #endif
00809
00810 #endif