00001 /* 00002 ******************************************************************************* 00003 * Copyright © {1996-1999}, International Business Machines Corporation and others. All Rights Reserved. 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" 00098 typedef void* UDateFormat; 00099 00101 enum UDateFormatStyle { 00103 UDAT_FULL, 00105 UDAT_LONG, 00107 UDAT_MEDIUM, 00109 UDAT_SHORT, 00111 UDAT_DEFAULT = UDAT_MEDIUM, 00113 UDAT_NONE = -1 00114 }; 00115 typedef enum UDateFormatStyle UDateFormatStyle; 00116 00135 U_CAPI UDateFormat* 00136 udat_open(UDateFormatStyle timeStyle, 00137 UDateFormatStyle dateStyle, 00138 const char *locale, 00139 const UChar *tzID, 00140 int32_t tzIDLength, 00141 UErrorCode *status); 00142 00156 U_CAPI UDateFormat* 00157 udat_openPattern( const UChar *pattern, 00158 int32_t patternLength, 00159 const char *locale, 00160 UErrorCode *status); 00161 00168 U_CAPI void 00169 udat_close(UDateFormat* format); 00170 00179 U_CAPI UDateFormat* 00180 udat_clone(const UDateFormat *fmt, 00181 UErrorCode *status); 00182 00197 U_CAPI int32_t 00198 udat_format( const UDateFormat* format, 00199 UDate dateToFormat, 00200 UChar* result, 00201 int32_t resultLength, 00202 UFieldPosition* position, 00203 UErrorCode* status); 00204 00219 U_CAPI UDate 00220 udat_parse( const UDateFormat* format, 00221 const UChar* text, 00222 int32_t textLength, 00223 int32_t *parsePos, 00224 UErrorCode *status); 00225 00235 U_CAPI UBool 00236 udat_isLenient(const UDateFormat* fmt); 00237 00247 U_CAPI void 00248 udat_setLenient( UDateFormat* fmt, 00249 UBool isLenient); 00250 00260 U_CAPI const UCalendar* 00261 udat_getCalendar(const UDateFormat* fmt); 00262 00272 U_CAPI void 00273 udat_setCalendar( UDateFormat* fmt, 00274 const UCalendar* calendarToSet); 00275 00285 U_CAPI const UNumberFormat* 00286 udat_getNumberFormat(const UDateFormat* fmt); 00287 00297 U_CAPI void 00298 udat_setNumberFormat( UDateFormat* fmt, 00299 const UNumberFormat* numberFormatToSet); 00300 00310 U_CAPI const char* 00311 udat_getAvailable(int32_t index); 00312 00321 U_CAPI int32_t 00322 udat_countAvailable(void); 00323 00334 U_CAPI UDate 00335 udat_get2DigitYearStart( const UDateFormat *fmt, 00336 UErrorCode *status); 00337 00348 U_CAPI void 00349 udat_set2DigitYearStart( UDateFormat *fmt, 00350 UDate d, 00351 UErrorCode *status); 00352 00365 U_CAPI int32_t 00366 udat_toPattern( const UDateFormat *fmt, 00367 UBool localized, 00368 UChar *result, 00369 int32_t resultLength, 00370 UErrorCode *status); 00371 00382 U_CAPI void 00383 udat_applyPattern( UDateFormat *format, 00384 UBool localized, 00385 const UChar *pattern, 00386 int32_t patternLength); 00387 00389 enum UDateFormatSymbolType { 00391 UDAT_ERAS, 00393 UDAT_MONTHS, 00395 UDAT_SHORT_MONTHS, 00397 UDAT_WEEKDAYS, 00399 UDAT_SHORT_WEEKDAYS, 00401 UDAT_AM_PMS, 00403 UDAT_LOCALIZED_CHARS 00404 }; 00405 typedef enum UDateFormatSymbolType UDateFormatSymbolType; 00406 00410 struct UDateFormatSymbols; 00411 typedef struct UDateFormatSymbols UDateFormatSymbols; 00412 00429 U_CAPI int32_t 00430 udat_getSymbols(const UDateFormat *fmt, 00431 UDateFormatSymbolType type, 00432 int32_t index, 00433 UChar *result, 00434 int32_t resultLength, 00435 UErrorCode *status); 00436 00449 U_CAPI int32_t 00450 udat_countSymbols( const UDateFormat *fmt, 00451 UDateFormatSymbolType type); 00452 00469 U_CAPI void 00470 udat_setSymbols( UDateFormat *format, 00471 UDateFormatSymbolType type, 00472 int32_t index, 00473 UChar *value, 00474 int32_t valueLength, 00475 UErrorCode *status); 00476 00477 #endif