ICU 49.1.1
49.1.1
|
00001 /* 00002 ******************************************************************************* 00003 * Copyright (C) 1996-2012, 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 { 00854 UCAL_LENIENT, 00859 UCAL_FIRST_DAY_OF_WEEK, 00864 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK 00865 #ifndef U_HIDE_DRAFT_API 00866 , 00872 UCAL_REPEATED_WALL_TIME, 00878 UCAL_SKIPPED_WALL_TIME 00879 #endif /* U_HIDE_DRAFT_API */ 00880 }; 00881 00883 typedef enum UCalendarAttribute UCalendarAttribute; 00884 00890 enum UCalendarWallTimeOption { 00897 UCAL_WALLTIME_LAST 00898 #ifndef U_HIDE_DRAFT_API 00899 , 00906 UCAL_WALLTIME_FIRST, 00912 UCAL_WALLTIME_NEXT_VALID 00913 #endif /* U_HIDE_DRAFT_API */ 00914 }; 00916 typedef enum UCalendarWallTimeOption UCalendarWallTimeOption; 00917 00929 U_STABLE int32_t U_EXPORT2 00930 ucal_getAttribute(const UCalendar* cal, 00931 UCalendarAttribute attr); 00932 00944 U_STABLE void U_EXPORT2 00945 ucal_setAttribute(UCalendar* cal, 00946 UCalendarAttribute attr, 00947 int32_t newValue); 00948 00958 U_STABLE const char* U_EXPORT2 00959 ucal_getAvailable(int32_t localeIndex); 00960 00969 U_STABLE int32_t U_EXPORT2 00970 ucal_countAvailable(void); 00971 00983 U_STABLE UDate U_EXPORT2 00984 ucal_getMillis(const UCalendar* cal, 00985 UErrorCode* status); 00986 00998 U_STABLE void U_EXPORT2 00999 ucal_setMillis(UCalendar* cal, 01000 UDate dateTime, 01001 UErrorCode* status ); 01002 01017 U_STABLE void U_EXPORT2 01018 ucal_setDate(UCalendar* cal, 01019 int32_t year, 01020 int32_t month, 01021 int32_t date, 01022 UErrorCode* status); 01023 01041 U_STABLE void U_EXPORT2 01042 ucal_setDateTime(UCalendar* cal, 01043 int32_t year, 01044 int32_t month, 01045 int32_t date, 01046 int32_t hour, 01047 int32_t minute, 01048 int32_t second, 01049 UErrorCode* status); 01050 01060 U_STABLE UBool U_EXPORT2 01061 ucal_equivalentTo(const UCalendar* cal1, 01062 const UCalendar* cal2); 01063 01079 U_STABLE void U_EXPORT2 01080 ucal_add(UCalendar* cal, 01081 UCalendarDateFields field, 01082 int32_t amount, 01083 UErrorCode* status); 01084 01100 U_STABLE void U_EXPORT2 01101 ucal_roll(UCalendar* cal, 01102 UCalendarDateFields field, 01103 int32_t amount, 01104 UErrorCode* status); 01105 01122 U_STABLE int32_t U_EXPORT2 01123 ucal_get(const UCalendar* cal, 01124 UCalendarDateFields field, 01125 UErrorCode* status ); 01126 01142 U_STABLE void U_EXPORT2 01143 ucal_set(UCalendar* cal, 01144 UCalendarDateFields field, 01145 int32_t value); 01146 01162 U_STABLE UBool U_EXPORT2 01163 ucal_isSet(const UCalendar* cal, 01164 UCalendarDateFields field); 01165 01180 U_STABLE void U_EXPORT2 01181 ucal_clearField(UCalendar* cal, 01182 UCalendarDateFields field); 01183 01194 U_STABLE void U_EXPORT2 01195 ucal_clear(UCalendar* calendar); 01196 01201 enum UCalendarLimitType { 01203 UCAL_MINIMUM, 01205 UCAL_MAXIMUM, 01207 UCAL_GREATEST_MINIMUM, 01209 UCAL_LEAST_MAXIMUM, 01211 UCAL_ACTUAL_MINIMUM, 01213 UCAL_ACTUAL_MAXIMUM 01214 }; 01215 01217 typedef enum UCalendarLimitType UCalendarLimitType; 01218 01233 U_STABLE int32_t U_EXPORT2 01234 ucal_getLimit(const UCalendar* cal, 01235 UCalendarDateFields field, 01236 UCalendarLimitType type, 01237 UErrorCode* status); 01238 01246 U_STABLE const char * U_EXPORT2 01247 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status); 01248 01255 U_STABLE const char * U_EXPORT2 01256 ucal_getTZDataVersion(UErrorCode* status); 01257 01276 U_STABLE int32_t U_EXPORT2 01277 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len, 01278 UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status); 01286 U_STABLE const char * U_EXPORT2 01287 ucal_getType(const UCalendar *cal, UErrorCode* status); 01288 01305 U_STABLE UEnumeration* U_EXPORT2 01306 ucal_getKeywordValuesForLocale(const char* key, 01307 const char* locale, 01308 UBool commonlyUsed, 01309 UErrorCode* status); 01310 01311 01315 enum UCalendarWeekdayType { 01320 UCAL_WEEKDAY, 01325 UCAL_WEEKEND, 01331 UCAL_WEEKEND_ONSET, 01337 UCAL_WEEKEND_CEASE 01338 }; 01339 01341 typedef enum UCalendarWeekdayType UCalendarWeekdayType; 01342 01359 U_STABLE UCalendarWeekdayType U_EXPORT2 01360 ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status); 01361 01377 U_STABLE int32_t U_EXPORT2 01378 ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status); 01379 01390 U_STABLE UBool U_EXPORT2 01391 ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status); 01392 01417 U_DRAFT int32_t U_EXPORT2 01418 ucal_getFieldDifference(UCalendar* cal, 01419 UDate target, 01420 UCalendarDateFields field, 01421 UErrorCode* status); 01422 01423 #endif /* #if !UCONFIG_NO_FORMATTING */ 01424 01425 #endif