ICU 4.6 4.6
|
00001 /* 00002 ******************************************************************************* 00003 * Copyright (C) 1996-2010, International Business Machines Corporation and 00004 * others. All Rights Reserved. 00005 ******************************************************************************* 00006 */ 00007 00008 #ifndef UCAL_H 00009 #define UCAL_H 00010 00011 #include "unicode/utypes.h" 00012 #include "unicode/uenum.h" 00013 #include "unicode/uloc.h" 00014 #include "unicode/localpointer.h" 00015 00016 #if !UCONFIG_NO_FORMATTING 00017 00147 typedef void* UCalendar; 00148 00152 enum UCalendarType { 00158 UCAL_TRADITIONAL, 00163 UCAL_DEFAULT = UCAL_TRADITIONAL, 00168 UCAL_GREGORIAN 00169 }; 00170 00172 typedef enum UCalendarType UCalendarType; 00173 00177 enum UCalendarDateFields { 00183 UCAL_ERA, 00184 00189 UCAL_YEAR, 00190 00210 UCAL_MONTH, 00211 00223 UCAL_WEEK_OF_YEAR, 00224 00238 UCAL_WEEK_OF_MONTH, 00239 00247 UCAL_DATE, 00248 00254 UCAL_DAY_OF_YEAR, 00255 00270 UCAL_DAY_OF_WEEK, 00271 00295 UCAL_DAY_OF_WEEK_IN_MONTH, 00296 00306 UCAL_AM_PM, 00307 00317 UCAL_HOUR, 00318 00326 UCAL_HOUR_OF_DAY, 00327 00334 UCAL_MINUTE, 00335 00342 UCAL_SECOND, 00343 00350 UCAL_MILLISECOND, 00351 00357 UCAL_ZONE_OFFSET, 00358 00364 UCAL_DST_OFFSET, 00365 00373 UCAL_YEAR_WOY, 00374 00381 UCAL_DOW_LOCAL, 00382 00389 UCAL_EXTENDED_YEAR, 00390 00401 UCAL_JULIAN_DAY, 00402 00412 UCAL_MILLISECONDS_IN_DAY, 00413 00418 UCAL_IS_LEAP_MONTH, 00419 00424 UCAL_FIELD_COUNT, 00425 00434 UCAL_DAY_OF_MONTH=UCAL_DATE 00435 }; 00436 00438 typedef enum UCalendarDateFields UCalendarDateFields; 00447 enum UCalendarDaysOfWeek { 00449 UCAL_SUNDAY = 1, 00451 UCAL_MONDAY, 00453 UCAL_TUESDAY, 00455 UCAL_WEDNESDAY, 00457 UCAL_THURSDAY, 00459 UCAL_FRIDAY, 00461 UCAL_SATURDAY 00462 }; 00463 00465 typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek; 00466 00470 enum UCalendarMonths { 00472 UCAL_JANUARY, 00474 UCAL_FEBRUARY, 00476 UCAL_MARCH, 00478 UCAL_APRIL, 00480 UCAL_MAY, 00482 UCAL_JUNE, 00484 UCAL_JULY, 00486 UCAL_AUGUST, 00488 UCAL_SEPTEMBER, 00490 UCAL_OCTOBER, 00492 UCAL_NOVEMBER, 00494 UCAL_DECEMBER, 00499 UCAL_UNDECIMBER 00500 }; 00501 00503 typedef enum UCalendarMonths UCalendarMonths; 00504 00508 enum UCalendarAMPMs { 00510 UCAL_AM, 00512 UCAL_PM 00513 }; 00514 00516 typedef enum UCalendarAMPMs UCalendarAMPMs; 00517 00529 U_STABLE UEnumeration* U_EXPORT2 00530 ucal_openTimeZones(UErrorCode* ec); 00531 00548 U_STABLE UEnumeration* U_EXPORT2 00549 ucal_openCountryTimeZones(const char* country, UErrorCode* ec); 00550 00567 U_STABLE int32_t U_EXPORT2 00568 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec); 00569 00579 U_STABLE void U_EXPORT2 00580 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec); 00581 00598 U_STABLE int32_t U_EXPORT2 00599 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec); 00600 00607 U_STABLE UDate U_EXPORT2 00608 ucal_getNow(void); 00609 00632 U_STABLE UCalendar* U_EXPORT2 00633 ucal_open(const UChar* zoneID, 00634 int32_t len, 00635 const char* locale, 00636 UCalendarType type, 00637 UErrorCode* status); 00638 00645 U_STABLE void U_EXPORT2 00646 ucal_close(UCalendar *cal); 00647 00648 #if U_SHOW_CPLUSPLUS_API 00649 00650 U_NAMESPACE_BEGIN 00651 00661 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCalendarPointer, UCalendar, ucal_close); 00662 00663 U_NAMESPACE_END 00664 00665 #endif 00666 00675 U_STABLE UCalendar* U_EXPORT2 00676 ucal_clone(const UCalendar* cal, 00677 UErrorCode* status); 00678 00688 U_STABLE void U_EXPORT2 00689 ucal_setTimeZone(UCalendar* cal, 00690 const UChar* zoneID, 00691 int32_t len, 00692 UErrorCode* status); 00693 00698 enum UCalendarDisplayNameType { 00700 UCAL_STANDARD, 00702 UCAL_SHORT_STANDARD, 00704 UCAL_DST, 00706 UCAL_SHORT_DST 00707 }; 00708 00710 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType; 00711 00725 U_STABLE int32_t U_EXPORT2 00726 ucal_getTimeZoneDisplayName(const UCalendar* cal, 00727 UCalendarDisplayNameType type, 00728 const char* locale, 00729 UChar* result, 00730 int32_t resultLength, 00731 UErrorCode* status); 00732 00741 U_STABLE UBool U_EXPORT2 00742 ucal_inDaylightTime(const UCalendar* cal, 00743 UErrorCode* status ); 00744 00765 U_STABLE void U_EXPORT2 00766 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode); 00767 00788 U_STABLE UDate U_EXPORT2 00789 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode); 00790 00795 enum UCalendarAttribute { 00797 UCAL_LENIENT, 00799 UCAL_FIRST_DAY_OF_WEEK, 00801 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK 00802 }; 00803 00805 typedef enum UCalendarAttribute UCalendarAttribute; 00806 00818 U_STABLE int32_t U_EXPORT2 00819 ucal_getAttribute(const UCalendar* cal, 00820 UCalendarAttribute attr); 00821 00833 U_STABLE void U_EXPORT2 00834 ucal_setAttribute(UCalendar* cal, 00835 UCalendarAttribute attr, 00836 int32_t newValue); 00837 00847 U_STABLE const char* U_EXPORT2 00848 ucal_getAvailable(int32_t localeIndex); 00849 00858 U_STABLE int32_t U_EXPORT2 00859 ucal_countAvailable(void); 00860 00872 U_STABLE UDate U_EXPORT2 00873 ucal_getMillis(const UCalendar* cal, 00874 UErrorCode* status); 00875 00887 U_STABLE void U_EXPORT2 00888 ucal_setMillis(UCalendar* cal, 00889 UDate dateTime, 00890 UErrorCode* status ); 00891 00906 U_STABLE void U_EXPORT2 00907 ucal_setDate(UCalendar* cal, 00908 int32_t year, 00909 int32_t month, 00910 int32_t date, 00911 UErrorCode* status); 00912 00930 U_STABLE void U_EXPORT2 00931 ucal_setDateTime(UCalendar* cal, 00932 int32_t year, 00933 int32_t month, 00934 int32_t date, 00935 int32_t hour, 00936 int32_t minute, 00937 int32_t second, 00938 UErrorCode* status); 00939 00949 U_STABLE UBool U_EXPORT2 00950 ucal_equivalentTo(const UCalendar* cal1, 00951 const UCalendar* cal2); 00952 00968 U_STABLE void U_EXPORT2 00969 ucal_add(UCalendar* cal, 00970 UCalendarDateFields field, 00971 int32_t amount, 00972 UErrorCode* status); 00973 00989 U_STABLE void U_EXPORT2 00990 ucal_roll(UCalendar* cal, 00991 UCalendarDateFields field, 00992 int32_t amount, 00993 UErrorCode* status); 00994 01011 U_STABLE int32_t U_EXPORT2 01012 ucal_get(const UCalendar* cal, 01013 UCalendarDateFields field, 01014 UErrorCode* status ); 01015 01031 U_STABLE void U_EXPORT2 01032 ucal_set(UCalendar* cal, 01033 UCalendarDateFields field, 01034 int32_t value); 01035 01051 U_STABLE UBool U_EXPORT2 01052 ucal_isSet(const UCalendar* cal, 01053 UCalendarDateFields field); 01054 01069 U_STABLE void U_EXPORT2 01070 ucal_clearField(UCalendar* cal, 01071 UCalendarDateFields field); 01072 01083 U_STABLE void U_EXPORT2 01084 ucal_clear(UCalendar* calendar); 01085 01090 enum UCalendarLimitType { 01092 UCAL_MINIMUM, 01094 UCAL_MAXIMUM, 01096 UCAL_GREATEST_MINIMUM, 01098 UCAL_LEAST_MAXIMUM, 01100 UCAL_ACTUAL_MINIMUM, 01102 UCAL_ACTUAL_MAXIMUM 01103 }; 01104 01106 typedef enum UCalendarLimitType UCalendarLimitType; 01107 01122 U_STABLE int32_t U_EXPORT2 01123 ucal_getLimit(const UCalendar* cal, 01124 UCalendarDateFields field, 01125 UCalendarLimitType type, 01126 UErrorCode* status); 01127 01135 U_STABLE const char * U_EXPORT2 01136 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status); 01137 01144 U_STABLE const char * U_EXPORT2 01145 ucal_getTZDataVersion(UErrorCode* status); 01146 01165 U_STABLE int32_t U_EXPORT2 01166 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len, 01167 UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status); 01175 U_STABLE const char * U_EXPORT2 01176 ucal_getType(const UCalendar *cal, UErrorCode* status); 01177 01194 U_STABLE UEnumeration* U_EXPORT2 01195 ucal_getKeywordValuesForLocale(const char* key, 01196 const char* locale, 01197 UBool commonlyUsed, 01198 UErrorCode* status); 01199 01200 01204 enum UCalendarWeekdayType { 01209 UCAL_WEEKDAY, 01214 UCAL_WEEKEND, 01220 UCAL_WEEKEND_ONSET, 01226 UCAL_WEEKEND_CEASE 01227 }; 01228 01230 typedef enum UCalendarWeekdayType UCalendarWeekdayType; 01231 01248 U_STABLE UCalendarWeekdayType U_EXPORT2 01249 ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status); 01250 01266 U_STABLE int32_t U_EXPORT2 01267 ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status); 01268 01279 U_STABLE UBool U_EXPORT2 01280 ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status); 01281 01282 01283 #endif /* #if !UCONFIG_NO_FORMATTING */ 01284 01285 #endif