ICU 4.2.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-2009, 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 
15 #if !UCONFIG_NO_FORMATTING
16 
146 typedef void* UCalendar;
147 
168 };
169 
172 
183 
189 
210 
223 
238 
247 
254 
270 
295 
306 
317 
326 
334 
342 
350 
357 
364 
373 
381 
389 
401 
412 
418 
424 
434 };
435 
461 };
462 
465 
499 };
500 
503 
512 };
513 
516 
530 
548 ucal_openCountryTimeZones(const char* country, UErrorCode* ec);
549 
567 ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* ec);
568 
578 U_STABLE void U_EXPORT2
579 ucal_setDefaultTimeZone(const UChar* zoneID, UErrorCode* ec);
580 
598 ucal_getDSTSavings(const UChar* zoneID, UErrorCode* ec);
599 
607 ucal_getNow(void);
608 
632 ucal_open(const UChar* zoneID,
633  int32_t len,
634  const char* locale,
635  UCalendarType type,
636  UErrorCode* status);
637 
644 U_STABLE void U_EXPORT2
645 ucal_close(UCalendar *cal);
646 
656 ucal_clone(const UCalendar* cal,
657  UErrorCode* status);
658 
668 U_STABLE void U_EXPORT2
670  const UChar* zoneID,
671  int32_t len,
672  UErrorCode* status);
673 
687 };
688 
691 
708  const char* locale,
709  UChar* result,
710  int32_t resultLength,
711  UErrorCode* status);
712 
722 ucal_inDaylightTime(const UCalendar* cal,
723  UErrorCode* status );
724 
745 U_STABLE void U_EXPORT2
746 ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode);
747 
769 ucal_getGregorianChange(const UCalendar *cal, UErrorCode *pErrorCode);
770 
782 };
783 
786 
799 ucal_getAttribute(const UCalendar* cal,
800  UCalendarAttribute attr);
801 
813 U_STABLE void U_EXPORT2
815  UCalendarAttribute attr,
816  int32_t newValue);
817 
827 U_STABLE const char* U_EXPORT2
828 ucal_getAvailable(int32_t localeIndex);
829 
839 ucal_countAvailable(void);
840 
853 ucal_getMillis(const UCalendar* cal,
854  UErrorCode* status);
855 
867 U_STABLE void U_EXPORT2
869  UDate dateTime,
870  UErrorCode* status );
871 
886 U_STABLE void U_EXPORT2
888  int32_t year,
889  int32_t month,
890  int32_t date,
891  UErrorCode* status);
892 
910 U_STABLE void U_EXPORT2
912  int32_t year,
913  int32_t month,
914  int32_t date,
915  int32_t hour,
916  int32_t minute,
917  int32_t second,
918  UErrorCode* status);
919 
930 ucal_equivalentTo(const UCalendar* cal1,
931  const UCalendar* cal2);
932 
948 U_STABLE void U_EXPORT2
949 ucal_add(UCalendar* cal,
950  UCalendarDateFields field,
951  int32_t amount,
952  UErrorCode* status);
953 
969 U_STABLE void U_EXPORT2
970 ucal_roll(UCalendar* cal,
971  UCalendarDateFields field,
972  int32_t amount,
973  UErrorCode* status);
974 
992 ucal_get(const UCalendar* cal,
993  UCalendarDateFields field,
994  UErrorCode* status );
995 
1011 U_STABLE void U_EXPORT2
1012 ucal_set(UCalendar* cal,
1013  UCalendarDateFields field,
1014  int32_t value);
1015 
1032 ucal_isSet(const UCalendar* cal,
1033  UCalendarDateFields field);
1034 
1049 U_STABLE void U_EXPORT2
1051  UCalendarDateFields field);
1052 
1063 U_STABLE void U_EXPORT2
1064 ucal_clear(UCalendar* calendar);
1065 
1083 };
1084 
1087 
1103 ucal_getLimit(const UCalendar* cal,
1104  UCalendarDateFields field,
1105  UCalendarLimitType type,
1106  UErrorCode* status);
1107 
1115 U_STABLE const char * U_EXPORT2
1116 ucal_getLocaleByType(const UCalendar *cal, ULocDataLocaleType type, UErrorCode* status);
1117 
1124 U_DRAFT const char * U_EXPORT2
1126 
1147  UChar* result, int32_t resultCapacity, UBool *isSystemID, UErrorCode* status);
1155 U_DRAFT const char * U_EXPORT2
1156 ucal_getType(const UCalendar *cal, UErrorCode* status);
1157 
1175 ucal_getKeywordValuesForLocale(const char* key,
1176  const char* locale,
1177  UBool commonlyUsed,
1178  UErrorCode* status);
1179 
1180 
1181 #endif /* #if !UCONFIG_NO_FORMATTING */
1182 
1183 #endif
UCalendar * ucal_clone(const UCalendar *cal, UErrorCode *status)
Open a copy of a UCalendar.
A better name for UCAL_TRADITIONAL.
Definition: ucal.h:167
void * UCalendar
A calendar.
Definition: ucal.h:146
Field number indicating the day number within the current year.
Definition: ucal.h:253
August.
Definition: ucal.h:485
May.
Definition: ucal.h:479
Short standard display name.
Definition: ucal.h:682
UCalendarDateFields
Possible fields in a UCalendar.
Definition: ucal.h:176
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:246
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:411
Minimum number of days in first week.
Definition: ucal.h:781
int32_t ucal_countAvailable(void)
Determine how many locales have calendars available.
Lenient parsing.
Definition: ucal.h:777
AM.
Definition: ucal.h:509
Field number indicating the era, e.g., AD or BC in the Gregorian (Julian) calendar.
Definition: ucal.h:182
UBool ucal_inDaylightTime(const UCalendar *cal, UErrorCode *status)
Determine if a UCalendar is currently in daylight savings time.
Value of the UCAL_MONTH field indicating the thirteenth month of the year.
Definition: ucal.h:498
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:1074
June.
Definition: ucal.h:481
Leaest maximum value.
Definition: ucal.h:1078
double UDate
Date and Time data type.
Definition: utypes.h:281
Field number indicating the week number within the current month.
Definition: ucal.h:237
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:38
Field number indicating the millisecond within the second.
Definition: ucal.h:349
Year of this calendar system, encompassing all supra-year fields.
Definition: ucal.h:388
Standard display name.
Definition: ucal.h:680
Actual minimum value.
Definition: ucal.h:1080
Friday.
Definition: ucal.h:458
const char * ucal_getAvailable(int32_t localeIndex)
Get a locale for which calendars are available.
Minimum value.
Definition: ucal.h:1072
UBool ucal_equivalentTo(const UCalendar *cal1, const UCalendar *cal2)
Returns TRUE if two UCalendars are equivalent.
Wednesday.
Definition: ucal.h:454
Tuesday.
Definition: ucal.h:452
Saturday.
Definition: ucal.h:460
March.
Definition: ucal.h:475
Field number indicating the extended year corresponding to the UCAL_WEEK_OF_YEAR field.
Definition: ucal.h:372
Field number indicating the day of the month.
Definition: ucal.h:433
UCalendarAttribute
Types of UCalendar attributes.
Definition: ucal.h:775
Sunday.
Definition: ucal.h:448
Field number indicating whether the HOUR is before or after noon.
Definition: ucal.h:305
Field number indicating the ordinal number of the day of the week within the current month...
Definition: ucal.h:294
First day of week.
Definition: ucal.h:779
February.
Definition: ucal.h:473
October.
Definition: ucal.h:489
Short daylight savings display name.
Definition: ucal.h:686
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:1076
UCalendarDaysOfWeek
Useful constant for days of week.
Definition: ucal.h:446
November.
Definition: ucal.h:491
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:684
Despite the name, UCAL_TRADITIONAL designates the locale's default calendar, which may be the Gregori...
Definition: ucal.h:157
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...
July.
Definition: ucal.h:483
UEnumeration * ucal_openTimeZones(UErrorCode *ec)
Create an enumeration over all time zones.
Monday.
Definition: ucal.h:450
Field number indicating the hour of the morning or afternoon.
Definition: ucal.h:316
Field number indicating the minute within the hour.
Definition: ucal.h:333
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:477
void ucal_setAttribute(UCalendar *cal, UCalendarAttribute attr, int32_t newValue)
Set a numeric attribute associated with a UCalendar.
#define U_EXPORT2
Definition: platform.h:338
Field number indicating the day of the week.
Definition: ucal.h:269
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:417
Field number indicating the year.
Definition: ucal.h:188
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.
Actual maximum value.
Definition: ucal.h:1082
uint16_t UChar
Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
Definition: umachine.h:299
UCalendarType
Possible types of UCalendars.
Definition: ucal.h:151
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:456
September.
Definition: ucal.h:487
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.
Field number indicating the localized day of week.
Definition: ucal.h:380
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:593
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:314
Unambiguously designates the Gregorian calendar for the locale.
Definition: ucal.h:162
C API: String Enumeration.
int32_t ucal_getDefaultTimeZone(UChar *result, int32_t resultCapacity, UErrorCode *ec)
Return the default time zone.
January.
Definition: ucal.h:471
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.
Field number indicating the daylight savings offset in milliseconds.
Definition: ucal.h:363
Field number indicating the second within the minute.
Definition: ucal.h:341
Field count.
Definition: ucal.h:423
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:678
Field number indicating the raw offset from GMT in milliseconds.
Definition: ucal.h:356
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:507
Field number indicating the week number within the current year.
Definition: ucal.h:222
UCalendarLimitType
Possible limit values for a UCalendar.
Definition: ucal.h:1070
#define U_DRAFT
This is used to declare a function as a draft public ICU C API.
Definition: umachine.h:119
UDate ucal_getNow(void)
Get the current date and time.
UCalendarMonths
Possible months in a UCalendar.
Definition: ucal.h:469
December.
Definition: ucal.h:493
Field number indicating the hour of the day.
Definition: ucal.h:325
Field number indicating the modified Julian day number.
Definition: ucal.h:400
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.
signed int int32_t
Define 64 bit limits.
Definition: pwin32.h:143
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:117
int8_t UBool
The ICU boolean type.
Definition: umachine.h:208
Field number indicating the month.
Definition: ucal.h:209
PM.
Definition: ucal.h:511
C API: Locale.