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"
00136 typedef void* UDateFormat;
00137
00139 typedef enum UDateFormatStyle {
00141 UDAT_FULL,
00143 UDAT_LONG,
00145 UDAT_MEDIUM,
00147 UDAT_SHORT,
00149 UDAT_DEFAULT = UDAT_MEDIUM,
00151 UDAT_NONE = -1,
00153 UDAT_IGNORE = -2
00154
00155 } UDateFormatStyle;
00156
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
00270 U_CAPI void U_EXPORT2
00271 udat_parseCalendar(const UDateFormat* format,
00272 UCalendar* calendar,
00273 const UChar* text,
00274 int32_t textLength,
00275 int32_t *parsePos,
00276 UErrorCode *status);
00277
00287 U_CAPI UBool U_EXPORT2
00288 udat_isLenient(const UDateFormat* fmt);
00289
00299 U_CAPI void U_EXPORT2
00300 udat_setLenient( UDateFormat* fmt,
00301 UBool isLenient);
00302
00312 U_CAPI const UCalendar* U_EXPORT2
00313 udat_getCalendar(const UDateFormat* fmt);
00314
00324 U_CAPI void U_EXPORT2
00325 udat_setCalendar( UDateFormat* fmt,
00326 const UCalendar* calendarToSet);
00327
00337 U_CAPI const UNumberFormat* U_EXPORT2
00338 udat_getNumberFormat(const UDateFormat* fmt);
00339
00349 U_CAPI void U_EXPORT2
00350 udat_setNumberFormat( UDateFormat* fmt,
00351 const UNumberFormat* numberFormatToSet);
00352
00362 U_CAPI const char* U_EXPORT2
00363 udat_getAvailable(int32_t index);
00364
00373 U_CAPI int32_t U_EXPORT2
00374 udat_countAvailable(void);
00375
00386 U_CAPI UDate U_EXPORT2
00387 udat_get2DigitYearStart( const UDateFormat *fmt,
00388 UErrorCode *status);
00389
00400 U_CAPI void U_EXPORT2
00401 udat_set2DigitYearStart( UDateFormat *fmt,
00402 UDate d,
00403 UErrorCode *status);
00404
00417 U_CAPI int32_t U_EXPORT2
00418 udat_toPattern( const UDateFormat *fmt,
00419 UBool localized,
00420 UChar *result,
00421 int32_t resultLength,
00422 UErrorCode *status);
00423
00434 U_CAPI void U_EXPORT2
00435 udat_applyPattern( UDateFormat *format,
00436 UBool localized,
00437 const UChar *pattern,
00438 int32_t patternLength);
00439
00441 typedef enum UDateFormatSymbolType {
00443 UDAT_ERAS,
00445 UDAT_MONTHS,
00447 UDAT_SHORT_MONTHS,
00449 UDAT_WEEKDAYS,
00451 UDAT_SHORT_WEEKDAYS,
00453 UDAT_AM_PMS,
00455 UDAT_LOCALIZED_CHARS
00456 } UDateFormatSymbolType;
00457
00461 struct UDateFormatSymbols;
00462 typedef struct UDateFormatSymbols UDateFormatSymbols;
00463
00480 U_CAPI int32_t U_EXPORT2
00481 udat_getSymbols(const UDateFormat *fmt,
00482 UDateFormatSymbolType type,
00483 int32_t index,
00484 UChar *result,
00485 int32_t resultLength,
00486 UErrorCode *status);
00487
00500 U_CAPI int32_t U_EXPORT2
00501 udat_countSymbols( const UDateFormat *fmt,
00502 UDateFormatSymbolType type);
00503
00519 U_CAPI void U_EXPORT2
00520 udat_setSymbols( UDateFormat *format,
00521 UDateFormatSymbolType type,
00522 int32_t index,
00523 UChar *value,
00524 int32_t valueLength,
00525 UErrorCode *status);
00526
00527
00531 #ifdef U_USE_DEPRECATED_FORMAT_API
00532 #if ((U_ICU_VERSION_MAJOR_NUM != 2) || (U_ICU_VERSION_MINOR_NUM != 2))
00533 # error "ICU version has changed. Please redefine the macros under U_USE_DEPRECATED_FORMAT_API pre-processor definition"
00534 #else
00535 static UDateFormat*
00536 udat_openPattern(const UChar* pattern,int32_t patternLength,const char* locale,UErrorCode *status)
00537 {
00538 return udat_open(UDAT_IGNORE,UDAT_IGNORE,locale,NULL,0,pattern,patternLength,status);
00539 }
00540
00541 # define udat_open_2_2(timeStyle,dateStyle,locale,tzId,tzIdLength,status) udat_open(timeStyle,dateStyle,locale,tzId,tzIdLength,NULL,0,status)
00542 #endif
00543 #endif
00544
00545
00546 #endif
00547
00548 #endif