00001
00002
00003
00004
00005
00006
00007 #ifndef UDAT_H
00008 #define UDAT_H
00009
00010 #include "unicode/utypes.h"
00011
00012 #if !UCONFIG_NO_FORMATTING
00013
00014 #include "unicode/ucal.h"
00015 #include "unicode/unum.h"
00137 typedef void* UDateFormat;
00138
00142 typedef enum UDateFormatStyle {
00144 UDAT_FULL,
00146 UDAT_LONG,
00148 UDAT_MEDIUM,
00150 UDAT_SHORT,
00152 UDAT_DEFAULT = UDAT_MEDIUM,
00154 UDAT_NONE = -1,
00156 UDAT_IGNORE = -2
00157
00158 } UDateFormatStyle;
00159
00165 typedef enum UDateFormatField {
00171 UDAT_ERA_FIELD = 0,
00172
00178 UDAT_YEAR_FIELD = 1,
00179
00185 UDAT_MONTH_FIELD = 2,
00186
00192 UDAT_DATE_FIELD = 3,
00193
00201 UDAT_HOUR_OF_DAY1_FIELD = 4,
00202
00210 UDAT_HOUR_OF_DAY0_FIELD = 5,
00211
00217 UDAT_MINUTE_FIELD = 6,
00218
00224 UDAT_SECOND_FIELD = 7,
00225
00231 UDAT_FRACTIONAL_SECOND_FIELD = 8,
00232
00238 UDAT_DAY_OF_WEEK_FIELD = 9,
00239
00245 UDAT_DAY_OF_YEAR_FIELD = 10,
00246
00252 UDAT_DAY_OF_WEEK_IN_MONTH_FIELD = 11,
00253
00259 UDAT_WEEK_OF_YEAR_FIELD = 12,
00260
00266 UDAT_WEEK_OF_MONTH_FIELD = 13,
00267
00273 UDAT_AM_PM_FIELD = 14,
00274
00282 UDAT_HOUR1_FIELD = 15,
00283
00291 UDAT_HOUR0_FIELD = 16,
00292
00299 UDAT_TIMEZONE_FIELD = 17,
00300
00306 UDAT_YEAR_WOY_FIELD = 18,
00307
00313 UDAT_DOW_LOCAL_FIELD = 19,
00314
00320 UDAT_EXTENDED_YEAR_FIELD = 20,
00321
00327 UDAT_JULIAN_DAY_FIELD = 21,
00328
00334 UDAT_MILLISECONDS_IN_DAY_FIELD = 22,
00335
00342 UDAT_TIMEZONE_RFC_FIELD = 23,
00343
00349 UDAT_TIMEZONE_GENERIC_FIELD = 24,
00356 UDAT_STANDALONE_DAY_FIELD = 25,
00357
00364 UDAT_STANDALONE_MONTH_FIELD = 26,
00365
00374 UDAT_FIELD_COUNT = 27
00375
00376 } UDateFormatField;
00377
00397 U_STABLE UDateFormat* U_EXPORT2
00398 udat_open(UDateFormatStyle timeStyle,
00399 UDateFormatStyle dateStyle,
00400 const char *locale,
00401 const UChar *tzID,
00402 int32_t tzIDLength,
00403 const UChar *pattern,
00404 int32_t patternLength,
00405 UErrorCode *status);
00406
00407
00414 U_STABLE void U_EXPORT2
00415 udat_close(UDateFormat* format);
00416
00425 U_STABLE UDateFormat* U_EXPORT2
00426 udat_clone(const UDateFormat *fmt,
00427 UErrorCode *status);
00428
00447 U_STABLE int32_t U_EXPORT2
00448 udat_format( const UDateFormat* format,
00449 UDate dateToFormat,
00450 UChar* result,
00451 int32_t resultLength,
00452 UFieldPosition* position,
00453 UErrorCode* status);
00454
00468 U_STABLE UDate U_EXPORT2
00469 udat_parse( const UDateFormat* format,
00470 const UChar* text,
00471 int32_t textLength,
00472 int32_t *parsePos,
00473 UErrorCode *status);
00474
00488 U_STABLE void U_EXPORT2
00489 udat_parseCalendar(const UDateFormat* format,
00490 UCalendar* calendar,
00491 const UChar* text,
00492 int32_t textLength,
00493 int32_t *parsePos,
00494 UErrorCode *status);
00495
00505 U_STABLE UBool U_EXPORT2
00506 udat_isLenient(const UDateFormat* fmt);
00507
00517 U_STABLE void U_EXPORT2
00518 udat_setLenient( UDateFormat* fmt,
00519 UBool isLenient);
00520
00530 U_STABLE const UCalendar* U_EXPORT2
00531 udat_getCalendar(const UDateFormat* fmt);
00532
00542 U_STABLE void U_EXPORT2
00543 udat_setCalendar( UDateFormat* fmt,
00544 const UCalendar* calendarToSet);
00545
00555 U_STABLE const UNumberFormat* U_EXPORT2
00556 udat_getNumberFormat(const UDateFormat* fmt);
00557
00567 U_STABLE void U_EXPORT2
00568 udat_setNumberFormat( UDateFormat* fmt,
00569 const UNumberFormat* numberFormatToSet);
00570
00580 U_STABLE const char* U_EXPORT2
00581 udat_getAvailable(int32_t index);
00582
00591 U_STABLE int32_t U_EXPORT2
00592 udat_countAvailable(void);
00593
00604 U_STABLE UDate U_EXPORT2
00605 udat_get2DigitYearStart( const UDateFormat *fmt,
00606 UErrorCode *status);
00607
00618 U_STABLE void U_EXPORT2
00619 udat_set2DigitYearStart( UDateFormat *fmt,
00620 UDate d,
00621 UErrorCode *status);
00622
00635 U_STABLE int32_t U_EXPORT2
00636 udat_toPattern( const UDateFormat *fmt,
00637 UBool localized,
00638 UChar *result,
00639 int32_t resultLength,
00640 UErrorCode *status);
00641
00652 U_STABLE void U_EXPORT2
00653 udat_applyPattern( UDateFormat *format,
00654 UBool localized,
00655 const UChar *pattern,
00656 int32_t patternLength);
00657
00662 typedef enum UDateFormatSymbolType {
00664 UDAT_ERAS,
00666 UDAT_MONTHS,
00668 UDAT_SHORT_MONTHS,
00670 UDAT_WEEKDAYS,
00672 UDAT_SHORT_WEEKDAYS,
00674 UDAT_AM_PMS,
00676 UDAT_LOCALIZED_CHARS,
00678 UDAT_ERA_NAMES,
00680 UDAT_NARROW_MONTHS,
00682 UDAT_NARROW_WEEKDAYS,
00684 UDAT_STANDALONE_MONTHS,
00685 UDAT_STANDALONE_SHORT_MONTHS,
00686 UDAT_STANDALONE_NARROW_MONTHS,
00688 UDAT_STANDALONE_WEEKDAYS,
00689 UDAT_STANDALONE_SHORT_WEEKDAYS,
00690 UDAT_STANDALONE_NARROW_WEEKDAYS
00691 } UDateFormatSymbolType;
00692
00693 struct UDateFormatSymbols;
00698 typedef struct UDateFormatSymbols UDateFormatSymbols;
00699
00716 U_STABLE int32_t U_EXPORT2
00717 udat_getSymbols(const UDateFormat *fmt,
00718 UDateFormatSymbolType type,
00719 int32_t index,
00720 UChar *result,
00721 int32_t resultLength,
00722 UErrorCode *status);
00723
00736 U_STABLE int32_t U_EXPORT2
00737 udat_countSymbols( const UDateFormat *fmt,
00738 UDateFormatSymbolType type);
00739
00755 U_STABLE void U_EXPORT2
00756 udat_setSymbols( UDateFormat *format,
00757 UDateFormatSymbolType type,
00758 int32_t index,
00759 UChar *value,
00760 int32_t valueLength,
00761 UErrorCode *status);
00762
00772 U_DRAFT const char* U_EXPORT2
00773 udat_getLocaleByType(const UDateFormat *fmt,
00774 ULocDataLocaleType type,
00775 UErrorCode* status);
00776
00777 #endif
00778
00779 #endif