00001
00002
00003
00004
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_STABLE 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
00758 U_STABLE int32_t U_EXPORT2
00759 ucal_getTimeZoneID(const UCalendar *cal,
00760 UChar *result,
00761 int32_t resultLength,
00762 UErrorCode *status);
00763
00768 enum UCalendarDisplayNameType {
00770 UCAL_STANDARD,
00772 UCAL_SHORT_STANDARD,
00774 UCAL_DST,
00776 UCAL_SHORT_DST
00777 };
00778
00780 typedef enum UCalendarDisplayNameType UCalendarDisplayNameType;
00781
00795 U_STABLE int32_t U_EXPORT2
00796 ucal_getTimeZoneDisplayName(const UCalendar* cal,
00797 UCalendarDisplayNameType type,
00798 const char* locale,
00799 UChar* result,
00800 int32_t resultLength,
00801 UErrorCode* status);
00802
00811 U_STABLE UBool U_EXPORT2
00812 ucal_inDaylightTime(const UCalendar* cal,
00813 UErrorCode* status );
00814
00835 U_STABLE void U_EXPORT2
00836 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode);
00837
00858 U_STABLE UDate U_EXPORT2
00859 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode);
00860
00865 enum UCalendarAttribute {
00870 UCAL_LENIENT,
00875 UCAL_FIRST_DAY_OF_WEEK,
00880 UCAL_MINIMAL_DAYS_IN_FIRST_WEEK,
00886 UCAL_REPEATED_WALL_TIME,
00892 UCAL_SKIPPED_WALL_TIME
00893 };
00894
00896 typedef enum UCalendarAttribute UCalendarAttribute;
00897
00903 enum UCalendarWallTimeOption {
00910 UCAL_WALLTIME_LAST,
00917 UCAL_WALLTIME_FIRST,
00923 UCAL_WALLTIME_NEXT_VALID
00924 };
00926 typedef enum UCalendarWallTimeOption UCalendarWallTimeOption;
00927
00939 U_STABLE int32_t U_EXPORT2
00940 ucal_getAttribute(const UCalendar* cal,
00941 UCalendarAttribute attr);
00942
00954 U_STABLE void U_EXPORT2
00955 ucal_setAttribute(UCalendar* cal,
00956 UCalendarAttribute attr,
00957 int32_t newValue);
00958
00968 U_STABLE const char* U_EXPORT2
00969 ucal_getAvailable(int32_t localeIndex);
00970
00979 U_STABLE int32_t U_EXPORT2
00980 ucal_countAvailable(void);
00981
00993 U_STABLE UDate U_EXPORT2
00994 ucal_getMillis(const UCalendar* cal,
00995 UErrorCode* status);
00996
01008 U_STABLE void U_EXPORT2
01009 ucal_setMillis(UCalendar* cal,
01010 UDate dateTime,
01011 UErrorCode* status );
01012
01027 U_STABLE void U_EXPORT2
01028 ucal_setDate(UCalendar* cal,
01029 int32_t year,
01030 int32_t month,
01031 int32_t date,
01032 UErrorCode* status);
01033
01051 U_STABLE void U_EXPORT2
01052 ucal_setDateTime(UCalendar* cal,
01053 int32_t year,
01054 int32_t month,
01055 int32_t date,
01056 int32_t hour,
01057 int32_t minute,
01058 int32_t second,
01059 UErrorCode* status);
01060
01070 U_STABLE UBool U_EXPORT2
01071 ucal_equivalentTo(const UCalendar* cal1,
01072 const UCalendar* cal2);
01073
01092 U_STABLE void U_EXPORT2
01093 ucal_add(UCalendar* cal,
01094 UCalendarDateFields field,
01095 int32_t amount,
01096 UErrorCode* status);
01097
01122 U_STABLE void U_EXPORT2
01123 ucal_roll(UCalendar* cal,
01124 UCalendarDateFields field,
01125 int32_t amount,
01126 UErrorCode* status);
01127
01144 U_STABLE int32_t U_EXPORT2
01145 ucal_get(const UCalendar* cal,
01146 UCalendarDateFields field,
01147 UErrorCode* status );
01148
01164 U_STABLE void U_EXPORT2
01165 ucal_set(UCalendar* cal,
01166 UCalendarDateFields field,
01167 int32_t value);
01168
01184 U_STABLE UBool U_EXPORT2
01185 ucal_isSet(const UCalendar* cal,
01186 UCalendarDateFields field);
01187
01202 U_STABLE void U_EXPORT2
01203 ucal_clearField(UCalendar* cal,
01204 UCalendarDateFields field);
01205
01216 U_STABLE void U_EXPORT2
01217 ucal_clear(UCalendar* calendar);
01218
01223 enum UCalendarLimitType {
01225 UCAL_MINIMUM,
01227 UCAL_MAXIMUM,
01229 UCAL_GREATEST_MINIMUM,
01231 UCAL_LEAST_MAXIMUM,
01233 UCAL_ACTUAL_MINIMUM,
01235 UCAL_ACTUAL_MAXIMUM
01236 };
01237
01239 typedef enum UCalendarLimitType UCalendarLimitType;
01240
01255 U_STABLE int32_t U_EXPORT2
01256 ucal_getLimit(const UCalendar* cal,
01257 UCalendarDateFields field,
01258 UCalendarLimitType type,
01259 UErrorCode* status);
01260
01268 U_STABLE const char * U_EXPORT2
01269 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
01270
01277 U_STABLE const char * U_EXPORT2
01278 ucal_getTZDataVersion(UErrorCode* status);
01279
01298 U_STABLE int32_t U_EXPORT2
01299 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len,
01300 UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status);
01308 U_STABLE const char * U_EXPORT2
01309 ucal_getType(const UCalendar *cal, UErrorCode* status);
01310
01327 U_STABLE UEnumeration* U_EXPORT2
01328 ucal_getKeywordValuesForLocale(const char* key,
01329 const char* locale,
01330 UBool commonlyUsed,
01331 UErrorCode* status);
01332
01333
01337 enum UCalendarWeekdayType {
01342 UCAL_WEEKDAY,
01347 UCAL_WEEKEND,
01353 UCAL_WEEKEND_ONSET,
01359 UCAL_WEEKEND_CEASE
01360 };
01361
01363 typedef enum UCalendarWeekdayType UCalendarWeekdayType;
01364
01382 U_STABLE UCalendarWeekdayType U_EXPORT2
01383 ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status);
01384
01400 U_STABLE int32_t U_EXPORT2
01401 ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status);
01402
01413 U_STABLE UBool U_EXPORT2
01414 ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status);
01415
01440 U_STABLE int32_t U_EXPORT2
01441 ucal_getFieldDifference(UCalendar* cal,
01442 UDate target,
01443 UCalendarDateFields field,
01444 UErrorCode* status);
01445
01450 enum UTimeZoneTransitionType {
01456 UCAL_TZ_TRANSITION_NEXT,
01462 UCAL_TZ_TRANSITION_NEXT_INCLUSIVE,
01468 UCAL_TZ_TRANSITION_PREVIOUS,
01474 UCAL_TZ_TRANSITION_PREVIOUS_INCLUSIVE
01475 };
01476
01477 typedef enum UTimeZoneTransitionType UTimeZoneTransitionType;
01494 U_STABLE UBool U_EXPORT2
01495 ucal_getTimeZoneTransitionDate(const UCalendar* cal, UTimeZoneTransitionType type,
01496 UDate* transition, UErrorCode* status);
01497
01522 U_STABLE int32_t U_EXPORT2
01523 ucal_getWindowsTimeZoneID(const UChar* id, int32_t len,
01524 UChar* winid, int32_t winidCapacity, UErrorCode* status);
01525
01554 U_STABLE int32_t U_EXPORT2
01555 ucal_getTimeZoneIDForWindowsID(const UChar* winid, int32_t len, const char* region,
01556 UChar* id, int32_t idCapacity, UErrorCode* status);
01557
01558 #endif
01559
01560 #endif