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
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
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
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
01082 U_STABLE void U_EXPORT2
01083 ucal_add(UCalendar* cal,
01084 UCalendarDateFields field,
01085 int32_t amount,
01086 UErrorCode* status);
01087
01112 U_STABLE void U_EXPORT2
01113 ucal_roll(UCalendar* cal,
01114 UCalendarDateFields field,
01115 int32_t amount,
01116 UErrorCode* status);
01117
01134 U_STABLE int32_t U_EXPORT2
01135 ucal_get(const UCalendar* cal,
01136 UCalendarDateFields field,
01137 UErrorCode* status );
01138
01154 U_STABLE void U_EXPORT2
01155 ucal_set(UCalendar* cal,
01156 UCalendarDateFields field,
01157 int32_t value);
01158
01174 U_STABLE UBool U_EXPORT2
01175 ucal_isSet(const UCalendar* cal,
01176 UCalendarDateFields field);
01177
01192 U_STABLE void U_EXPORT2
01193 ucal_clearField(UCalendar* cal,
01194 UCalendarDateFields field);
01195
01206 U_STABLE void U_EXPORT2
01207 ucal_clear(UCalendar* calendar);
01208
01213 enum UCalendarLimitType {
01215 UCAL_MINIMUM,
01217 UCAL_MAXIMUM,
01219 UCAL_GREATEST_MINIMUM,
01221 UCAL_LEAST_MAXIMUM,
01223 UCAL_ACTUAL_MINIMUM,
01225 UCAL_ACTUAL_MAXIMUM
01226 };
01227
01229 typedef enum UCalendarLimitType UCalendarLimitType;
01230
01245 U_STABLE int32_t U_EXPORT2
01246 ucal_getLimit(const UCalendar* cal,
01247 UCalendarDateFields field,
01248 UCalendarLimitType type,
01249 UErrorCode* status);
01250
01258 U_STABLE const char * U_EXPORT2
01259 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
01260
01267 U_STABLE const char * U_EXPORT2
01268 ucal_getTZDataVersion(UErrorCode* status);
01269
01288 U_STABLE int32_t U_EXPORT2
01289 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len,
01290 UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status);
01298 U_STABLE const char * U_EXPORT2
01299 ucal_getType(const UCalendar *cal, UErrorCode* status);
01300
01317 U_STABLE UEnumeration* U_EXPORT2
01318 ucal_getKeywordValuesForLocale(const char* key,
01319 const char* locale,
01320 UBool commonlyUsed,
01321 UErrorCode* status);
01322
01323
01327 enum UCalendarWeekdayType {
01332 UCAL_WEEKDAY,
01337 UCAL_WEEKEND,
01343 UCAL_WEEKEND_ONSET,
01349 UCAL_WEEKEND_CEASE
01350 };
01351
01353 typedef enum UCalendarWeekdayType UCalendarWeekdayType;
01354
01371 U_STABLE UCalendarWeekdayType U_EXPORT2
01372 ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status);
01373
01389 U_STABLE int32_t U_EXPORT2
01390 ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status);
01391
01402 U_STABLE UBool U_EXPORT2
01403 ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status);
01404
01429 U_STABLE int32_t U_EXPORT2
01430 ucal_getFieldDifference(UCalendar* cal,
01431 UDate target,
01432 UCalendarDateFields field,
01433 UErrorCode* status);
01434
01435 #ifndef U_HIDE_DRAFT_API
01436
01440 enum UTimeZoneTransitionType {
01446 UCAL_TZ_TRANSITION_NEXT,
01452 UCAL_TZ_TRANSITION_NEXT_INCLUSIVE,
01458 UCAL_TZ_TRANSITION_PREVIOUS,
01464 UCAL_TZ_TRANSITION_PREVIOUS_INCLUSIVE
01465 };
01466
01468 typedef enum UTimeZoneTransitionType UTimeZoneTransitionType;
01469
01485 U_DRAFT UBool U_EXPORT2
01486 ucal_getTimeZoneTransitionDate(const UCalendar* cal, UTimeZoneTransitionType type,
01487 UDate* transition, UErrorCode* status);
01488
01489 #endif
01490
01491 #endif
01492
01493 #endif