ICU 4.8.1.1
4.8.1.1
|
00001 /* 00002 ******************************************************************************* 00003 * Copyright (C) 1996-2011, 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 #define UCAL_UNKNOWN_ZONE_ID "Etc/Unknown" 00148 00153 typedef void* UCalendar; 00154 00158 enum UCalendarType { 00164 UCAL_TRADITIONAL, 00169 UCAL_DEFAULT = UCAL_TRADITIONAL, 00174 UCAL_GREGORIAN 00175 }; 00176 00178 typedef enum UCalendarType UCalendarType; 00179 00183 enum UCalendarDateFields { 00189 UCAL_ERA, 00190 00195 UCAL_YEAR, 00196 00216 UCAL_MONTH, 00217 00229 UCAL_WEEK_OF_YEAR, 00230 00244 UCAL_WEEK_OF_MONTH, 00245 00253 UCAL_DATE, 00254 00260 UCAL_DAY_OF_YEAR, 00261 00276 UCAL_DAY_OF_WEEK, 00277 00301 UCAL_DAY_OF_WEEK_IN_MONTH, 00302 00312 UCAL_AM_PM, 00313 00323 UCAL_HOUR, 00324 00332 UCAL_HOUR_OF_DAY, 00333 00340 UCAL_MINUTE, 00341 00348 UCAL_SECOND, 00349 00356 UCAL_MILLISECOND, 00357 00363 UCAL_ZONE_OFFSET, 00364 00370 UCAL_DST_OFFSET, 00371 00379 UCAL_YEAR_WOY, 00380 00387 UCAL_DOW_LOCAL, 00388 00395 UCAL_EXTENDED_YEAR, 00396 00407 UCAL_JULIAN_DAY, 00408 00418 UCAL_MILLISECONDS_IN_DAY, 00419 00424 UCAL_IS_LEAP_MONTH, 00425 00430 UCAL_FIELD_COUNT, 00431 00440 UCAL_DAY_OF_MONTH=UCAL_DATE 00441 }; 00442 00444 typedef enum UCalendarDateFields UCalendarDateFields; 00453 enum UCalendarDaysOfWeek { 00455 UCAL_SUNDAY = 1, 00457 UCAL_MONDAY, 00459 UCAL_TUESDAY, 00461 UCAL_WEDNESDAY, 00463 UCAL_THURSDAY, 00465 UCAL_FRIDAY, 00467 UCAL_SATURDAY 00468 }; 00469 00471 typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek; 00472 00476 enum UCalendarMonths { 00478 UCAL_JANUARY, 00480 UCAL_FEBRUARY, 00482 UCAL_MARCH, 00484 UCAL_APRIL, 00486 UCAL_MAY, 00488 UCAL_JUNE, 00490 UCAL_JULY, 00492 UCAL_AUGUST, 00494 UCAL_SEPTEMBER, 00496 UCAL_OCTOBER, 00498 UCAL_NOVEMBER, 00500 UCAL_DECEMBER, 00505 UCAL_UNDECIMBER 00506 }; 00507 00509 typedef enum UCalendarMonths UCalendarMonths; 00510 00514 enum UCalendarAMPMs { 00516 UCAL_AM, 00518 UCAL_PM 00519 }; 00520 00522 typedef enum UCalendarAMPMs UCalendarAMPMs; 00523 00530 enum USystemTimeZoneType { 00535 UCAL_ZONE_TYPE_ANY, 00540 UCAL_ZONE_TYPE_CANONICAL, 00545 UCAL_ZONE_TYPE_CANONICAL_LOCATION 00546 }; 00547 00549 typedef enum USystemTimeZoneType USystemTimeZoneType; 00550 00567 U_DRAFT UEnumeration* U_EXPORT2 00568 ucal_openTimeZoneIDEnumeration(USystemTimeZoneType zoneType, const char* region, 00569 const int32_t* rawOffset, UErrorCode* ec); 00570 00582 U_STABLE UEnumeration* U_EXPORT2 00583 ucal_openTimeZones(UErrorCode* ec); 00584 00601 U_STABLE UEnumeration* U_EXPORT2 00602 ucal_openCountryTimeZones(const char* country, UErrorCode* ec); 00603 00620 U_STABLE int32_t U_EXPORT2 00621 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec); 00622 00632 U_STABLE void U_EXPORT2 00633 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec); 00634 00651 U_STABLE int32_t U_EXPORT2 00652 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec); 00653 00660 U_STABLE UDate U_EXPORT2 00661 ucal_getNow(void); 00662 00686 U_STABLE UCalendar* U_EXPORT2 00687 ucal_open(const UChar* zoneID, 00688 int32_t len, 00689 const char* locale, 00690 UCalendarType type, 00691 UErrorCode* status); 00692 00699 U_STABLE void U_EXPORT2 00700 ucal_close(UCalendar *cal); 00701 00702 #if U_SHOW_CPLUSPLUS_API 00703 00704 U_NAMESPACE_BEGIN 00705 00715 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCalendarPointer, UCalendar, ucal_close); 00716 00717 U_NAMESPACE_END 00718 00719 #endif 00720 00729 U_STABLE UCalendar* U_EXPORT2 00730 ucal_clone(const UCalendar* cal, 00731 UErrorCode* status); 00732 00742 U_STABLE void U_EXPORT2 00743 ucal_setTimeZone(UCalendar* cal, 00744 const UChar* zoneID, 00745 int32_t len, 00746 UErrorCode* status); 00747 00752 enum UCalendarDisplayNameType { 00754 UCAL_STANDARD, 00756 UCAL_SHORT_STANDARD, 00758 UCAL_DST, 00760 UCAL_SHORT_DST 00761 }; 00762 00764 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType; 00765 00779 U_STABLE int32_t U_EXPORT2 00780 ucal_getTimeZoneDisplayName(const UCalendar* cal, 00781 UCalendarDisplayNameType type, 00782 const char* locale, 00783 UChar* result, 00784 int32_t resultLength, 00785 UErrorCode* status); 00786 00795 U_STABLE UBool U_EXPORT2 00796 ucal_inDaylightTime(const UCalendar* cal, 00797 UErrorCode* status ); 00798 00819 U_STABLE void U_EXPORT2 00820 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode); 00821 00842 U_STABLE UDate U_EXPORT2 00843 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode); 00844 00849 enum UCalendarAttribute { 00851 UCAL_LENIENT, 00853 UCAL_FIRST_DAY_OF_WEEK, 00855 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK 00856 }; 00857 00859 typedef enum UCalendarAttribute UCalendarAttribute; 00860 00872 U_STABLE int32_t U_EXPORT2 00873 ucal_getAttribute(const UCalendar* cal, 00874 UCalendarAttribute attr); 00875 00887 U_STABLE void U_EXPORT2 00888 ucal_setAttribute(UCalendar* cal, 00889 UCalendarAttribute attr, 00890 int32_t newValue); 00891 00901 U_STABLE const char* U_EXPORT2 00902 ucal_getAvailable(int32_t localeIndex); 00903 00912 U_STABLE int32_t U_EXPORT2 00913 ucal_countAvailable(void); 00914 00926 U_STABLE UDate U_EXPORT2 00927 ucal_getMillis(const UCalendar* cal, 00928 UErrorCode* status); 00929 00941 U_STABLE void U_EXPORT2 00942 ucal_setMillis(UCalendar* cal, 00943 UDate dateTime, 00944 UErrorCode* status ); 00945 00960 U_STABLE void U_EXPORT2 00961 ucal_setDate(UCalendar* cal, 00962 int32_t year, 00963 int32_t month, 00964 int32_t date, 00965 UErrorCode* status); 00966 00984 U_STABLE void U_EXPORT2 00985 ucal_setDateTime(UCalendar* cal, 00986 int32_t year, 00987 int32_t month, 00988 int32_t date, 00989 int32_t hour, 00990 int32_t minute, 00991 int32_t second, 00992 UErrorCode* status); 00993 01003 U_STABLE UBool U_EXPORT2 01004 ucal_equivalentTo(const UCalendar* cal1, 01005 const UCalendar* cal2); 01006 01022 U_STABLE void U_EXPORT2 01023 ucal_add(UCalendar* cal, 01024 UCalendarDateFields field, 01025 int32_t amount, 01026 UErrorCode* status); 01027 01043 U_STABLE void U_EXPORT2 01044 ucal_roll(UCalendar* cal, 01045 UCalendarDateFields field, 01046 int32_t amount, 01047 UErrorCode* status); 01048 01065 U_STABLE int32_t U_EXPORT2 01066 ucal_get(const UCalendar* cal, 01067 UCalendarDateFields field, 01068 UErrorCode* status ); 01069 01085 U_STABLE void U_EXPORT2 01086 ucal_set(UCalendar* cal, 01087 UCalendarDateFields field, 01088 int32_t value); 01089 01105 U_STABLE UBool U_EXPORT2 01106 ucal_isSet(const UCalendar* cal, 01107 UCalendarDateFields field); 01108 01123 U_STABLE void U_EXPORT2 01124 ucal_clearField(UCalendar* cal, 01125 UCalendarDateFields field); 01126 01137 U_STABLE void U_EXPORT2 01138 ucal_clear(UCalendar* calendar); 01139 01144 enum UCalendarLimitType { 01146 UCAL_MINIMUM, 01148 UCAL_MAXIMUM, 01150 UCAL_GREATEST_MINIMUM, 01152 UCAL_LEAST_MAXIMUM, 01154 UCAL_ACTUAL_MINIMUM, 01156 UCAL_ACTUAL_MAXIMUM 01157 }; 01158 01160 typedef enum UCalendarLimitType UCalendarLimitType; 01161 01176 U_STABLE int32_t U_EXPORT2 01177 ucal_getLimit(const UCalendar* cal, 01178 UCalendarDateFields field, 01179 UCalendarLimitType type, 01180 UErrorCode* status); 01181 01189 U_STABLE const char * U_EXPORT2 01190 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status); 01191 01198 U_STABLE const char * U_EXPORT2 01199 ucal_getTZDataVersion(UErrorCode* status); 01200 01219 U_STABLE int32_t U_EXPORT2 01220 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len, 01221 UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status); 01229 U_STABLE const char * U_EXPORT2 01230 ucal_getType(const UCalendar *cal, UErrorCode* status); 01231 01248 U_STABLE UEnumeration* U_EXPORT2 01249 ucal_getKeywordValuesForLocale(const char* key, 01250 const char* locale, 01251 UBool commonlyUsed, 01252 UErrorCode* status); 01253 01254 01258 enum UCalendarWeekdayType { 01263 UCAL_WEEKDAY, 01268 UCAL_WEEKEND, 01274 UCAL_WEEKEND_ONSET, 01280 UCAL_WEEKEND_CEASE 01281 }; 01282 01284 typedef enum UCalendarWeekdayType UCalendarWeekdayType; 01285 01302 U_STABLE UCalendarWeekdayType U_EXPORT2 01303 ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status); 01304 01320 U_STABLE int32_t U_EXPORT2 01321 ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status); 01322 01333 U_STABLE UBool U_EXPORT2 01334 ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status); 01335 01360 U_DRAFT int32_t U_EXPORT2 01361 ucal_getFieldDifference(UCalendar* cal, 01362 UDate target, 01363 UCalendarDateFields field, 01364 UErrorCode* status); 01365 01366 01367 #endif /* #if !UCONFIG_NO_FORMATTING */ 01368 01369 #endif