ICU 4.8.1.1  4.8.1.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ucal.h
Go to the documentation of this file.
1 /*
2  *******************************************************************************
3  * Copyright (C) 1996-2011, International Business Machines Corporation and
4  * others. All Rights Reserved.
5  *******************************************************************************
6  */
7 
8 #ifndef UCAL_H
9 #define UCAL_H
10 
11 #include "unicode/utypes.h"
12 #include "unicode/uenum.h"
13 #include "unicode/uloc.h"
14 #include "unicode/localpointer.h"
15 
16 #if !UCONFIG_NO_FORMATTING
17 
147 #define UCAL_UNKNOWN_ZONE_ID "Etc/Unknown"
148 
153 typedef void* UCalendar;
154 
175 };
176 
179 
190 
196 
217 
230 
245 
254 
261 
277 
302 
313 
324 
333 
341 
349 
357 
364 
371 
380 
388 
396 
408 
419 
425 
431 
441 };
442 
468 };
469 
472 
506 };
507 
510 
519 };
520 
523 
546 };
547 
550 
568 ucal_openTimeZoneIDEnumeration(USystemTimeZoneType zoneType, const char* region,
569  const int32_t* rawOffset, UErrorCode* ec);
570 
584 
602 ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
603 
620 U_STABLE int32_t U_EXPORT2
621 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
622 
632 U_STABLE void U_EXPORT2
633 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
634 
651 U_STABLE int32_t U_EXPORT2
652 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
653 
661 ucal_getNow(void);
662 
687 ucal_open(const UChar* zoneID,
688  int32_t len,
689  const char* locale,
690  UCalendarType type,
691  UErrorCode* status);
692 
699 U_STABLE void U_EXPORT2
700 ucal_close(UCalendar *cal);
701 
702 #if U_SHOW_CPLUSPLUS_API
703 
705 
715 U_DEFINE_LOCAL_OPEN_POINTER(LocalUCalendarPointer, UCalendar, ucal_close);
716 
718 
719 #endif
720 
730 ucal_clone(const UCalendar* cal,
731  UErrorCode* status);
732 
742 U_STABLE void U_EXPORT2
744  const UChar* zoneID,
745  int32_t len,
746  UErrorCode* status);
747 
761 };
762 
765 
779 U_STABLE int32_t U_EXPORT2
782  const char* locale,
783  UChar* result,
784  int32_t resultLength,
785  UErrorCode* status);
786 
796 ucal_inDaylightTime(const UCalendar* cal,
797  UErrorCode* status );
798 
819 U_STABLE void U_EXPORT2
820 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode);
821 
843 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode);
844 
856 };
857 
860 
872 U_STABLE int32_t U_EXPORT2
873 ucal_getAttribute(const UCalendar* cal,
874  UCalendarAttribute attr);
875 
887 U_STABLE void U_EXPORT2
889  UCalendarAttribute attr,
890  int32_t newValue);
891 
901 U_STABLE const char* U_EXPORT2
902 ucal_getAvailable(int32_t localeIndex);
903 
912 U_STABLE int32_t U_EXPORT2
913 ucal_countAvailable(void);
914 
927 ucal_getMillis(const UCalendar* cal,
928  UErrorCode* status);
929 
941 U_STABLE void U_EXPORT2
943  UDate dateTime,
944  UErrorCode* status );
945 
960 U_STABLE void U_EXPORT2
962  int32_t year,
963  int32_t month,
964  int32_t date,
965  UErrorCode* status);
966 
984 U_STABLE void U_EXPORT2
986  int32_t year,
987  int32_t month,
988  int32_t date,
989  int32_t hour,
990  int32_t minute,
991  int32_t second,
992  UErrorCode* status);
993 
1004 ucal_equivalentTo(const UCalendar* cal1,
1005  const UCalendar* cal2);
1006 
1022 U_STABLE void U_EXPORT2
1023 ucal_add(UCalendar* cal,
1024  UCalendarDateFields field,
1025  int32_t amount,
1026  UErrorCode* status);
1027 
1043 U_STABLE void U_EXPORT2
1044 ucal_roll(UCalendar* cal,
1045  UCalendarDateFields field,
1046  int32_t amount,
1047  UErrorCode* status);
1048 
1065 U_STABLE int32_t U_EXPORT2
1066 ucal_get(const UCalendar* cal,
1067  UCalendarDateFields field,
1068  UErrorCode* status );
1069 
1085 U_STABLE void U_EXPORT2
1086 ucal_set(UCalendar* cal,
1087  UCalendarDateFields field,
1088  int32_t value);
1089 
1106 ucal_isSet(const UCalendar* cal,
1107  UCalendarDateFields field);
1108 
1123 U_STABLE void U_EXPORT2
1125  UCalendarDateFields field);
1126 
1137 U_STABLE void U_EXPORT2
1138 ucal_clear(UCalendar* calendar);
1139 
1157 };
1158 
1161 
1176 U_STABLE int32_t U_EXPORT2
1177 ucal_getLimit(const UCalendar* cal,
1178  UCalendarDateFields field,
1179  UCalendarLimitType type,
1180  UErrorCode* status);
1181 
1189 U_STABLE const char * U_EXPORT2
1190 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
1191 
1198 U_STABLE const char * U_EXPORT2
1200 
1219 U_STABLE int32_t U_EXPORT2
1220 ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len,
1221  UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status);
1229 U_STABLE const char * U_EXPORT2
1230 ucal_getType(const UCalendar *cal, UErrorCode* status);
1231 
1249 ucal_getKeywordValuesForLocale(const char* key,
1250  const char* locale,
1251  UBool commonlyUsed,
1252  UErrorCode* status);
1253 
1254 
1281 };
1282 
1285 
1303 ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status);
1304 
1320 U_STABLE int32_t U_EXPORT2
1321 ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status);
1322 
1334 ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status);
1335 
1360 U_DRAFT int32_t U_EXPORT2
1362  UDate target,
1363  UCalendarDateFields field,
1364  UErrorCode* status);
1365 
1366 
1367 #endif /* #if !UCONFIG_NO_FORMATTING */
1368 
1369 #endif
UCalendar * ucal_clone(const UCalendar *cal, UErrorCode *status)
Open a copy of a UCalendar.
A better name for UCAL_TRADITIONAL.
Definition: ucal.h:169
void * UCalendar
A calendar.
Definition: ucal.h:153
Field number indicating the day number within the current year.
Definition: ucal.h:260
August.
Definition: ucal.h:492
May.
Definition: ucal.h:486
Short standard display name.
Definition: ucal.h:756
UCalendarDateFields
Possible fields in a UCalendar.
Definition: ucal.h:183
void ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode)
Sets the GregorianCalendar change date.
Field number indicating the day of the month.
Definition: ucal.h:253
void ucal_clear(UCalendar *calendar)
Clear all fields in a UCalendar.
Ranges from 0 to 23:59:59.999 (regardless of DST).
Definition: ucal.h:418
Minimum number of days in first week.
Definition: ucal.h:855
int32_t ucal_countAvailable(void)
Determine how many locales have calendars available.
Lenient parsing.
Definition: ucal.h:851
AM.
Definition: ucal.h:516
Field number indicating the era, e.g., AD or BC in the Gregorian (Julian) calendar.
Definition: ucal.h:189
Designates a day that starts as the weekend and transitions to a weekday.
Definition: ucal.h:1280
UBool ucal_inDaylightTime(const UCalendar *cal, UErrorCode *status)
Determine if a UCalendar is currently in daylight savings time.
Designates a full weekday (no part of the day is included in the weekend).
Definition: ucal.h:1263
Value of the UCAL_MONTH field indicating the thirteenth month of the year.
Definition: ucal.h:505
int32_t ucal_get(const UCalendar *cal, UCalendarDateFields field, UErrorCode *status)
Get the current value of a field from a UCalendar.
int32_t ucal_getLimit(const UCalendar *cal, UCalendarDateFields field, UCalendarLimitType type, UErrorCode *status)
Determine a limit for a field in a UCalendar.
UBool ucal_isSet(const UCalendar *cal, UCalendarDateFields field)
Determine if a field in a UCalendar is set.
Maximum value.
Definition: ucal.h:1148
June.
Definition: ucal.h:488
Leaest maximum value.
Definition: ucal.h:1152
double UDate
Date and Time data type.
Definition: utypes.h:314
Field number indicating the week number within the current month.
Definition: ucal.h:244
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:39
Field number indicating the millisecond within the second.
Definition: ucal.h:356
Year of this calendar system, encompassing all supra-year fields.
Definition: ucal.h:395
Standard display name.
Definition: ucal.h:754
UBool ucal_isWeekend(const UCalendar *cal, UDate date, UErrorCode *status)
Returns TRUE if the given UDate is in the weekend in this calendar system.
Actual minimum value.
Definition: ucal.h:1154
Friday.
Definition: ucal.h:465
const char * ucal_getAvailable(int32_t localeIndex)
Get a locale for which calendars are available.
Minimum value.
Definition: ucal.h:1146
UCalendarWeekdayType ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status)
Returns whether the given day of the week is a weekday, a weekend day, or a day that transitions from...
UBool ucal_equivalentTo(const UCalendar *cal1, const UCalendar *cal2)
Returns TRUE if two UCalendars are equivalent.
Wednesday.
Definition: ucal.h:461
Tuesday.
Definition: ucal.h:459
UCalendarWeekdayType
Weekday types, as returned by ucal_getDayOfWeekType().
Definition: ucal.h:1258
Saturday.
Definition: ucal.h:467
March.
Definition: ucal.h:482
Field number indicating the extended year corresponding to the UCAL_WEEK_OF_YEAR field.
Definition: ucal.h:379
Field number indicating the day of the month.
Definition: ucal.h:440
UCalendarAttribute
Types of UCalendar attributes.
Definition: ucal.h:849
Sunday.
Definition: ucal.h:455
Field number indicating whether the HOUR is before or after noon.
Definition: ucal.h:312
Field number indicating the ordinal number of the day of the week within the current month...
Definition: ucal.h:301
First day of week.
Definition: ucal.h:853
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
February.
Definition: ucal.h:480
int32_t ucal_getFieldDifference(UCalendar *cal, UDate target, UCalendarDateFields field, UErrorCode *status)
Return the difference between the target time and the time this calendar object is currently set to...
October.
Definition: ucal.h:496
Short daylight savings display name.
Definition: ucal.h:760
int32_t ucal_getDSTSavings(const UChar *zoneID, UErrorCode *ec)
Return the amount of time in milliseconds that the clock is advanced during daylight savings time for...
Greatest minimum value.
Definition: ucal.h:1150
UCalendarDaysOfWeek
Useful constant for days of week.
Definition: ucal.h:453
November.
Definition: ucal.h:498
const char * ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode *status)
Get the locale for this calendar object.
Daylight savings display name.
Definition: ucal.h:758
Despite the name, UCAL_TRADITIONAL designates the locale's default calendar, which may be the Gregori...
Definition: ucal.h:164
UEnumeration * ucal_getKeywordValuesForLocale(const char *key, const char *locale, UBool commonlyUsed, UErrorCode *status)
Given a key and a locale, returns an array of string values in a preferred order that would make a di...
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
July.
Definition: ucal.h:490
UEnumeration * ucal_openTimeZones(UErrorCode *ec)
Create an enumeration over all time zones.
Canonical system zones associated with actual locations.
Definition: ucal.h:545
Monday.
Definition: ucal.h:457
Field number indicating the hour of the morning or afternoon.
Definition: ucal.h:323
Field number indicating the minute within the hour.
Definition: ucal.h:340
UEnumeration * ucal_openCountryTimeZones(const char *country, UErrorCode *ec)
Create an enumeration over all time zones associated with the given country.
UCalendar * ucal_open(const UChar *zoneID, int32_t len, const char *locale, UCalendarType type, UErrorCode *status)
Open a UCalendar.
int32_t ucal_getAttribute(const UCalendar *cal, UCalendarAttribute attr)
Get a numeric attribute associated with a UCalendar.
April.
Definition: ucal.h:484
void ucal_setAttribute(UCalendar *cal, UCalendarAttribute attr, int32_t newValue)
Set a numeric attribute associated with a UCalendar.
#define U_EXPORT2
Definition: platform.h:314
Any system zones.
Definition: ucal.h:535
Field number indicating the day of the week.
Definition: ucal.h:276
void ucal_set(UCalendar *cal, UCalendarDateFields field, int32_t value)
Set the value of a field in a UCalendar.
Whether or not the current month is a leap month (0 or 1).
Definition: ucal.h:424
Field number indicating the year.
Definition: ucal.h:195
void ucal_close(UCalendar *cal)
Close a UCalendar.
const char * ucal_getTZDataVersion(UErrorCode *status)
Returns the timezone data version currently used by ICU.
void ucal_setMillis(UCalendar *cal, UDate dateTime, UErrorCode *status)
Set a UCalendar's current time in millis.
int32_t ucal_getWeekendTransition(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode *status)
Returns the time during the day at which the weekend begins or ends in this calendar system...
Actual maximum value.
Definition: ucal.h:1156
uint16_t UChar
Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
Definition: umachine.h:325
UCalendarType
Possible types of UCalendars.
Definition: ucal.h:158
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
void ucal_setDate(UCalendar *cal, int32_t year, int32_t month, int32_t date, UErrorCode *status)
Set a UCalendar's current date.
Thursday.
Definition: ucal.h:463
September.
Definition: ucal.h:494
void ucal_setDateTime(UCalendar *cal, int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second, UErrorCode *status)
Set a UCalendar's current date.
Canonical system zones.
Definition: ucal.h:540
USystemTimeZoneType
System time zone type constants used by filtering zones in ucal_openTimeZoneIDEnumeration.
Definition: ucal.h:530
Field number indicating the localized day of week.
Definition: ucal.h:387
Designates a full weekend day (the entire day is included in the weekend).
Definition: ucal.h:1268
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:639
void ucal_add(UCalendar *cal, UCalendarDateFields field, int32_t amount, UErrorCode *status)
Add a specified signed amount to a particular field in a UCalendar.
void ucal_setDefaultTimeZone(const UChar *zoneID, UErrorCode *ec)
Set the default time zone.
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
Definition: uloc.h:336
Unambiguously designates the Gregorian calendar for the locale.
Definition: ucal.h:174
C API: String Enumeration.
int32_t ucal_getDefaultTimeZone(UChar *result, int32_t resultCapacity, UErrorCode *ec)
Return the default time zone.
January.
Definition: ucal.h:478
const char * ucal_getType(const UCalendar *cal, UErrorCode *status)
Get the resource keyword value string designating the calendar type for the UCalendar.
Basic definitions for ICU, for both C and C++ APIs.
int32_t ucal_getTimeZoneDisplayName(const UCalendar *cal, UCalendarDisplayNameType type, const char *locale, UChar *result, int32_t resultLength, UErrorCode *status)
Get the display name for a UCalendar's TimeZone.
Designates a day that starts as a weekday and transitions to the weekend.
Definition: ucal.h:1274
Field number indicating the daylight savings offset in milliseconds.
Definition: ucal.h:370
Field number indicating the second within the minute.
Definition: ucal.h:348
Field count.
Definition: ucal.h:430
void ucal_roll(UCalendar *cal, UCalendarDateFields field, int32_t amount, UErrorCode *status)
Add a specified signed amount to a particular field in a UCalendar.
UCalendarDisplayNameType
Possible formats for a UCalendar's display name.
Definition: ucal.h:752
Field number indicating the raw offset from GMT in milliseconds.
Definition: ucal.h:363
void ucal_setTimeZone(UCalendar *cal, const UChar *zoneID, int32_t len, UErrorCode *status)
Set the TimeZone used by a UCalendar.
int32_t ucal_getCanonicalTimeZoneID(const UChar *id, int32_t len, UChar *result, int32_t resultCapacity, UBool *isSystemID, UErrorCode *status)
Returns the canonical system timezone ID or the normalized custom time zone ID for the given time zon...
UCalendarAMPMs
Possible AM/PM values in a UCalendar.
Definition: ucal.h:514
Field number indicating the week number within the current year.
Definition: ucal.h:229
UCalendarLimitType
Possible limit values for a UCalendar.
Definition: ucal.h:1144
#define U_DRAFT
This is used to declare a function as a draft public ICU C API.
Definition: umachine.h:139
UDate ucal_getNow(void)
Get the current date and time.
UCalendarMonths
Possible months in a UCalendar.
Definition: ucal.h:476
December.
Definition: ucal.h:500
UEnumeration * ucal_openTimeZoneIDEnumeration(USystemTimeZoneType zoneType, const char *region, const int32_t *rawOffset, UErrorCode *ec)
Create an enumeration over system time zone IDs with the given filter conditions. ...
Field number indicating the hour of the day.
Definition: ucal.h:332
Field number indicating the modified Julian day number.
Definition: ucal.h:407
UDate ucal_getMillis(const UCalendar *cal, UErrorCode *status)
Get a UCalendar's current time in millis.
UDate ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode)
Gets the Gregorian Calendar change date.
void ucal_clearField(UCalendar *cal, UCalendarDateFields field)
Clear a field in a UCalendar.
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:137
int8_t UBool
The ICU boolean type.
Definition: umachine.h:228
Field number indicating the month.
Definition: ucal.h:216
PM.
Definition: ucal.h:518
C API: Locale.