00001
00002
00003
00004
00005
00006 #ifndef UCAL_H
00007 #define UCAL_H
00008
00009 #include "unicode/utypes.h"
00010 #include "unicode/uenum.h"
00011 #include "unicode/uloc.h"
00012
00013 #if !UCONFIG_NO_FORMATTING
00014
00144 typedef void* UCalendar;
00145
00149 enum UCalendarType {
00151 UCAL_TRADITIONAL,
00153 UCAL_GREGORIAN
00154 };
00155
00157 typedef enum UCalendarType UCalendarType;
00158
00162 enum UCalendarDateFields {
00167 UCAL_ERA,
00172 UCAL_YEAR,
00177 UCAL_MONTH,
00182 UCAL_WEEK_OF_YEAR,
00187 UCAL_WEEK_OF_MONTH,
00192 UCAL_DATE,
00197 UCAL_DAY_OF_YEAR,
00202 UCAL_DAY_OF_WEEK,
00207 UCAL_DAY_OF_WEEK_IN_MONTH,
00212 UCAL_AM_PM,
00217 UCAL_HOUR,
00222 UCAL_HOUR_OF_DAY,
00227 UCAL_MINUTE,
00232 UCAL_SECOND,
00237 UCAL_MILLISECOND,
00242 UCAL_ZONE_OFFSET,
00247 UCAL_DST_OFFSET,
00252 UCAL_YEAR_WOY,
00257 UCAL_DOW_LOCAL,
00262 UCAL_EXTENDED_YEAR,
00267 UCAL_JULIAN_DAY,
00272 UCAL_MILLISECONDS_IN_DAY,
00277 UCAL_FIELD_COUNT,
00278
00283 UCAL_DAY_OF_MONTH=UCAL_DATE
00284 };
00285
00287 typedef enum UCalendarDateFields UCalendarDateFields;
00296 enum UCalendarDaysOfWeek {
00298 UCAL_SUNDAY = 1,
00300 UCAL_MONDAY,
00302 UCAL_TUESDAY,
00304 UCAL_WEDNESDAY,
00306 UCAL_THURSDAY,
00308 UCAL_FRIDAY,
00310 UCAL_SATURDAY
00311 };
00312
00314 typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek;
00315
00319 enum UCalendarMonths {
00321 UCAL_JANUARY,
00323 UCAL_FEBRUARY,
00325 UCAL_MARCH,
00327 UCAL_APRIL,
00329 UCAL_MAY,
00331 UCAL_JUNE,
00333 UCAL_JULY,
00335 UCAL_AUGUST,
00337 UCAL_SEPTEMBER,
00339 UCAL_OCTOBER,
00341 UCAL_NOVEMBER,
00343 UCAL_DECEMBER,
00345 UCAL_UNDECIMBER
00346 };
00347
00349 typedef enum UCalendarMonths UCalendarMonths;
00350
00354 enum UCalendarAMPMs {
00356 UCAL_AM,
00358 UCAL_PM
00359 };
00360
00362 typedef enum UCalendarAMPMs UCalendarAMPMs;
00363
00375 U_CAPI UEnumeration* U_EXPORT2
00376 ucal_openTimeZones(UErrorCode* ec);
00377
00394 U_CAPI UEnumeration* U_EXPORT2
00395 ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
00396
00413 U_CAPI int32_t U_EXPORT2
00414 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
00415
00425 U_CAPI void U_EXPORT2
00426 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
00427
00444 U_CAPI int32_t U_EXPORT2
00445 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
00446
00453 U_CAPI UDate U_EXPORT2
00454 ucal_getNow(void);
00455
00468 U_CAPI UCalendar* U_EXPORT2
00469 ucal_open(const UChar* zoneID,
00470 int32_t len,
00471 const char* locale,
00472 UCalendarType type,
00473 UErrorCode* status);
00474
00481 U_CAPI void U_EXPORT2
00482 ucal_close(UCalendar *cal);
00483
00493 U_CAPI void U_EXPORT2
00494 ucal_setTimeZone(UCalendar* cal,
00495 const UChar* zoneID,
00496 int32_t len,
00497 UErrorCode* status);
00498
00503 enum UCalendarDisplayNameType {
00505 UCAL_STANDARD,
00507 UCAL_SHORT_STANDARD,
00509 UCAL_DST,
00511 UCAL_SHORT_DST
00512 };
00513
00515 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType;
00516
00530 U_CAPI int32_t U_EXPORT2
00531 ucal_getTimeZoneDisplayName(const UCalendar* cal,
00532 UCalendarDisplayNameType type,
00533 const char* locale,
00534 UChar* result,
00535 int32_t resultLength,
00536 UErrorCode* status);
00537
00546 U_CAPI UBool U_EXPORT2
00547 ucal_inDaylightTime(const UCalendar* cal,
00548 UErrorCode* status );
00549
00554 enum UCalendarAttribute {
00556 UCAL_LENIENT,
00558 UCAL_FIRST_DAY_OF_WEEK,
00560 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK
00561 };
00562
00564 typedef enum UCalendarAttribute UCalendarAttribute;
00565
00577 U_CAPI int32_t U_EXPORT2
00578 ucal_getAttribute(const UCalendar* cal,
00579 UCalendarAttribute attr);
00580
00592 U_CAPI void U_EXPORT2
00593 ucal_setAttribute(UCalendar* cal,
00594 UCalendarAttribute attr,
00595 int32_t newValue);
00596
00606 U_CAPI const char* U_EXPORT2
00607 ucal_getAvailable(int32_t index);
00608
00617 U_CAPI int32_t U_EXPORT2
00618 ucal_countAvailable(void);
00619
00631 U_CAPI UDate U_EXPORT2
00632 ucal_getMillis(const UCalendar* cal,
00633 UErrorCode* status);
00634
00646 U_CAPI void U_EXPORT2
00647 ucal_setMillis(UCalendar* cal,
00648 UDate dateTime,
00649 UErrorCode* status );
00650
00665 U_CAPI void U_EXPORT2
00666 ucal_setDate(UCalendar* cal,
00667 int32_t year,
00668 int32_t month,
00669 int32_t date,
00670 UErrorCode* status);
00671
00689 U_CAPI void U_EXPORT2
00690 ucal_setDateTime(UCalendar* cal,
00691 int32_t year,
00692 int32_t month,
00693 int32_t date,
00694 int32_t hour,
00695 int32_t minute,
00696 int32_t second,
00697 UErrorCode* status);
00698
00708 U_CAPI UBool U_EXPORT2
00709 ucal_equivalentTo(const UCalendar* cal1,
00710 const UCalendar* cal2);
00711
00727 U_CAPI void U_EXPORT2
00728 ucal_add(UCalendar* cal,
00729 UCalendarDateFields field,
00730 int32_t amount,
00731 UErrorCode* status);
00732
00748 U_CAPI void U_EXPORT2
00749 ucal_roll(UCalendar* cal,
00750 UCalendarDateFields field,
00751 int32_t amount,
00752 UErrorCode* status);
00753
00770 U_CAPI int32_t U_EXPORT2
00771 ucal_get(const UCalendar* cal,
00772 UCalendarDateFields field,
00773 UErrorCode* status );
00774
00790 U_CAPI void U_EXPORT2
00791 ucal_set(UCalendar* cal,
00792 UCalendarDateFields field,
00793 int32_t value);
00794
00810 U_CAPI UBool U_EXPORT2
00811 ucal_isSet(const UCalendar* cal,
00812 UCalendarDateFields field);
00813
00828 U_CAPI void U_EXPORT2
00829 ucal_clearField(UCalendar* cal,
00830 UCalendarDateFields field);
00831
00842 U_CAPI void U_EXPORT2
00843 ucal_clear(UCalendar* calendar);
00844
00849 enum UCalendarLimitType {
00851 UCAL_MINIMUM,
00853 UCAL_MAXIMUM,
00855 UCAL_GREATEST_MINIMUM,
00857 UCAL_LEAST_MAXIMUM,
00859 UCAL_ACTUAL_MINIMUM,
00861 UCAL_ACTUAL_MAXIMUM
00862 };
00863
00865 typedef enum UCalendarLimitType UCalendarLimitType;
00866
00881 U_CAPI int32_t U_EXPORT2
00882 ucal_getLimit(const UCalendar* cal,
00883 UCalendarDateFields field,
00884 UCalendarLimitType type,
00885 UErrorCode* status);
00886
00887 #ifdef U_USE_UCAL_OBSOLETE_2_8
00888
00898 U_CAPI const UChar* U_EXPORT2
00899 ucal_getAvailableTZIDs(int32_t rawOffset,
00900 int32_t index,
00901 UErrorCode* status);
00902
00912 U_CAPI int32_t U_EXPORT2
00913 ucal_countAvailableTZIDs(int32_t rawOffset);
00914 #endif
00915
00923 U_CAPI const char * U_EXPORT2
00924 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
00925
00926 #endif
00927
00928 #endif