ICU 72.1  72.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 bool operator==(const Calendar& that) const;
457 
466  bool 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 
971  void setFirstDayOfWeek(UCalendarDaysOfWeek value);
972 
973 #ifndef U_HIDE_DEPRECATED_API
974 
980  EDaysOfWeek getFirstDayOfWeek(void) const;
981 #endif /* U_HIDE_DEPRECATED_API */
982 
990  UCalendarDaysOfWeek getFirstDayOfWeek(UErrorCode &status) const;
991 
1001  void setMinimalDaysInFirstWeek(uint8_t value);
1002 
1012  uint8_t getMinimalDaysInFirstWeek(void) const;
1013 
1014 #ifndef U_FORCE_HIDE_DEPRECATED_API
1015 
1023  virtual int32_t getMinimum(EDateFields field) const;
1024 #endif // U_FORCE_HIDE_DEPRECATED_API
1025 
1034  virtual int32_t getMinimum(UCalendarDateFields field) const;
1035 
1036 #ifndef U_FORCE_HIDE_DEPRECATED_API
1037 
1045  virtual int32_t getMaximum(EDateFields field) const;
1046 #endif // U_FORCE_HIDE_DEPRECATED_API
1047 
1056  virtual int32_t getMaximum(UCalendarDateFields field) const;
1057 
1058 #ifndef U_FORCE_HIDE_DEPRECATED_API
1059 
1067  virtual int32_t getGreatestMinimum(EDateFields field) const;
1068 #endif // U_FORCE_HIDE_DEPRECATED_API
1069 
1078  virtual int32_t getGreatestMinimum(UCalendarDateFields field) const;
1079 
1080 #ifndef U_FORCE_HIDE_DEPRECATED_API
1081 
1089  virtual int32_t getLeastMaximum(EDateFields field) const;
1090 #endif // U_FORCE_HIDE_DEPRECATED_API
1091 
1100  virtual int32_t getLeastMaximum(UCalendarDateFields field) const;
1101 
1102 #ifndef U_HIDE_DEPRECATED_API
1103 
1117  int32_t getActualMinimum(EDateFields field, UErrorCode& status) const;
1118 #endif /* U_HIDE_DEPRECATED_API */
1119 
1134  virtual int32_t getActualMinimum(UCalendarDateFields field, UErrorCode& status) const;
1135 
1152  virtual int32_t getActualMaximum(UCalendarDateFields field, UErrorCode& status) const;
1153 
1167  int32_t get(UCalendarDateFields field, UErrorCode& status) const;
1168 
1177  UBool isSet(UCalendarDateFields field) const;
1178 
1186  void set(UCalendarDateFields field, int32_t value);
1187 
1198  void set(int32_t year, int32_t month, int32_t date);
1199 
1212  void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute);
1213 
1227  void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second);
1228 
1235  void clear(void);
1236 
1245  void clear(UCalendarDateFields field);
1246 
1262  virtual UClassID getDynamicClassID(void) const override = 0;
1263 
1296  virtual const char * getType() const = 0;
1297 
1314  virtual UCalendarWeekdayType getDayOfWeekType(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const;
1315 
1330  virtual int32_t getWeekendTransition(UCalendarDaysOfWeek dayOfWeek, UErrorCode &status) const;
1331 
1341  virtual UBool isWeekend(UDate date, UErrorCode &status) const;
1342 
1350  virtual UBool isWeekend(void) const;
1351 
1352 protected:
1353 
1362  Calendar(UErrorCode& success);
1363 
1370  Calendar(const Calendar& source);
1371 
1378  Calendar& operator=(const Calendar& right);
1379 
1390  Calendar(TimeZone* zone, const Locale& aLocale, UErrorCode& success);
1391 
1401  Calendar(const TimeZone& zone, const Locale& aLocale, UErrorCode& success);
1402 
1411  virtual void computeTime(UErrorCode& status);
1412 
1424  virtual void computeFields(UErrorCode& status);
1425 
1435  double getTimeInMillis(UErrorCode& status) const;
1436 
1445  void setTimeInMillis( double millis, UErrorCode& status );
1446 
1456  void complete(UErrorCode& status);
1457 
1458 #ifndef U_HIDE_DEPRECATED_API
1459 
1467  inline int32_t internalGet(EDateFields field) const {return fFields[field];}
1468 #endif /* U_HIDE_DEPRECATED_API */
1469 
1470 #ifndef U_HIDE_INTERNAL_API
1471 
1481  inline int32_t internalGet(UCalendarDateFields field, int32_t defaultValue) const {return fStamp[field]>kUnset ? fFields[field] : defaultValue;}
1482 
1491  inline int32_t internalGet(UCalendarDateFields field) const {return fFields[field];}
1492 #endif /* U_HIDE_INTERNAL_API */
1493 
1494 #ifndef U_HIDE_DEPRECATED_API
1495 
1504  void internalSet(EDateFields field, int32_t value);
1505 #endif /* U_HIDE_DEPRECATED_API */
1506 
1516  inline void internalSet(UCalendarDateFields field, int32_t value);
1517 
1524  virtual void prepareGetActual(UCalendarDateFields field, UBool isMinimum, UErrorCode &status);
1525 
1530  enum ELimitType {
1531 #ifndef U_HIDE_INTERNAL_API
1532  UCAL_LIMIT_MINIMUM = 0,
1533  UCAL_LIMIT_GREATEST_MINIMUM,
1534  UCAL_LIMIT_LEAST_MAXIMUM,
1535  UCAL_LIMIT_MAXIMUM,
1536  UCAL_LIMIT_COUNT
1537 #endif /* U_HIDE_INTERNAL_API */
1538  };
1539 
1561  virtual int32_t handleGetLimit(UCalendarDateFields field, ELimitType limitType) const = 0;
1562 
1570  virtual int32_t getLimit(UCalendarDateFields field, ELimitType limitType) const;
1571 
1572 
1586  virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month,
1587  UBool useMonth) const = 0;
1588 
1596  virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month) const ;
1597 
1605  virtual int32_t handleGetYearLength(int32_t eyear) const;
1606 
1607 
1616  virtual int32_t handleGetExtendedYear() = 0;
1617 
1626  virtual int32_t handleComputeJulianDay(UCalendarDateFields bestField);
1627 
1636  virtual int32_t handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy);
1637 
1644  virtual void validateField(UCalendarDateFields field, UErrorCode &status);
1645 
1646 #ifndef U_HIDE_INTERNAL_API
1647 
1653  int32_t computeJulianDay();
1654 
1662  double computeMillisInDay();
1663 
1673  int32_t computeZoneOffset(double millis, double millisInDay, UErrorCode &ec);
1674 
1675 
1684  int32_t newestStamp(UCalendarDateFields start, UCalendarDateFields end, int32_t bestSoFar) const;
1685 
1692  static constexpr int32_t kResolveSTOP = -1;
1702  static constexpr int32_t kResolveRemap = 32;
1703 
1709  static const UFieldResolutionTable kDatePrecedence[];
1710 
1716  static const UFieldResolutionTable kYearPrecedence[];
1717 
1723  static const UFieldResolutionTable kDOWPrecedence[];
1724 
1752  UCalendarDateFields resolveFields(const UFieldResolutionTable *precedenceTable);
1753 #endif /* U_HIDE_INTERNAL_API */
1754 
1755 
1759  virtual const UFieldResolutionTable* getFieldResolutionTable() const;
1760 
1761 #ifndef U_HIDE_INTERNAL_API
1762 
1767  UCalendarDateFields newerField(UCalendarDateFields defaultField, UCalendarDateFields alternateField) const;
1768 #endif /* U_HIDE_INTERNAL_API */
1769 
1770 
1771 private:
1780  int32_t getActualHelper(UCalendarDateFields field, int32_t startValue, int32_t endValue, UErrorCode &status) const;
1781 
1782 
1783 protected:
1789 
1801 
1808 
1817 
1824  UDate internalGetTime(void) const { return fTime; }
1825 
1833  void internalSetTime(UDate time) { fTime = time; }
1834 
1839  int32_t fFields[UCAL_FIELD_COUNT];
1840 
1841 #ifndef U_FORCE_HIDE_DEPRECATED_API
1842 
1847 #endif // U_FORCE_HIDE_DEPRECATED_API
1848 
1852  enum {
1853  kUnset = 0,
1854  kInternallySet,
1855  kMinimumUserStamp
1856  };
1857 
1864  int32_t fStamp[UCAL_FIELD_COUNT];
1865 
1890  virtual void handleComputeFields(int32_t julianDay, UErrorCode &status);
1891 
1892 #ifndef U_HIDE_INTERNAL_API
1893 
1898  int32_t getGregorianYear() const {
1899  return fGregorianYear;
1900  }
1901 
1907  int32_t getGregorianMonth() const {
1908  return fGregorianMonth;
1909  }
1910 
1916  int32_t getGregorianDayOfYear() const {
1917  return fGregorianDayOfYear;
1918  }
1919 
1925  int32_t getGregorianDayOfMonth() const {
1926  return fGregorianDayOfMonth;
1927  }
1928 #endif /* U_HIDE_INTERNAL_API */
1929 
1936  virtual int32_t getDefaultMonthInYear(int32_t eyear) ;
1937 
1938 
1946  virtual int32_t getDefaultDayInMonth(int32_t eyear, int32_t month);
1947 
1948  //-------------------------------------------------------------------------
1949  // Protected utility methods for use by subclasses. These are very handy
1950  // for implementing add, roll, and computeFields.
1951  //-------------------------------------------------------------------------
1952 
1982  virtual void pinField(UCalendarDateFields field, UErrorCode& status);
1983 
2027  int32_t weekNumber(int32_t desiredDay, int32_t dayOfPeriod, int32_t dayOfWeek);
2028 
2029 
2030 #ifndef U_HIDE_INTERNAL_API
2031 
2061  inline int32_t weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek);
2062 
2067  int32_t getLocalDOW();
2068 #endif /* U_HIDE_INTERNAL_API */
2069 
2070 private:
2071 
2075  int32_t fNextStamp;// = MINIMUM_USER_STAMP;
2076 
2081  void recalculateStamp();
2082 
2086  UDate fTime;
2087 
2091  UBool fLenient;
2092 
2097  TimeZone* fZone;
2098 
2103  UCalendarWallTimeOption fRepeatedWallTime;
2104 
2109  UCalendarWallTimeOption fSkippedWallTime;
2110 
2119  UCalendarDaysOfWeek fFirstDayOfWeek;
2120  uint8_t fMinimalDaysInFirstWeek;
2121  UCalendarDaysOfWeek fWeekendOnset;
2122  int32_t fWeekendOnsetMillis;
2123  UCalendarDaysOfWeek fWeekendCease;
2124  int32_t fWeekendCeaseMillis;
2125 
2136  void setWeekData(const Locale& desiredLocale, const char *type, UErrorCode& success);
2137 
2147  void updateTime(UErrorCode& status);
2148 
2154  int32_t fGregorianYear;
2155 
2161  int32_t fGregorianMonth;
2162 
2168  int32_t fGregorianDayOfYear;
2169 
2175  int32_t fGregorianDayOfMonth;
2176 
2177  /* calculations */
2178 
2185  void computeGregorianAndDOWFields(int32_t julianDay, UErrorCode &ec);
2186 
2187 protected:
2188 
2196  void computeGregorianFields(int32_t julianDay, UErrorCode &ec);
2197 
2198 private:
2199 
2220  void computeWeekFields(UErrorCode &ec);
2221 
2222 
2230  void validateFields(UErrorCode &status);
2231 
2239  void validateField(UCalendarDateFields field, int32_t min, int32_t max, UErrorCode& status);
2240 
2241  protected:
2242 #ifndef U_HIDE_INTERNAL_API
2243 
2252  static uint8_t julianDayToDayOfWeek(double julian);
2253 #endif /* U_HIDE_INTERNAL_API */
2254 
2255  private:
2256  char validLocale[ULOC_FULLNAME_CAPACITY];
2257  char actualLocale[ULOC_FULLNAME_CAPACITY];
2258 
2259  public:
2260 #if !UCONFIG_NO_SERVICE
2261 
2265 #ifndef U_HIDE_INTERNAL_API
2266 
2272  static StringEnumeration* getAvailableLocales(void);
2273 
2287  static URegistryKey registerFactory(ICUServiceFactory* toAdopt, UErrorCode& status);
2288 
2304  static UBool unregister(URegistryKey key, UErrorCode& status);
2305 #endif /* U_HIDE_INTERNAL_API */
2306 
2311  friend class CalendarFactory;
2312 
2317  friend class CalendarService;
2318 
2323  friend class DefaultCalendarFactory;
2324 #endif /* !UCONFIG_NO_SERVICE */
2325 
2330  virtual UBool haveDefaultCentury() const = 0;
2331 
2336  virtual UDate defaultCenturyStart() const = 0;
2341  virtual int32_t defaultCenturyStartYear() const = 0;
2342 
2349  Locale getLocale(ULocDataLocaleType type, UErrorCode &status) const;
2350 
2356  virtual int32_t getRelatedYear(UErrorCode &status) const;
2357 
2363  virtual void setRelatedYear(int32_t year);
2364 
2365 #ifndef U_HIDE_INTERNAL_API
2366 
2372  const char* getLocaleID(ULocDataLocaleType type, UErrorCode &status) const;
2373 #endif /* U_HIDE_INTERNAL_API */
2374 
2375 private:
2380  BasicTimeZone* getBasicTimeZone() const;
2381 
2389  UBool getImmediatePreviousZoneTransition(UDate base, UDate *transitionTime, UErrorCode& status) const;
2390 
2391 public:
2392 #ifndef U_HIDE_INTERNAL_API
2393 
2401  static Calendar * U_EXPORT2 makeInstance(
2402  const Locale &locale, UErrorCode &status);
2403 
2414  static void U_EXPORT2 getCalendarTypeFromLocale(
2415  const Locale &locale,
2416  char *typeBuffer,
2417  int32_t typeBufferSize,
2418  UErrorCode &status);
2419 #endif /* U_HIDE_INTERNAL_API */
2420 };
2421 
2422 // -------------------------------------
2423 
2424 inline Calendar*
2425 Calendar::createInstance(TimeZone* zone, UErrorCode& errorCode)
2426 {
2427  // since the Locale isn't specified, use the default locale
2428  return createInstance(zone, Locale::getDefault(), errorCode);
2429 }
2430 
2431 // -------------------------------------
2432 
2433 inline void
2434 Calendar::roll(UCalendarDateFields field, UBool up, UErrorCode& status)
2435 {
2436  roll(field, (int32_t)(up ? +1 : -1), status);
2437 }
2438 
2439 #ifndef U_HIDE_DEPRECATED_API
2440 inline void
2441 Calendar::roll(EDateFields field, UBool up, UErrorCode& status)
2442 {
2443  roll((UCalendarDateFields) field, up, status);
2444 }
2445 #endif /* U_HIDE_DEPRECATED_API */
2446 
2447 
2448 // -------------------------------------
2449 
2455 inline void
2456 Calendar::internalSet(UCalendarDateFields field, int32_t value)
2457 {
2458  fFields[field] = value;
2459  fStamp[field] = kInternallySet;
2460  fIsSet[field] = true; // Remove later
2461 }
2462 
2463 
2464 #ifndef U_HIDE_INTERNAL_API
2465 inline int32_t Calendar::weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek)
2466 {
2467  return weekNumber(dayOfPeriod, dayOfPeriod, dayOfWeek);
2468 }
2469 #endif /* U_HIDE_INTERNAL_API */
2470 
2471 U_NAMESPACE_END
2472 
2473 #endif /* #if !UCONFIG_NO_FORMATTING */
2474 
2475 #endif /* U_SHOW_CPLUSPLUS_API */
2476 
2477 #endif // _CALENDAR
UCalendarDateFields
Possible fields in a UCalendar.
Definition: ucal.h:202
C API: Calendar.
UDate internalGetTime(void) const
Get the current time without recomputing.
Definition: calendar.h:1824
Calendar is an abstract base class for converting between a UDate object and a set of integer fields ...
Definition: calendar.h:189
C++ API: TimeZone object.
double UDate
Date and Time data type.
Definition: utypes.h:203
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
int32_t internalGet(EDateFields field) const
Gets the value for a given time field.
Definition: calendar.h:1467
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
C API: Miscellaneous definitions.
#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
Base class for 'pure' C++ implementations of uenum api.
Definition: strenum.h:61
EMonths
Useful constants for month.
Definition: calendar.h:257
TimeZone represents a time zone offset, and also figures out daylight savings.
Definition: timezone.h:133
UCalendarWeekdayType
Weekday types, as returned by ucal_getDayOfWeekType().
Definition: ucal.h:1399
ELimitType
Limit enums.
Definition: calendar.h:1530
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:301
UCalendarWallTimeOption
Options for handling ambiguous wall time at time zone offset transitions.
Definition: ucal.h:965
UBool fAreAllFieldsSet
True if all of the fields have been set.
Definition: calendar.h:1807
UBool fIsTimeSet
The flag which indicates if the current time is set in the calendar.
Definition: calendar.h:1788
UCalendarDaysOfWeek
Useful constant for days of week.
Definition: ucal.h:476
int32_t internalGet(UCalendarDateFields field, int32_t defaultValue) const
Gets the value for a given time field.
Definition: calendar.h:1481
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
EAmpm
Useful constants for hour in 12-hour clock.
Definition: calendar.h:277
int32_t getGregorianYear() const
Return the extended year on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1898
void setTime(UDate date, UErrorCode &status)
Sets this Calendar's current time with the given UDate.
Definition: calendar.h:443
BasicTimeZone is an abstract class extending TimeZone.
Definition: basictz.h:38
int32_t getGregorianDayOfMonth() const
Return the day of month (1-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1925
EDaysOfWeek
Useful constant for days of week.
Definition: calendar.h:243
UDate getTime(UErrorCode &status) const
Gets this Calendar's time as milliseconds.
Definition: calendar.h:431
C++ API: Common ICU base class UObject.
const void * URegistryKey
Opaque type returned by registerInstance, registerFactory and unregister for service registration...
Definition: umisc.h:57
int32_t getGregorianDayOfYear() const
Return the day of year (1-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1916
int32_t getGregorianMonth() const
Return the month (0-based) on the Gregorian calendar as computed by computeGregorianFields().
Definition: calendar.h:1907
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
Definition: uloc.h:338
UBool fAreFieldsVirtuallySet
True if all fields have been virtually set, but have not yet been computed.
Definition: calendar.h:1816
bool operator!=(const Calendar &that) const
Compares the inequality of two Calendar objects.
Definition: calendar.h:466
C++ API: Locale ID object.
EDateFields
Field IDs for date and time.
Definition: calendar.h:198
void internalSetTime(UDate time)
Set the current time without affecting flags or fields.
Definition: calendar.h:1833
Basic definitions for ICU, for both C and C++ APIs.
One more than the highest normal UCalendarDateFields value.
Definition: ucal.h:452
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
int32_t UFieldResolutionTable[12][8]
Definition: calendar.h:48
int32_t internalGet(UCalendarDateFields field) const
Gets the value for a given time field.
Definition: calendar.h:1491
UBool fAreFieldsSet
True if the fields are in sync with the currently set time of this Calendar.
Definition: calendar.h:1800
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:195