|
ICU 73.2
73.2
|
00001 // © 2016 and later: Unicode, Inc. and others. 00002 // License & terms of use: http://www.unicode.org/copyright.html 00003 /* 00004 ******************************************************************************* 00005 * Copyright (C) 1996-2015, International Business Machines Corporation and 00006 * others. All Rights Reserved. 00007 ******************************************************************************* 00008 */ 00009 00010 #ifndef UCAL_H 00011 #define UCAL_H 00012 00013 #include "unicode/utypes.h" 00014 #include "unicode/uenum.h" 00015 #include "unicode/uloc.h" 00016 00017 #if U_SHOW_CPLUSPLUS_API 00018 #include "unicode/localpointer.h" 00019 #endif // U_SHOW_CPLUSPLUS_API 00020 00021 #if !UCONFIG_NO_FORMATTING 00022 00166 #define UCAL_UNKNOWN_ZONE_ID "Etc/Unknown" 00167 00172 typedef void* UCalendar; 00173 00177 enum UCalendarType { 00183 UCAL_TRADITIONAL, 00188 UCAL_DEFAULT = UCAL_TRADITIONAL, 00193 UCAL_GREGORIAN 00194 }; 00195 00197 typedef enum UCalendarType UCalendarType; 00198 00202 enum UCalendarDateFields { 00208 UCAL_ERA, 00209 00214 UCAL_YEAR, 00215 00235 UCAL_MONTH, 00236 00248 UCAL_WEEK_OF_YEAR, 00249 00263 UCAL_WEEK_OF_MONTH, 00264 00272 UCAL_DATE, 00273 00279 UCAL_DAY_OF_YEAR, 00280 00295 UCAL_DAY_OF_WEEK, 00296 00320 UCAL_DAY_OF_WEEK_IN_MONTH, 00321 00331 UCAL_AM_PM, 00332 00342 UCAL_HOUR, 00343 00351 UCAL_HOUR_OF_DAY, 00352 00359 UCAL_MINUTE, 00360 00367 UCAL_SECOND, 00368 00375 UCAL_MILLISECOND, 00376 00382 UCAL_ZONE_OFFSET, 00383 00389 UCAL_DST_OFFSET, 00390 00398 UCAL_YEAR_WOY, 00399 00406 UCAL_DOW_LOCAL, 00407 00414 UCAL_EXTENDED_YEAR, 00415 00426 UCAL_JULIAN_DAY, 00427 00437 UCAL_MILLISECONDS_IN_DAY, 00438 00443 UCAL_IS_LEAP_MONTH, 00444 00445 #ifndef U_HIDE_DRAFT_API 00446 00469 UCAL_ORDINAL_MONTH, 00470 #endif // U_HIDE_DRAFT_API 00471 00472 /* Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API, 00473 * it is needed for layout of Calendar, DateFormat, and other objects */ 00474 #ifndef U_FORCE_HIDE_DEPRECATED_API 00475 00479 #ifdef U_HIDE_DRAFT_API 00480 // Must include all fields that will be in structs 00481 UCAL_FIELD_COUNT = UCAL_IS_LEAP_MONTH + 2, 00482 #else // U_HIDE_DRAFT_API (for UCAL_ORDINAL_MONTH) 00483 UCAL_FIELD_COUNT = UCAL_ORDINAL_MONTH + 1, 00484 #endif // U_HIDE_DRAFT_API (for UCAL_ORDINAL_MONTH) 00485 00486 #endif // U_FORCE_HIDE_DEPRECATED_API 00487 00496 UCAL_DAY_OF_MONTH=UCAL_DATE 00497 }; 00498 00500 typedef enum UCalendarDateFields UCalendarDateFields; 00509 enum UCalendarDaysOfWeek { 00511 UCAL_SUNDAY = 1, 00513 UCAL_MONDAY, 00515 UCAL_TUESDAY, 00517 UCAL_WEDNESDAY, 00519 UCAL_THURSDAY, 00521 UCAL_FRIDAY, 00523 UCAL_SATURDAY 00524 }; 00525 00527 typedef enum UCalendarDaysOfWeek UCalendarDaysOfWeek; 00528 00532 enum UCalendarMonths { 00534 UCAL_JANUARY, 00536 UCAL_FEBRUARY, 00538 UCAL_MARCH, 00540 UCAL_APRIL, 00542 UCAL_MAY, 00544 UCAL_JUNE, 00546 UCAL_JULY, 00548 UCAL_AUGUST, 00550 UCAL_SEPTEMBER, 00552 UCAL_OCTOBER, 00554 UCAL_NOVEMBER, 00556 UCAL_DECEMBER, 00561 UCAL_UNDECIMBER 00562 }; 00563 00565 typedef enum UCalendarMonths UCalendarMonths; 00566 00570 enum UCalendarAMPMs { 00572 UCAL_AM, 00574 UCAL_PM 00575 }; 00576 00578 typedef enum UCalendarAMPMs UCalendarAMPMs; 00579 00586 enum USystemTimeZoneType { 00591 UCAL_ZONE_TYPE_ANY, 00596 UCAL_ZONE_TYPE_CANONICAL, 00601 UCAL_ZONE_TYPE_CANONICAL_LOCATION 00602 }; 00603 00605 typedef enum USystemTimeZoneType USystemTimeZoneType; 00606 00623 U_CAPI UEnumeration* U_EXPORT2 00624 ucal_openTimeZoneIDEnumeration(USystemTimeZoneType zoneType, const char* region, 00625 const int32_t* rawOffset, UErrorCode* ec); 00626 00638 U_CAPI UEnumeration* U_EXPORT2 00639 ucal_openTimeZones(UErrorCode* ec); 00640 00657 U_CAPI UEnumeration* U_EXPORT2 00658 ucal_openCountryTimeZones(const char* country, UErrorCode* ec); 00659 00683 U_CAPI int32_t U_EXPORT2 00684 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec); 00685 00695 U_CAPI void U_EXPORT2 00696 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec); 00697 00727 U_CAPI int32_t U_EXPORT2 00728 ucal_getHostTimeZone(UChar *result, int32_t resultCapacity, UErrorCode *ec); 00729 00746 U_CAPI int32_t U_EXPORT2 00747 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec); 00748 00755 U_CAPI UDate U_EXPORT2 00756 ucal_getNow(void); 00757 00781 U_CAPI UCalendar* U_EXPORT2 00782 ucal_open(const UChar* zoneID, 00783 int32_t len, 00784 const char* locale, 00785 UCalendarType type, 00786 UErrorCode* status); 00787 00794 U_CAPI void U_EXPORT2 00795 ucal_close(UCalendar *cal); 00796 00797 #if U_SHOW_CPLUSPLUS_API 00798 00799 U_NAMESPACE_BEGIN 00800 00810 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCalendarPointer, UCalendar, ucal_close); 00811 00812 U_NAMESPACE_END 00813 00814 #endif 00815 00824 U_CAPI UCalendar* U_EXPORT2 00825 ucal_clone(const UCalendar* cal, 00826 UErrorCode* status); 00827 00837 U_CAPI void U_EXPORT2 00838 ucal_setTimeZone(UCalendar* cal, 00839 const UChar* zoneID, 00840 int32_t len, 00841 UErrorCode* status); 00842 00853 U_CAPI int32_t U_EXPORT2 00854 ucal_getTimeZoneID(const UCalendar *cal, 00855 UChar *result, 00856 int32_t resultLength, 00857 UErrorCode *status); 00858 00863 enum UCalendarDisplayNameType { 00865 UCAL_STANDARD, 00867 UCAL_SHORT_STANDARD, 00869 UCAL_DST, 00871 UCAL_SHORT_DST 00872 }; 00873 00875 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType; 00876 00890 U_CAPI int32_t U_EXPORT2 00891 ucal_getTimeZoneDisplayName(const UCalendar* cal, 00892 UCalendarDisplayNameType type, 00893 const char* locale, 00894 UChar* result, 00895 int32_t resultLength, 00896 UErrorCode* status); 00897 00906 U_CAPI UBool U_EXPORT2 00907 ucal_inDaylightTime(const UCalendar* cal, 00908 UErrorCode* status ); 00909 00930 U_CAPI void U_EXPORT2 00931 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode); 00932 00953 U_CAPI UDate U_EXPORT2 00954 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode); 00955 00960 enum UCalendarAttribute { 00965 UCAL_LENIENT, 00970 UCAL_FIRST_DAY_OF_WEEK, 00975 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK, 00981 UCAL_REPEATED_WALL_TIME, 00987 UCAL_SKIPPED_WALL_TIME 00988 }; 00989 00991 typedef enum UCalendarAttribute UCalendarAttribute; 00992 00998 enum UCalendarWallTimeOption { 01005 UCAL_WALLTIME_LAST, 01012 UCAL_WALLTIME_FIRST, 01018 UCAL_WALLTIME_NEXT_VALID 01019 }; 01021 typedef enum UCalendarWallTimeOption UCalendarWallTimeOption; 01022 01034 U_CAPI int32_t U_EXPORT2 01035 ucal_getAttribute(const UCalendar* cal, 01036 UCalendarAttribute attr); 01037 01049 U_CAPI void U_EXPORT2 01050 ucal_setAttribute(UCalendar* cal, 01051 UCalendarAttribute attr, 01052 int32_t newValue); 01053 01063 U_CAPI const char* U_EXPORT2 01064 ucal_getAvailable(int32_t localeIndex); 01065 01074 U_CAPI int32_t U_EXPORT2 01075 ucal_countAvailable(void); 01076 01088 U_CAPI UDate U_EXPORT2 01089 ucal_getMillis(const UCalendar* cal, 01090 UErrorCode* status); 01091 01103 U_CAPI void U_EXPORT2 01104 ucal_setMillis(UCalendar* cal, 01105 UDate dateTime, 01106 UErrorCode* status ); 01107 01122 U_CAPI void U_EXPORT2 01123 ucal_setDate(UCalendar* cal, 01124 int32_t year, 01125 int32_t month, 01126 int32_t date, 01127 UErrorCode* status); 01128 01146 U_CAPI void U_EXPORT2 01147 ucal_setDateTime(UCalendar* cal, 01148 int32_t year, 01149 int32_t month, 01150 int32_t date, 01151 int32_t hour, 01152 int32_t minute, 01153 int32_t second, 01154 UErrorCode* status); 01155 01165 U_CAPI UBool U_EXPORT2 01166 ucal_equivalentTo(const UCalendar* cal1, 01167 const UCalendar* cal2); 01168 01187 U_CAPI void U_EXPORT2 01188 ucal_add(UCalendar* cal, 01189 UCalendarDateFields field, 01190 int32_t amount, 01191 UErrorCode* status); 01192 01217 U_CAPI void U_EXPORT2 01218 ucal_roll(UCalendar* cal, 01219 UCalendarDateFields field, 01220 int32_t amount, 01221 UErrorCode* status); 01222 01239 U_CAPI int32_t U_EXPORT2 01240 ucal_get(const UCalendar* cal, 01241 UCalendarDateFields field, 01242 UErrorCode* status ); 01243 01259 U_CAPI void U_EXPORT2 01260 ucal_set(UCalendar* cal, 01261 UCalendarDateFields field, 01262 int32_t value); 01263 01279 U_CAPI UBool U_EXPORT2 01280 ucal_isSet(const UCalendar* cal, 01281 UCalendarDateFields field); 01282 01297 U_CAPI void U_EXPORT2 01298 ucal_clearField(UCalendar* cal, 01299 UCalendarDateFields field); 01300 01311 U_CAPI void U_EXPORT2 01312 ucal_clear(UCalendar* calendar); 01313 01318 enum UCalendarLimitType { 01320 UCAL_MINIMUM, 01322 UCAL_MAXIMUM, 01324 UCAL_GREATEST_MINIMUM, 01326 UCAL_LEAST_MAXIMUM, 01328 UCAL_ACTUAL_MINIMUM, 01330 UCAL_ACTUAL_MAXIMUM 01331 }; 01332 01334 typedef enum UCalendarLimitType UCalendarLimitType; 01335 01350 U_CAPI int32_t U_EXPORT2 01351 ucal_getLimit(const UCalendar* cal, 01352 UCalendarDateFields field, 01353 UCalendarLimitType type, 01354 UErrorCode* status); 01355 01363 U_CAPI const char * U_EXPORT2 01364 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status); 01365 01372 U_CAPI const char * U_EXPORT2 01373 ucal_getTZDataVersion(UErrorCode* status); 01374 01393 U_CAPI int32_t U_EXPORT2 01394 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len, 01395 UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status); 01403 U_CAPI const char * U_EXPORT2 01404 ucal_getType(const UCalendar *cal, UErrorCode* status); 01405 01422 U_CAPI UEnumeration* U_EXPORT2 01423 ucal_getKeywordValuesForLocale(const char* key, 01424 const char* locale, 01425 UBool commonlyUsed, 01426 UErrorCode* status); 01427 01428 01432 enum UCalendarWeekdayType { 01437 UCAL_WEEKDAY, 01442 UCAL_WEEKEND, 01448 UCAL_WEEKEND_ONSET, 01454 UCAL_WEEKEND_CEASE 01455 }; 01456 01458 typedef enum UCalendarWeekdayType UCalendarWeekdayType; 01459 01477 U_CAPI UCalendarWeekdayType U_EXPORT2 01478 ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status); 01479 01495 U_CAPI int32_t U_EXPORT2 01496 ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status); 01497 01508 U_CAPI UBool U_EXPORT2 01509 ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status); 01510 01535 U_CAPI int32_t U_EXPORT2 01536 ucal_getFieldDifference(UCalendar* cal, 01537 UDate target, 01538 UCalendarDateFields field, 01539 UErrorCode* status); 01540 01545 enum UTimeZoneTransitionType { 01551 UCAL_TZ_TRANSITION_NEXT, 01557 UCAL_TZ_TRANSITION_NEXT_INCLUSIVE, 01563 UCAL_TZ_TRANSITION_PREVIOUS, 01569 UCAL_TZ_TRANSITION_PREVIOUS_INCLUSIVE 01570 }; 01571 01572 typedef enum UTimeZoneTransitionType UTimeZoneTransitionType; 01589 U_CAPI UBool U_EXPORT2 01590 ucal_getTimeZoneTransitionDate(const UCalendar* cal, UTimeZoneTransitionType type, 01591 UDate* transition, UErrorCode* status); 01592 01617 U_CAPI int32_t U_EXPORT2 01618 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len, 01619 UChar* winid, int32_t winidCapacity, UErrorCode* status); 01620 01649 U_CAPI int32_t U_EXPORT2 01650 ucal_getTimeZoneIDForWindowsID(const UChar* winid, int32_t len, const char* region, 01651 UChar* id, int32_t idCapacity, UErrorCode* status); 01652 01659 enum UTimeZoneLocalOption { 01665 UCAL_TZ_LOCAL_FORMER = 0x04, 01671 UCAL_TZ_LOCAL_LATTER = 0x0C, 01680 UCAL_TZ_LOCAL_STANDARD_FORMER = UCAL_TZ_LOCAL_FORMER | 0x01, 01689 UCAL_TZ_LOCAL_STANDARD_LATTER = UCAL_TZ_LOCAL_LATTER | 0x01, 01698 UCAL_TZ_LOCAL_DAYLIGHT_FORMER = UCAL_TZ_LOCAL_FORMER | 0x03, 01707 UCAL_TZ_LOCAL_DAYLIGHT_LATTER = UCAL_TZ_LOCAL_LATTER | 0x03, 01708 }; 01709 typedef enum UTimeZoneLocalOption UTimeZoneLocalOption; 01738 U_CAPI void U_EXPORT2 01739 ucal_getTimeZoneOffsetFromLocal( 01740 const UCalendar* cal, 01741 UTimeZoneLocalOption nonExistingTimeOpt, 01742 UTimeZoneLocalOption duplicatedTimeOpt, 01743 int32_t* rawOffset, int32_t* dstOffset, UErrorCode* status); 01744 01745 #endif /* #if !UCONFIG_NO_FORMATTING */ 01746 01747 #endif
1.7.6.1