ICU 69.1 69.1

calendar.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ********************************************************************************
5 * Copyright (C) 1997-2014, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 ********************************************************************************
8 *
9 * File CALENDAR.H
10 *
11 * Modification History:
12 *
13 * Date Name Description
14 * 04/22/97 aliu Expanded and corrected comments and other header
15 * contents.
16 * 05/01/97 aliu Made equals(), before(), after() arguments const.
17 * 05/20/97 aliu Replaced fAreFieldsSet with fAreFieldsInSync and
18 * fAreAllFieldsSet.
19 * 07/27/98 stephen Sync up with JDK 1.2
20 * 11/15/99 weiv added YEAR_WOY and DOW_LOCAL
21 * to EDateFields
22 * 8/19/2002 srl Removed Javaisms
23 * 11/07/2003 srl Update, clean up documentation.
24 ********************************************************************************
25 */
26
27 #ifndef CALENDAR_H
28 #define CALENDAR_H
29
30 #include "unicode/utypes.h"
31
32 #if U_SHOW_CPLUSPLUS_API
33
38 #if !UCONFIG_NO_FORMATTING
39
40 #include "unicode/uobject.h"
41 #include "unicode/locid.h"
42 #include "unicode/timezone.h"
43 #include "unicode/ucal.h"
44 #include "unicode/umisc.h"
45
46 U_NAMESPACE_BEGIN
47
48 class ICUServiceFactory;
49
50 // Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API,
51 // it is a return type for a virtual method (@internal)
55 typedef int32_t UFieldResolutionTable[12][8];
56
57 class BasicTimeZone;
189 class U_I18N_API Calendar : public UObject {
190 public:
191 #ifndef U_FORCE_HIDE_DEPRECATED_API
192
198 enum EDateFields {
199 #ifndef U_HIDE_DEPRECATED_API
200 /*
201 * ERA may be defined on other platforms. To avoid any potential problems undefined it here.
202 */
203 #ifdef ERA
204 #undef ERA
205 #endif
206 ERA, // Example: 0..1
207 YEAR, // Example: 1..big number
208 MONTH, // Example: 0..11
209 WEEK_OF_YEAR, // Example: 1..53
210 WEEK_OF_MONTH, // Example: 1..4
211 DATE, // Example: 1..31
212 DAY_OF_YEAR, // Example: 1..365
213 DAY_OF_WEEK, // Example: 1..7
214 DAY_OF_WEEK_IN_MONTH, // Example: 1..4, may be specified as -1
215 AM_PM, // Example: 0..1
216 HOUR, // Example: 0..11
217 HOUR_OF_DAY, // Example: 0..23
218 MINUTE, // Example: 0..59
219 SECOND, // Example: 0..59
220 MILLISECOND, // Example: 0..999
221 ZONE_OFFSET, // Example: -12*U_MILLIS_PER_HOUR..12*U_MILLIS_PER_HOUR
222 DST_OFFSET, // Example: 0 or U_MILLIS_PER_HOUR
223 YEAR_WOY, // 'Y' Example: 1..big number - Year of Week of Year
224 DOW_LOCAL, // 'e' Example: 1..7 - Day of Week / Localized
225
226 EXTENDED_YEAR,
227 JULIAN_DAY,
228 MILLISECONDS_IN_DAY,
229 IS_LEAP_MONTH,
230
231 FIELD_COUNT = UCAL_FIELD_COUNT // See ucal.h for other fields.
232 #endif /* U_HIDE_DEPRECATED_API */
233 };
234 #endif // U_FORCE_HIDE_DEPRECATED_API
235
236 #ifndef U_HIDE_DEPRECATED_API
237
243 enum EDaysOfWeek {
244 SUNDAY = 1,
245 MONDAY,
246 TUESDAY,
247 WEDNESDAY,
248 THURSDAY,
249 FRIDAY,
250 SATURDAY
251 };
252
257 enum EMonths {
258 JANUARY,
259 FEBRUARY,
260 MARCH,
261 APRIL,
262 MAY,
263 JUNE,
264 JULY,
265 AUGUST,
266 SEPTEMBER,
267 OCTOBER,
268 NOVEMBER,
269 DECEMBER,
270 UNDECIMBER
271 };
272
277 enum EAmpm {
278 AM,
279 PM
280 };
281 #endif /* U_HIDE_DEPRECATED_API */
282
287 virtual ~Calendar();
288
295 virtual Calendar* clone() const = 0;
296
308 static Calendar* U_EXPORT2 createInstance(UErrorCode& success);
309
322 static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, UErrorCode& success);
323
335 static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, UErrorCode& success);
336
347 static Calendar* U_EXPORT2 createInstance(const Locale& aLocale, UErrorCode& success);
348
362 static Calendar* U_EXPORT2 createInstance(TimeZone* zoneToAdopt, const Locale& aLocale, UErrorCode& success);
363
376 static Calendar* U_EXPORT2 createInstance(const TimeZone& zone, const Locale& aLocale, UErrorCode& success);
377
387 static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
388
389
406 static StringEnumeration* U_EXPORT2 getKeywordValuesForLocale(const char* key,
407 const Locale& locale, UBool commonlyUsed, UErrorCode& status);
408
416 static UDate U_EXPORT2 getNow(void);
417
431 inline UDate getTime(UErrorCode& status) const { return getTimeInMillis(status); }
432
443 inline void setTime(UDate date, UErrorCode& status) { setTimeInMillis(date, status); }
444
456 virtual UBool operator==(const Calendar& that) const;
457
466 UBool operator!=(const Calendar& that) const {return !operator==(that);}
467
478 virtual UBool isEquivalentTo(const Calendar& other) const;
479
494 UBool equals(const Calendar& when, UErrorCode& status) const;
495
509 UBool before(const Calendar& when, UErrorCode& status) const;
510
524 UBool after(const Calendar& when, UErrorCode& status) const;
525
526 #ifndef U_FORCE_HIDE_DEPRECATED_API
527
547 virtual void add(EDateFields field, int32_t amount, UErrorCode& status);
548 #endif // U_FORCE_HIDE_DEPRECATED_API
549
570 virtual void add(UCalendarDateFields field, int32_t amount, UErrorCode& status);
571
572 #ifndef U_HIDE_DEPRECATED_API
573
605 inline void roll(EDateFields field, UBool up, UErrorCode& status);
606 #endif /* U_HIDE_DEPRECATED_API */
607
640 inline void roll(UCalendarDateFields field, UBool up, UErrorCode& status);
641
642 #ifndef U_FORCE_HIDE_DEPRECATED_API
643
674 virtual void roll(EDateFields field, int32_t amount, UErrorCode& status);
675 #endif // U_FORCE_HIDE_DEPRECATED_API
676
708 virtual void roll(UCalendarDateFields field, int32_t amount, UErrorCode& status);
709
710 #ifndef U_FORCE_HIDE_DEPRECATED_API
711
766 virtual int32_t fieldDifference(UDate when, EDateFields field, UErrorCode& status);
767 #endif // U_FORCE_HIDE_DEPRECATED_API
768
824 virtual int32_t fieldDifference(UDate when, UCalendarDateFields field, UErrorCode& status);
825
834 void adoptTimeZone(TimeZone* value);
835
843 void setTimeZone(const TimeZone& zone);
844
853 const TimeZone& getTimeZone(void) const;
854
863 TimeZone* orphanTimeZone(void);
864
873 virtual UBool inDaylightTime(UErrorCode& status) const = 0;
874
887 void setLenient(UBool lenient);
888
895 UBool isLenient(void) const;
896
917 void setRepeatedWallTimeOption(UCalendarWallTimeOption option);
918
928 UCalendarWallTimeOption getRepeatedWallTimeOption(void) const;
929
951 void setSkippedWallTimeOption(UCalendarWallTimeOption option);
952
963 UCalendarWallTimeOption getSkippedWallTimeOption(void) const;
964
965 #ifndef U_HIDE_DEPRECATED_API
966
972 void setFirstDayOfWeek(EDaysOfWeek value);
973 #endif /* U_HIDE_DEPRECATED_API */
974
981 void setFirstDayOfWeek(UCalendarDaysOfWeek value);
982
983 #ifndef U_HIDE_DEPRECATED_API
984
990 EDaysOfWeek getFirstDayOfWeek(void) const;
991 #endif /* U_HIDE_DEPRECATED_API */
992
1000 UCalendarDaysOfWeek getFirstDayOfWeek(UErrorCode &status) const;
1001
1011 void setMinimalDaysInFirstWeek(uint8_t value);
1012
1022 uint8_t getMinimalDaysInFirstWeek(void) const;
1023
1024 #ifndef U_FORCE_HIDE_DEPRECATED_API
1025
1033 virtual int32_t getMinimum(EDateFields field) const;
1034 #endif // U_FORCE_HIDE_DEPRECATED_API
1035
1044 virtual int32_t getMinimum(UCalendarDateFields field) const;
1045
1046 #ifndef U_FORCE_HIDE_DEPRECATED_API
1047
1055 virtual int32_t getMaximum(EDateFields field) const;
1056 #endif // U_FORCE_HIDE_DEPRECATED_API
1057
1066 virtual int32_t getMaximum(UCalendarDateFields field) const;
1067
1068 #ifndef U_FORCE_HIDE_DEPRECATED_API
1069
1077 virtual int32_t getGreatestMinimum(EDateFields field) const;
1078 #endif // U_FORCE_HIDE_DEPRECATED_API
1079
1088 virtual int32_t getGreatestMinimum(UCalendarDateFields field) const;
1089
1090 #ifndef U_FORCE_HIDE_DEPRECATED_API
1091
1099 virtual int32_t getLeastMaximum(EDateFields field) const;
1100 #endif // U_FORCE_HIDE_DEPRECATED_API
1101
1110 virtual int32_t getLeastMaximum(UCalendarDateFields field) const;
1111
1112 #ifndef U_HIDE_DEPRECATED_API
1113
1127 int32_t getActualMinimum(EDateFields field, UErrorCode& status) const;
1128 #endif /* U_HIDE_DEPRECATED_API */
1129
1144 virtual int32_t getActualMinimum(UCalendarDateFields field, UErrorCode& status) const;
1145
1146 #ifndef U_HIDE_DEPRECATED_API
1147
1163 int32_t getActualMaximum(EDateFields field, UErrorCode& status) const;
1164 #endif /* U_HIDE_DEPRECATED_API */
1165
1182 virtual int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const;
1183
1184 #ifndef U_HIDE_DEPRECATED_API
1185
1198 int32_t get(EDateFields field, UErrorCode& status) const;
1199 #endif /* U_HIDE_DEPRECATED_API */
1200
1214 int32_t get(UCalendarDateFields field, UErrorCode& status) const;
1215
1216 #ifndef U_HIDE_DEPRECATED_API
1217
1225 UBool isSet(EDateFields field) const;
1226 #endif /* U_HIDE_DEPRECATED_API */
1227
1236 UBool isSet(UCalendarDateFields field) const;
1237
1238 #ifndef U_HIDE_DEPRECATED_API
1239
1246 void set(EDateFields field, int32_t value);
1247 #endif /* U_HIDE_DEPRECATED_API */
1248
1256 void set(UCalendarDateFields field, int32_t value);
1257
1268 void set(int32_t year, int32_t month, int32_t date);
1269
1282 void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute);
1283
1297 void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second);
1298
1305 void clear(void);
1306
1307 #ifndef U_HIDE_DEPRECATED_API
1308
1316 void clear(EDateFields field);
1317 #endif /* U_HIDE_DEPRECATED_API */
1318
1327 void clear(UCalendarDateFields field);
1328
1344 virtual UClassID getDynamicClassID(void) const = 0;
1345
1378 virtual const char * getType() const = 0;
1379
1396 virtual UCalendarWeekdayType getDayOfWeekType(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const;
1397
1412 virtual int32_t getWeekendTransition(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const;
1413
1423 virtual UBool isWeekend(UDate date, UErrorCode &status) const;
1424
1432 virtual UBool isWeekend(void) const;
1433
1434 protected:
1435
1444 Calendar(UErrorCode& success);
1445
1452 Calendar(const Calendar& source);
1453
1460 Calendar& operator=(const Calendar& right);
1461
1472 Calendar(TimeZone* zone, const Locale& aLocale, UErrorCode& success);
1473
1483 Calendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success);
1484
1493 virtual void computeTime(UErrorCode& status);
1494
1506 virtual void computeFields(UErrorCode& status);
1507
1517 double getTimeInMillis(UErrorCode& status) const;
1518
1527 void setTimeInMillis( double millis, UErrorCode& status );
1528
1538 void complete(UErrorCode& status);
1539
1540 #ifndef U_HIDE_DEPRECATED_API
1541
1549 inline int32_t internalGet(EDateFields field) const {return fFields[field];}
1550 #endif /* U_HIDE_DEPRECATED_API */
1551
1552 #ifndef U_HIDE_INTERNAL_API
1553
1563 inline int32_t internalGet(UCalendarDateFields field, int32_t defaultValue) const {return fStamp[field]>kUnset ? fFields[field] : defaultValue;}
1564
1573 inline int32_t internalGet(UCalendarDateFields field) const {return fFields[field];}
1574 #endif /* U_HIDE_INTERNAL_API */
1575
1576 #ifndef U_HIDE_DEPRECATED_API
1577
1586 void internalSet(EDateFields field, int32_t value);
1587 #endif /* U_HIDE_DEPRECATED_API */
1588
1598 inline void internalSet(UCalendarDateFields field, int32_t value);
1599
1606 virtual void prepareGetActual(UCalendarDateFields field, UBool isMinimum, UErrorCode &status);
1607
1612 enum ELimitType {
1613 #ifndef U_HIDE_INTERNAL_API
1614 UCAL_LIMIT_MINIMUM = 0,
1615 UCAL_LIMIT_GREATEST_MINIMUM,
1616 UCAL_LIMIT_LEAST_MAXIMUM,
1617 UCAL_LIMIT_MAXIMUM,
1618 UCAL_LIMIT_COUNT
1619 #endif /* U_HIDE_INTERNAL_API */
1620 };
1621
1643 virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const = 0;
1644
1652 virtual int32_t getLimit(UCalendarDateFields field, ELimitType limitType) const;
1653
1654
1668 virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month,
1669 UBool useMonth) const = 0;
1670
1678 virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const ;
1679
1687 virtual int32_t handleGetYearLength(int32_t eyear) const;
1688
1689
1698 virtual int32_t handleGetExtendedYear() = 0;
1699
1708 virtual int32_t handleComputeJulianDay(UCalendarDateFields bestField);
1709
1718 virtual int32_t handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy);
1719
1726 virtual void validateField(UCalendarDateFields field, UErrorCode &status);
1727
1728 #ifndef U_HIDE_INTERNAL_API
1729
1735 int32_t computeJulianDay();
1736
1744 double computeMillisInDay();
1745
1755 int32_t computeZoneOffset(double millis, double millisInDay, UErrorCode &ec);
1756
1757
1766 int32_t newestStamp(UCalendarDateFields start, UCalendarDateFields end, int32_t bestSoFar) const;
1767
1773 enum {
1775 kResolveSTOP = -1,
1777 kResolveRemap = 32
1778 };
1779
1785 static const UFieldResolutionTable kDatePrecedence[];
1786
1792 static const UFieldResolutionTable kYearPrecedence[];
1793
1799 static const UFieldResolutionTable kDOWPrecedence[];
1800
1828 UCalendarDateFields resolveFields(const UFieldResolutionTable *precedenceTable);
1829 #endif /* U_HIDE_INTERNAL_API */
1830
1831
1835 virtual const UFieldResolutionTable* getFieldResolutionTable() const;
1836
1837 #ifndef U_HIDE_INTERNAL_API
1838
1843 UCalendarDateFields newerField(UCalendarDateFields defaultField, UCalendarDateFields alternateField) const;
1844 #endif /* U_HIDE_INTERNAL_API */
1845
1846
1847 private:
1856 int32_t getActualHelper(UCalendarDateFields field, int32_t startValue, int32_t endValue, UErrorCode &status) const;
1857
1858
1859 protected:
1864 UBool fIsTimeSet;
1865
1876 UBool fAreFieldsSet;
1877
1883 UBool fAreAllFieldsSet;
1884
1892 UBool fAreFieldsVirtuallySet;
1893
1900 UDate internalGetTime(void) const { return fTime; }
1901
1909 void internalSetTime(UDate time) { fTime = time; }
1910
1915 int32_t fFields[UCAL_FIELD_COUNT];
1916
1917 #ifndef U_FORCE_HIDE_DEPRECATED_API
1918
1922 UBool fIsSet[UCAL_FIELD_COUNT];
1923 #endif // U_FORCE_HIDE_DEPRECATED_API
1924
1928 enum {
1929 kUnset = 0,
1930 kInternallySet,
1931 kMinimumUserStamp
1932 };
1933
1940 int32_t fStamp[UCAL_FIELD_COUNT];
1941
1966 virtual void handleComputeFields(int32_t julianDay, UErrorCode &status);
1967
1968 #ifndef U_HIDE_INTERNAL_API
1969
1974 int32_t getGregorianYear() const {
1975 return fGregorianYear;
1976 }
1977
1983 int32_t getGregorianMonth() const {
1984 return fGregorianMonth;
1985 }
1986
1992 int32_t getGregorianDayOfYear() const {
1993 return fGregorianDayOfYear;
1994 }
1995
2001 int32_t getGregorianDayOfMonth() const {
2002 return fGregorianDayOfMonth;
2003 }
2004 #endif /* U_HIDE_INTERNAL_API */
2005
2012 virtual int32_t getDefaultMonthInYear(int32_t eyear) ;
2013
2014
2022 virtual int32_t getDefaultDayInMonth(int32_t eyear, int32_t month);
2023
2024 //-------------------------------------------------------------------------
2025 // Protected utility methods for use by subclasses. These are very handy
2026 // for implementing add, roll, and computeFields.
2027 //-------------------------------------------------------------------------
2028
2058 virtual void pinField(UCalendarDateFields field, UErrorCode& status);
2059
2103 int32_t weekNumber(int32_t desiredDay, int32_t dayOfPeriod, int32_t dayOfWeek);
2104
2105
2106 #ifndef U_HIDE_INTERNAL_API
2107
2137 inline int32_t weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek);
2138
2143 int32_t getLocalDOW();
2144 #endif /* U_HIDE_INTERNAL_API */
2145
2146 private:
2147
2151 int32_t fNextStamp;// = MINIMUM_USER_STAMP;
2152
2157 void recalculateStamp();
2158
2162 UDate fTime;
2163
2167 UBool fLenient;
2168
2173 TimeZone* fZone;
2174
2179 UCalendarWallTimeOption fRepeatedWallTime;
2180
2185 UCalendarWallTimeOption fSkippedWallTime;
2186
2195 UCalendarDaysOfWeek fFirstDayOfWeek;
2196 uint8_t fMinimalDaysInFirstWeek;
2197 UCalendarDaysOfWeek fWeekendOnset;
2198 int32_t fWeekendOnsetMillis;
2199 UCalendarDaysOfWeek fWeekendCease;
2200 int32_t fWeekendCeaseMillis;
2201
2212 void setWeekData(const Locale& desiredLocale, const char *type, UErrorCode& success);
2213
2223 void updateTime(UErrorCode& status);
2224
2230 int32_t fGregorianYear;
2231
2237 int32_t fGregorianMonth;
2238
2244 int32_t fGregorianDayOfYear;
2245
2251 int32_t fGregorianDayOfMonth;
2252
2253 /* calculations */
2254
2261 void computeGregorianAndDOWFields(int32_t julianDay, UErrorCode &ec);
2262
2263 protected:
2264
2272 void computeGregorianFields(int32_t julianDay, UErrorCode &ec);
2273
2274 private:
2275
2296 void computeWeekFields(UErrorCode &ec);
2297
2298
2306 void validateFields(UErrorCode &status);
2307
2315 void validateField(UCalendarDateFields field, int32_t min, int32_t max, UErrorCode& status);
2316
2317 protected:
2318 #ifndef U_HIDE_INTERNAL_API
2319
2328 static uint8_t julianDayToDayOfWeek(double julian);
2329 #endif /* U_HIDE_INTERNAL_API */
2330
2331 private:
2332 char validLocale[ULOC_FULLNAME_CAPACITY];
2333 char actualLocale[ULOC_FULLNAME_CAPACITY];
2334
2335 public:
2336 #if !UCONFIG_NO_SERVICE
2337
2341 #ifndef U_HIDE_INTERNAL_API
2342
2348 static StringEnumeration* getAvailableLocales(void);
2349
2363 static URegistryKey registerFactory(ICUServiceFactory* toAdopt, UErrorCode& status);
2364
2380 static UBool unregister(URegistryKey key, UErrorCode& status);
2381 #endif /* U_HIDE_INTERNAL_API */
2382
2387 friend class CalendarFactory;
2388
2393 friend class CalendarService;
2394
2399 friend class DefaultCalendarFactory;
2400 #endif /* !UCONFIG_NO_SERVICE */
2401
2406 virtual UBool haveDefaultCentury() const = 0;
2407
2412 virtual UDate defaultCenturyStart() const = 0;
2417 virtual int32_t defaultCenturyStartYear() const = 0;
2418
2425 Locale getLocale(ULocDataLocaleType type, UErrorCode &status) const;
2426
2432 virtual int32_t getRelatedYear(UErrorCode &status) const;
2433
2439 virtual void setRelatedYear(int32_t year);
2440
2441 #ifndef U_HIDE_INTERNAL_API
2442
2448 const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const;
2449 #endif /* U_HIDE_INTERNAL_API */
2450
2451 private:
2456 BasicTimeZone* getBasicTimeZone() const;
2457
2465 UBool getImmediatePreviousZoneTransition(UDate base, UDate *transitionTime, UErrorCode& status) const;
2466
2467 public:
2468 #ifndef U_HIDE_INTERNAL_API
2469
2477 static Calendar * U_EXPORT2 makeInstance(
2478 const Locale &locale, UErrorCode &status);
2479
2490 static void U_EXPORT2 getCalendarTypeFromLocale(
2491 const Locale &locale,
2492 char *typeBuffer,
2493 int32_t typeBufferSize,
2494 UErrorCode &status);
2495 #endif /* U_HIDE_INTERNAL_API */
2496 };
2497
2498 // -------------------------------------
2499
2500 inline Calendar*
2501 Calendar::createInstance(TimeZone* zone, UErrorCode& errorCode)
2502 {
2503 // since the Locale isn't specified, use the default locale
2504 return createInstance(zone, Locale::getDefault(), errorCode);
2505 }
2506
2507 // -------------------------------------
2508
2509 inline void
2510 Calendar::roll(UCalendarDateFields field, UBool up, UErrorCode& status)
2511 {
2512 roll(field, (int32_t)(up ? +1 : -1), status);
2513 }
2514
2515 #ifndef U_HIDE_DEPRECATED_API
2516 inline void
2517 Calendar::roll(EDateFields field, UBool up, UErrorCode& status)
2518 {
2519 roll((UCalendarDateFields) field, up, status);
2520 }
2521 #endif /* U_HIDE_DEPRECATED_API */
2522
2523
2524 // -------------------------------------
2525
2531 inline void
2532 Calendar::internalSet(UCalendarDateFields field, int32_t value)
2533 {
2534 fFields[field] = value;
2535 fStamp[field] = kInternallySet;
2536 fIsSet[field] = true; // Remove later
2537 }
2538
2539
2540 #ifndef U_HIDE_INTERNAL_API
2541 inline int32_t Calendar::weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek)
2542 {
2543 return weekNumber(dayOfPeriod, dayOfPeriod, dayOfWeek);
2544 }
2545 #endif /* U_HIDE_INTERNAL_API */
2546
2547 U_NAMESPACE_END
2548
2549 #endif /* #if !UCONFIG_NO_FORMATTING */
2550
2551 #endif /* U_SHOW_CPLUSPLUS_API */
2552
2553 #endif // _CALENDAR
icu::Calendar::getGregorianMonth
int32_t getGregorianMonth() const
Return the month (0-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1983
icu::Calendar::ELimitType
ELimitType
Limit enums.
Definition: calendar.h:1612
icu::Calendar::fAreAllFieldsSet
UBool fAreAllFieldsSet
True if all of the fields have been set.
Definition: calendar.h:1883
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UCalendarWallTimeOption
UCalendarWallTimeOption
Options for handling ambiguous wall time at time zone offset transitions.
Definition: ucal.h:965
icu::Calendar::internalGet
int32_t internalGet(EDateFields field) const
Gets the value for a given time field.
Definition: calendar.h:1549
U_I18N_API
#define U_I18N_API
Definition: utypes.h:301
icu::Calendar
Calendar is an abstract base class for converting between a UDate object and a set of integer fields ...
Definition: calendar.h:189
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
icu::BasicTimeZone
BasicTimeZone is an abstract class extending TimeZone.
Definition: basictz.h:38
ULocDataLocaleType
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested,...
Definition: uloc.h:338
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
icu::Calendar::operator!=
UBool operator!=(const Calendar &that) const
Compares the inequality of two Calendar objects.
Definition: calendar.h:466
icu::Calendar::internalGet
int32_t internalGet(UCalendarDateFields field, int32_t defaultValue) const
Gets the value for a given time field.
Definition: calendar.h:1563
icu::Calendar::internalGet
int32_t internalGet(UCalendarDateFields field) const
Gets the value for a given time field.
Definition: calendar.h:1573
icu::Calendar::internalGetTime
UDate internalGetTime(void) const
Get the current time without recomputing.
Definition: calendar.h:1900
icu::TimeZone
TimeZone represents a time zone offset, and also figures out daylight savings.
Definition: timezone.h:133
icu::Calendar::EAmpm
EAmpm
Useful constants for hour in 12-hour clock.
Definition: calendar.h:277
umisc.h
C API:misc definitions.
timezone.h
C++ API: TimeZone object.
icu::Calendar::internalSetTime
void internalSetTime(UDate time)
Set the current time without affecting flags or fields.
Definition: calendar.h:1909
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
icu::StringEnumeration
Base class for 'pure' C++ implementations of uenum api.
Definition: strenum.h:61
icu::UObject::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
ucal.h
C API: Calendar.
icu::Calendar::fAreFieldsVirtuallySet
UBool fAreFieldsVirtuallySet
True if all fields have been virtually set, but have not yet been computed.
Definition: calendar.h:1892
icu::Calendar::fAreFieldsSet
UBool fAreFieldsSet
True if the fields are in sync with the currently set time of this Calendar.
Definition: calendar.h:1876
UCalendarWeekdayType
UCalendarWeekdayType
Weekday types, as returned by ucal_getDayOfWeekType().
Definition: ucal.h:1399
UCAL_FIELD_COUNT
@ UCAL_FIELD_COUNT
One more than the highest normal UCalendarDateFields value.
Definition: ucal.h:452
ULOC_FULLNAME_CAPACITY
#define ULOC_FULLNAME_CAPACITY
Useful constant for the maximum size of the whole locale ID (including the terminating NULL and all k...
Definition: uloc.h:264
UCalendarDaysOfWeek
UCalendarDaysOfWeek
Useful constant for days of week.
Definition: ucal.h:476
UDate
double UDate
Date and Time data type.
Definition: utypes.h:203
icu::UFieldResolutionTable
int32_t UFieldResolutionTable[12][8]
Definition: calendar.h:48
UCalendarDateFields
UCalendarDateFields
Possible fields in a UCalendar.
Definition: ucal.h:202
icu::Calendar::EMonths
EMonths
Useful constants for month.
Definition: calendar.h:257
icu::Calendar::getGregorianYear
int32_t getGregorianYear() const
Return the extended year on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1974
locid.h
C++ API: Locale ID object.
icu::Calendar::setTime
void setTime(UDate date, UErrorCode &status)
Sets this Calendar's current time with the given UDate.
Definition: calendar.h:443
icu::Calendar::EDaysOfWeek
EDaysOfWeek
Useful constant for days of week.
Definition: calendar.h:243
uobject.h
C++ API: Common ICU base class UObject.
icu::Calendar::getGregorianDayOfMonth
int32_t getGregorianDayOfMonth() const
Return the day of month (1-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:2001
icu::Calendar::EDateFields
EDateFields
Field IDs for date and time.
Definition: calendar.h:198
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:195
icu::Calendar::fIsTimeSet
UBool fIsTimeSet
The flag which indicates if the current time is set in the calendar.
Definition: calendar.h:1864
icu::Calendar::getTime
UDate getTime(UErrorCode &status) const
Gets this Calendar's time as milliseconds.
Definition: calendar.h:431
URegistryKey
const typedef void * URegistryKey
Opaque type returned by registerInstance, registerFactory and unregister for service registration.
Definition: umisc.h:57
icu::Calendar::getGregorianDayOfYear
int32_t getGregorianDayOfYear() const
Return the day of year (1-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1992