00001
00002
00003
00004
00005
00006
00007 #ifndef UDAT_H
00008 #define UDAT_H
00009
00010 #include "unicode/utypes.h"
00011 #include "unicode/ucal.h"
00012 #include "unicode/unum.h"
00133 typedef void* UDateFormat;
00134
00136 enum UDateFormatStyle {
00138 UDAT_FULL,
00140 UDAT_LONG,
00142 UDAT_MEDIUM,
00144 UDAT_SHORT,
00146 UDAT_DEFAULT = UDAT_MEDIUM,
00148 UDAT_NONE = -1,
00150 UDAT_IGNORE = -2
00151
00152 };
00153 typedef enum UDateFormatStyle UDateFormatStyle;
00154
00176 U_CAPI UDateFormat* U_EXPORT2
00177 udat_open(UDateFormatStyle timeStyle,
00178 UDateFormatStyle dateStyle,
00179 const char *locale,
00180 const UChar *tzID,
00181 int32_t tzIDLength,
00182 const UChar *pattern,
00183 int32_t patternLength,
00184 UErrorCode *status);
00185
00186
00193 U_CAPI void U_EXPORT2
00194 udat_close(UDateFormat* format);
00195
00204 U_CAPI UDateFormat* U_EXPORT2
00205 udat_clone(const UDateFormat *fmt,
00206 UErrorCode *status);
00207
00227 U_CAPI int32_t U_EXPORT2
00228 udat_format( const UDateFormat* format,
00229 UDate dateToFormat,
00230 UChar* result,
00231 int32_t resultLength,
00232 UFieldPosition* position,
00233 UErrorCode* status);
00234
00249 U_CAPI UDate U_EXPORT2
00250 udat_parse( const UDateFormat* format,
00251 const UChar* text,
00252 int32_t textLength,
00253 int32_t *parsePos,
00254 UErrorCode *status);
00255
00265 U_CAPI UBool U_EXPORT2
00266 udat_isLenient(const UDateFormat* fmt);
00267
00277 U_CAPI void U_EXPORT2
00278 udat_setLenient( UDateFormat* fmt,
00279 UBool isLenient);
00280
00290 U_CAPI const UCalendar* U_EXPORT2
00291 udat_getCalendar(const UDateFormat* fmt);
00292
00302 U_CAPI void U_EXPORT2
00303 udat_setCalendar( UDateFormat* fmt,
00304 const UCalendar* calendarToSet);
00305
00315 U_CAPI const UNumberFormat* U_EXPORT2
00316 udat_getNumberFormat(const UDateFormat* fmt);
00317
00327 U_CAPI void U_EXPORT2
00328 udat_setNumberFormat( UDateFormat* fmt,
00329 const UNumberFormat* numberFormatToSet);
00330
00340 U_CAPI const char* U_EXPORT2
00341 udat_getAvailable(int32_t index);
00342
00351 U_CAPI int32_t U_EXPORT2
00352 udat_countAvailable(void);
00353
00364 U_CAPI UDate U_EXPORT2
00365 udat_get2DigitYearStart( const UDateFormat *fmt,
00366 UErrorCode *status);
00367
00378 U_CAPI void U_EXPORT2
00379 udat_set2DigitYearStart( UDateFormat *fmt,
00380 UDate d,
00381 UErrorCode *status);
00382
00395 U_CAPI int32_t U_EXPORT2
00396 udat_toPattern( const UDateFormat *fmt,
00397 UBool localized,
00398 UChar *result,
00399 int32_t resultLength,
00400 UErrorCode *status);
00401
00412 U_CAPI void U_EXPORT2
00413 udat_applyPattern( UDateFormat *format,
00414 UBool localized,
00415 const UChar *pattern,
00416 int32_t patternLength);
00417
00419 enum UDateFormatSymbolType {
00421 UDAT_ERAS,
00423 UDAT_MONTHS,
00425 UDAT_SHORT_MONTHS,
00427 UDAT_WEEKDAYS,
00429 UDAT_SHORT_WEEKDAYS,
00431 UDAT_AM_PMS,
00433 UDAT_LOCALIZED_CHARS
00434 };
00435 typedef enum UDateFormatSymbolType UDateFormatSymbolType;
00436
00440 struct UDateFormatSymbols;
00441 typedef struct UDateFormatSymbols UDateFormatSymbols;
00442
00459 U_CAPI int32_t U_EXPORT2
00460 udat_getSymbols(const UDateFormat *fmt,
00461 UDateFormatSymbolType type,
00462 int32_t index,
00463 UChar *result,
00464 int32_t resultLength,
00465 UErrorCode *status);
00466
00479 U_CAPI int32_t U_EXPORT2
00480 udat_countSymbols( const UDateFormat *fmt,
00481 UDateFormatSymbolType type);
00482
00499 U_CAPI void U_EXPORT2
00500 udat_setSymbols( UDateFormat *format,
00501 UDateFormatSymbolType type,
00502 int32_t index,
00503 UChar *value,
00504 int32_t valueLength,
00505 UErrorCode *status);
00506
00507
00511 #ifdef U_USE_DEPRECATED_FORMAT_API
00512 #if ((U_ICU_VERSION_MAJOR_NUM != 2) || (U_ICU_VERSION_MINOR_NUM !=0))
00513 # error "ICU version has changed. Please redefine the macros under U_USE_DEPRECATED_FORMAT_API pre-processor definition"
00514 #else
00515 static UDateFormat*
00516 udat_openPattern(const UChar* pattern,int32_t patternLength,const char* locale,UErrorCode *status)
00517 {
00518 return udat_open(UDAT_IGNORE,UDAT_IGNORE,locale,NULL,0,pattern,patternLength,status);
00519 }
00520
00521 # define udat_open_2_0(timeStyle,dateStyle,locale,tzId,tzIdLength,status) udat_open(timeStyle,dateStyle,locale,tzId,tzIdLength,NULL,0,status)
00522 #endif
00523 #endif
00524
00525 #endif