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
00352 UDAT_FIELD_COUNT = 24
00353
00354 } UDateFormatField;
00355
00375 U_STABLE UDateFormat* U_EXPORT2
00376 udat_open(UDateFormatStyle timeStyle,
00377 UDateFormatStyle dateStyle,
00378 const char *locale,
00379 const UChar *tzID,
00380 int32_t tzIDLength,
00381 const UChar *pattern,
00382 int32_t patternLength,
00383 UErrorCode *status);
00384
00385
00392 U_STABLE void U_EXPORT2
00393 udat_close(UDateFormat* format);
00394
00403 U_STABLE UDateFormat* U_EXPORT2
00404 udat_clone(const UDateFormat *fmt,
00405 UErrorCode *status);
00406
00425 U_STABLE int32_t U_EXPORT2
00426 udat_format( const UDateFormat* format,
00427 UDate dateToFormat,
00428 UChar* result,
00429 int32_t resultLength,
00430 UFieldPosition* position,
00431 UErrorCode* status);
00432
00446 U_STABLE UDate U_EXPORT2
00447 udat_parse( const UDateFormat* format,
00448 const UChar* text,
00449 int32_t textLength,
00450 int32_t *parsePos,
00451 UErrorCode *status);
00452
00466 U_STABLE void U_EXPORT2
00467 udat_parseCalendar(const UDateFormat* format,
00468 UCalendar* calendar,
00469 const UChar* text,
00470 int32_t textLength,
00471 int32_t *parsePos,
00472 UErrorCode *status);
00473
00483 U_STABLE UBool U_EXPORT2
00484 udat_isLenient(const UDateFormat* fmt);
00485
00495 U_STABLE void U_EXPORT2
00496 udat_setLenient( UDateFormat* fmt,
00497 UBool isLenient);
00498
00508 U_STABLE const UCalendar* U_EXPORT2
00509 udat_getCalendar(const UDateFormat* fmt);
00510
00520 U_STABLE void U_EXPORT2
00521 udat_setCalendar( UDateFormat* fmt,
00522 const UCalendar* calendarToSet);
00523
00533 U_STABLE const UNumberFormat* U_EXPORT2
00534 udat_getNumberFormat(const UDateFormat* fmt);
00535
00545 U_STABLE void U_EXPORT2
00546 udat_setNumberFormat( UDateFormat* fmt,
00547 const UNumberFormat* numberFormatToSet);
00548
00558 U_STABLE const char* U_EXPORT2
00559 udat_getAvailable(int32_t index);
00560
00569 U_STABLE int32_t U_EXPORT2
00570 udat_countAvailable(void);
00571
00582 U_STABLE UDate U_EXPORT2
00583 udat_get2DigitYearStart( const UDateFormat *fmt,
00584 UErrorCode *status);
00585
00596 U_STABLE void U_EXPORT2
00597 udat_set2DigitYearStart( UDateFormat *fmt,
00598 UDate d,
00599 UErrorCode *status);
00600
00613 U_STABLE int32_t U_EXPORT2
00614 udat_toPattern( const UDateFormat *fmt,
00615 UBool localized,
00616 UChar *result,
00617 int32_t resultLength,
00618 UErrorCode *status);
00619
00630 U_STABLE void U_EXPORT2
00631 udat_applyPattern( UDateFormat *format,
00632 UBool localized,
00633 const UChar *pattern,
00634 int32_t patternLength);
00635
00640 typedef enum UDateFormatSymbolType {
00642 UDAT_ERAS,
00644 UDAT_MONTHS,
00646 UDAT_SHORT_MONTHS,
00648 UDAT_WEEKDAYS,
00650 UDAT_SHORT_WEEKDAYS,
00652 UDAT_AM_PMS,
00654 UDAT_LOCALIZED_CHARS
00655 } UDateFormatSymbolType;
00656
00657 struct UDateFormatSymbols;
00662 typedef struct UDateFormatSymbols UDateFormatSymbols;
00663
00680 U_STABLE int32_t U_EXPORT2
00681 udat_getSymbols(const UDateFormat *fmt,
00682 UDateFormatSymbolType type,
00683 int32_t index,
00684 UChar *result,
00685 int32_t resultLength,
00686 UErrorCode *status);
00687
00700 U_STABLE int32_t U_EXPORT2
00701 udat_countSymbols( const UDateFormat *fmt,
00702 UDateFormatSymbolType type);
00703
00719 U_STABLE void U_EXPORT2
00720 udat_setSymbols( UDateFormat *format,
00721 UDateFormatSymbolType type,
00722 int32_t index,
00723 UChar *value,
00724 int32_t valueLength,
00725 UErrorCode *status);
00726
00736 U_DRAFT const char* U_EXPORT2
00737 udat_getLocaleByType(const UDateFormat *fmt,
00738 ULocDataLocaleType type,
00739 UErrorCode* status);
00740
00741 #endif
00742
00743 #endif