32 #if U_SHOW_CPLUSPLUS_API
38 #if !UCONFIG_NO_FORMATTING
48 class ICUServiceFactory;
191 #ifndef U_FORCE_HIDE_DEPRECATED_API
199 #ifndef U_HIDE_DEPRECATED_API
214 DAY_OF_WEEK_IN_MONTH,
234 #endif // U_FORCE_HIDE_DEPRECATED_API
236 #ifndef U_HIDE_DEPRECATED_API
295 virtual Calendar* clone()
const = 0;
387 static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
416 static UDate U_EXPORT2 getNow(
void);
526 #ifndef U_FORCE_HIDE_DEPRECATED_API
547 virtual void add(EDateFields field, int32_t amount,
UErrorCode& status);
548 #endif // U_FORCE_HIDE_DEPRECATED_API
572 #ifndef U_HIDE_DEPRECATED_API
642 #ifndef U_FORCE_HIDE_DEPRECATED_API
674 virtual void roll(EDateFields field, int32_t amount,
UErrorCode& status);
675 #endif // U_FORCE_HIDE_DEPRECATED_API
710 #ifndef U_FORCE_HIDE_DEPRECATED_API
766 virtual int32_t fieldDifference(
UDate when, EDateFields field,
UErrorCode& status);
767 #endif // U_FORCE_HIDE_DEPRECATED_API
834 void adoptTimeZone(
TimeZone* value);
843 void setTimeZone(
const TimeZone& zone);
853 const TimeZone& getTimeZone(
void)
const;
887 void setLenient(
UBool lenient);
895 UBool isLenient(
void)
const;
973 #ifndef U_HIDE_DEPRECATED_API
980 EDaysOfWeek getFirstDayOfWeek(
void)
const;
1001 void setMinimalDaysInFirstWeek(uint8_t value);
1012 uint8_t getMinimalDaysInFirstWeek(
void)
const;
1014 #ifndef U_FORCE_HIDE_DEPRECATED_API
1023 virtual int32_t getMinimum(EDateFields field)
const;
1024 #endif // U_FORCE_HIDE_DEPRECATED_API
1036 #ifndef U_FORCE_HIDE_DEPRECATED_API
1045 virtual int32_t getMaximum(EDateFields field)
const;
1046 #endif // U_FORCE_HIDE_DEPRECATED_API
1058 #ifndef U_FORCE_HIDE_DEPRECATED_API
1067 virtual int32_t getGreatestMinimum(EDateFields field)
const;
1068 #endif // U_FORCE_HIDE_DEPRECATED_API
1080 #ifndef U_FORCE_HIDE_DEPRECATED_API
1089 virtual int32_t getLeastMaximum(EDateFields field)
const;
1090 #endif // U_FORCE_HIDE_DEPRECATED_API
1102 #ifndef U_HIDE_DEPRECATED_API
1117 int32_t getActualMinimum(EDateFields field,
UErrorCode& status)
const;
1198 void set(int32_t year, int32_t month, int32_t date);
1212 void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute);
1227 void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second);
1296 virtual const char * getType()
const = 0;
1350 virtual UBool isWeekend(
void)
const;
1411 virtual void computeTime(
UErrorCode& status);
1424 virtual void computeFields(
UErrorCode& status);
1435 double getTimeInMillis(
UErrorCode& status)
const;
1445 void setTimeInMillis(
double millis,
UErrorCode& status );
1458 #ifndef U_HIDE_DEPRECATED_API
1470 #ifndef U_HIDE_INTERNAL_API
1494 #ifndef U_HIDE_DEPRECATED_API
1504 void internalSet(EDateFields field, int32_t value);
1531 #ifndef U_HIDE_INTERNAL_API
1532 UCAL_LIMIT_MINIMUM = 0,
1533 UCAL_LIMIT_GREATEST_MINIMUM,
1534 UCAL_LIMIT_LEAST_MAXIMUM,
1561 virtual int32_t handleGetLimit(
UCalendarDateFields field, ELimitType limitType)
const = 0;
1586 virtual int32_t handleComputeMonthStart(int32_t eyear, int32_t month,
1587 UBool useMonth)
const = 0;
1596 virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month)
const ;
1605 virtual int32_t handleGetYearLength(int32_t eyear)
const;
1616 virtual int32_t handleGetExtendedYear() = 0;
1636 virtual int32_t handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy);
1646 #ifndef U_HIDE_INTERNAL_API
1653 int32_t computeJulianDay();
1662 double computeMillisInDay();
1673 int32_t computeZoneOffset(
double millis,
double millisInDay,
UErrorCode &ec);
1692 static constexpr int32_t kResolveSTOP = -1;
1702 static constexpr int32_t kResolveRemap = 32;
1761 #ifndef U_HIDE_INTERNAL_API
1841 #ifndef U_FORCE_HIDE_DEPRECATED_API
1847 #endif // U_FORCE_HIDE_DEPRECATED_API
1890 virtual void handleComputeFields(int32_t julianDay,
UErrorCode &status);
1892 #ifndef U_HIDE_INTERNAL_API
1899 return fGregorianYear;
1908 return fGregorianMonth;
1917 return fGregorianDayOfYear;
1926 return fGregorianDayOfMonth;
1936 virtual int32_t getDefaultMonthInYear(int32_t eyear) ;
1946 virtual int32_t getDefaultDayInMonth(int32_t eyear, int32_t month);
2027 int32_t weekNumber(int32_t desiredDay, int32_t dayOfPeriod, int32_t dayOfWeek);
2030 #ifndef U_HIDE_INTERNAL_API
2061 inline int32_t weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek);
2067 int32_t getLocalDOW();
2081 void recalculateStamp();
2120 uint8_t fMinimalDaysInFirstWeek;
2122 int32_t fWeekendOnsetMillis;
2124 int32_t fWeekendCeaseMillis;
2136 void setWeekData(
const Locale& desiredLocale,
const char *type,
UErrorCode& success);
2154 int32_t fGregorianYear;
2161 int32_t fGregorianMonth;
2168 int32_t fGregorianDayOfYear;
2175 int32_t fGregorianDayOfMonth;
2185 void computeGregorianAndDOWFields(int32_t julianDay,
UErrorCode &ec);
2196 void computeGregorianFields(int32_t julianDay,
UErrorCode &ec);
2242 #ifndef U_HIDE_INTERNAL_API
2252 static uint8_t julianDayToDayOfWeek(
double julian);
2260 #if !UCONFIG_NO_SERVICE
2265 #ifndef U_HIDE_INTERNAL_API
2311 friend class CalendarFactory;
2317 friend class CalendarService;
2323 friend class DefaultCalendarFactory;
2330 virtual UBool haveDefaultCentury()
const = 0;
2336 virtual UDate defaultCenturyStart()
const = 0;
2341 virtual int32_t defaultCenturyStartYear()
const = 0;
2356 virtual int32_t getRelatedYear(
UErrorCode &status)
const;
2363 virtual void setRelatedYear(int32_t year);
2365 #ifndef U_HIDE_INTERNAL_API
2392 #ifndef U_HIDE_INTERNAL_API
2401 static Calendar * U_EXPORT2 makeInstance(
2414 static void U_EXPORT2 getCalendarTypeFromLocale(
2417 int32_t typeBufferSize,
2428 return createInstance(zone, Locale::getDefault(), errorCode);
2436 roll(field, (int32_t)(up ? +1 : -1), status);
2439 #ifndef U_HIDE_DEPRECATED_API
2458 fFields[field] = value;
2459 fStamp[field] = kInternallySet;
2460 fIsSet[field] =
true;
2464 #ifndef U_HIDE_INTERNAL_API
2465 inline int32_t Calendar::weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek)
2467 return weekNumber(dayOfPeriod, dayOfPeriod, dayOfWeek);
UCalendarDateFields
Possible fields in a UCalendar.
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
Calendar is an abstract base class for converting between a UDate object and a set of integer fields ...
C++ API: TimeZone object.
double UDate
Date and Time data type.
bool operator!=(const Calendar &that) const
Compares the inequality of two Calendar objects.
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
C API: Miscellaneous definitions.
int32_t internalGet(UCalendarDateFields field) const
Gets the value for a given time field.
#define ULOC_FULLNAME_CAPACITY
Useful constant for the maximum size of the whole locale ID (including the terminating NULL and all k...
Base class for 'pure' C++ implementations of uenum api.
EMonths
Useful constants for month.
TimeZone represents a time zone offset, and also figures out daylight savings.
UCalendarWeekdayType
Weekday types, as returned by ucal_getDayOfWeekType().
int32_t getGregorianDayOfMonth() const
Return the day of month (1-based) on the Gregorian calendar as computed by computeGregorianFields().
int32_t internalGet(UCalendarDateFields field, int32_t defaultValue) const
Gets the value for a given time field.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
UCalendarWallTimeOption
Options for handling ambiguous wall time at time zone offset transitions.
UBool fAreAllFieldsSet
True if all of the fields have been set.
UBool fIsTimeSet
The flag which indicates if the current time is set in the calendar.
int32_t getGregorianMonth() const
Return the month (0-based) on the Gregorian calendar as computed by computeGregorianFields().
UCalendarDaysOfWeek
Useful constant for days of week.
int32_t getGregorianYear() const
Return the extended year on the Gregorian calendar as computed by computeGregorianFields().
EAmpm
Useful constants for hour in 12-hour clock.
void setTime(UDate date, UErrorCode &status)
Sets this Calendar's current time with the given UDate.
BasicTimeZone is an abstract class extending TimeZone.
EDaysOfWeek
Useful constant for days of week.
int32_t getGregorianDayOfYear() const
Return the day of year (1-based) on the Gregorian calendar as computed by computeGregorianFields().
UDate getTime(UErrorCode &status) const
Gets this Calendar's time as milliseconds.
C++ API: Common ICU base class UObject.
const void * URegistryKey
Opaque type returned by registerInstance, registerFactory and unregister for service registration...
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
UBool fAreFieldsVirtuallySet
True if all fields have been virtually set, but have not yet been computed.
C++ API: Locale ID object.
int32_t internalGet(EDateFields field) const
Gets the value for a given time field.
EDateFields
Field IDs for date and time.
void internalSetTime(UDate time)
Set the current time without affecting flags or fields.
Basic definitions for ICU, for both C and C++ APIs.
One more than the highest normal UCalendarDateFields value.
UObject is the common ICU "boilerplate" class.
int32_t UFieldResolutionTable[12][8]
UBool fAreFieldsSet
True if the fields are in sync with the currently set time of this Calendar.
int8_t UBool
The ICU boolean type, a signed-byte integer.
UDate internalGetTime(void) const
Get the current time without recomputing.
A Locale object represents a specific geographical, political, or cultural region.