ICU 4.8 4.8
|
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 00685 U_STABLE UCalendar* U_EXPORT2 00686 ucal_open(const UChar* zoneID, 00687 int32_t len, 00688 const char* locale, 00689 UCalendarType type, 00690 UErrorCode* status); 00691 00698 U_STABLE void U_EXPORT2 00699 ucal_close(UCalendar *cal); 00700 00701 #if U_SHOW_CPLUSPLUS_API 00702 00703 U_NAMESPACE_BEGIN 00704 00714 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCalendarPointer, UCalendar, ucal_close); 00715 00716 U_NAMESPACE_END 00717 00718 #endif 00719 00728 U_STABLE UCalendar* U_EXPORT2 00729 ucal_clone(const UCalendar* cal, 00730 UErrorCode* status); 00731 00741 U_STABLE void U_EXPORT2 00742 ucal_setTimeZone(UCalendar* cal, 00743 const UChar* zoneID, 00744 int32_t len, 00745 UErrorCode* status); 00746 00751 enum UCalendarDisplayNameType { 00753 UCAL_STANDARD, 00755 UCAL_SHORT_STANDARD, 00757 UCAL_DST, 00759 UCAL_SHORT_DST 00760 }; 00761 00763 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType; 00764 00778 U_STABLE int32_t U_EXPORT2 00779 ucal_getTimeZoneDisplayName(const UCalendar* cal, 00780 UCalendarDisplayNameType type, 00781 const char* locale, 00782 UChar* result, 00783 int32_t resultLength, 00784 UErrorCode* status); 00785 00794 U_STABLE UBool U_EXPORT2 00795 ucal_inDaylightTime(const UCalendar* cal, 00796 UErrorCode* status ); 00797 00818 U_STABLE void U_EXPORT2 00819 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode); 00820 00841 U_STABLE UDate U_EXPORT2 00842 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode); 00843 00848 enum UCalendarAttribute { 00850 UCAL_LENIENT, 00852 UCAL_FIRST_DAY_OF_WEEK, 00854 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK 00855 }; 00856 00858 typedef enum UCalendarAttribute UCalendarAttribute; 00859 00871 U_STABLE int32_t U_EXPORT2 00872 ucal_getAttribute(const UCalendar* cal, 00873 UCalendarAttribute attr); 00874 00886 U_STABLE void U_EXPORT2 00887 ucal_setAttribute(UCalendar* cal, 00888 UCalendarAttribute attr, 00889 int32_t newValue); 00890 00900 U_STABLE const char* U_EXPORT2 00901 ucal_getAvailable(int32_t localeIndex); 00902 00911 U_STABLE int32_t U_EXPORT2 00912 ucal_countAvailable(void); 00913 00925 U_STABLE UDate U_EXPORT2 00926 ucal_getMillis(const UCalendar* cal, 00927 UErrorCode* status); 00928 00940 U_STABLE void U_EXPORT2 00941 ucal_setMillis(UCalendar* cal, 00942 UDate dateTime, 00943 UErrorCode* status ); 00944 00959 U_STABLE void U_EXPORT2 00960 ucal_setDate(UCalendar* cal, 00961 int32_t year, 00962 int32_t month, 00963 int32_t date, 00964 UErrorCode* status); 00965 00983 U_STABLE void U_EXPORT2 00984 ucal_setDateTime(UCalendar* cal, 00985 int32_t year, 00986 int32_t month, 00987 int32_t date, 00988 int32_t hour, 00989 int32_t minute, 00990 int32_t second, 00991 UErrorCode* status); 00992 01002 U_STABLE UBool U_EXPORT2 01003 ucal_equivalentTo(const UCalendar* cal1, 01004 const UCalendar* cal2); 01005 01021 U_STABLE void U_EXPORT2 01022 ucal_add(UCalendar* cal, 01023 UCalendarDateFields field, 01024 int32_t amount, 01025 UErrorCode* status); 01026 01042 U_STABLE void U_EXPORT2 01043 ucal_roll(UCalendar* cal, 01044 UCalendarDateFields field, 01045 int32_t amount, 01046 UErrorCode* status); 01047 01064 U_STABLE int32_t U_EXPORT2 01065 ucal_get(const UCalendar* cal, 01066 UCalendarDateFields field, 01067 UErrorCode* status ); 01068 01084 U_STABLE void U_EXPORT2 01085 ucal_set(UCalendar* cal, 01086 UCalendarDateFields field, 01087 int32_t value); 01088 01104 U_STABLE UBool U_EXPORT2 01105 ucal_isSet(const UCalendar* cal, 01106 UCalendarDateFields field); 01107 01122 U_STABLE void U_EXPORT2 01123 ucal_clearField(UCalendar* cal, 01124 UCalendarDateFields field); 01125 01136 U_STABLE void U_EXPORT2 01137 ucal_clear(UCalendar* calendar); 01138 01143 enum UCalendarLimitType { 01145 UCAL_MINIMUM, 01147 UCAL_MAXIMUM, 01149 UCAL_GREATEST_MINIMUM, 01151 UCAL_LEAST_MAXIMUM, 01153 UCAL_ACTUAL_MINIMUM, 01155 UCAL_ACTUAL_MAXIMUM 01156 }; 01157 01159 typedef enum UCalendarLimitType UCalendarLimitType; 01160 01175 U_STABLE int32_t U_EXPORT2 01176 ucal_getLimit(const UCalendar* cal, 01177 UCalendarDateFields field, 01178 UCalendarLimitType type, 01179 UErrorCode* status); 01180 01188 U_STABLE const char * U_EXPORT2 01189 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status); 01190 01197 U_STABLE const char * U_EXPORT2 01198 ucal_getTZDataVersion(UErrorCode* status); 01199 01218 U_STABLE int32_t U_EXPORT2 01219 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len, 01220 UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status); 01228 U_STABLE const char * U_EXPORT2 01229 ucal_getType(const UCalendar *cal, UErrorCode* status); 01230 01247 U_STABLE UEnumeration* U_EXPORT2 01248 ucal_getKeywordValuesForLocale(const char* key, 01249 const char* locale, 01250 UBool commonlyUsed, 01251 UErrorCode* status); 01252 01253 01257 enum UCalendarWeekdayType { 01262 UCAL_WEEKDAY, 01267 UCAL_WEEKEND, 01273 UCAL_WEEKEND_ONSET, 01279 UCAL_WEEKEND_CEASE 01280 }; 01281 01283 typedef enum UCalendarWeekdayType UCalendarWeekdayType; 01284 01301 U_STABLE UCalendarWeekdayType U_EXPORT2 01302 ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status); 01303 01319 U_STABLE int32_t U_EXPORT2 01320 ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status); 01321 01332 U_STABLE UBool U_EXPORT2 01333 ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status); 01334 01359 U_DRAFT int32_t U_EXPORT2 01360 ucal_getFieldDifference(UCalendar* cal, 01361 UDate target, 01362 UCalendarDateFields field, 01363 UErrorCode* status); 01364 01365 01366 #endif /* #if !UCONFIG_NO_FORMATTING */ 01367 01368 #endif