32 #if U_SHOW_CPLUSPLUS_API
38 #if !UCONFIG_NO_FORMATTING
48 class ICUServiceFactory;
192 #ifndef U_FORCE_HIDE_DEPRECATED_API
200 #ifndef U_HIDE_DEPRECATED_API
215 DAY_OF_WEEK_IN_MONTH,
235 #endif // U_FORCE_HIDE_DEPRECATED_API
237 #ifndef U_HIDE_DEPRECATED_API
296 virtual Calendar* clone()
const = 0;
388 static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
417 static UDate U_EXPORT2 getNow();
527 #ifndef U_FORCE_HIDE_DEPRECATED_API
548 virtual void add(EDateFields field, int32_t amount,
UErrorCode& status);
549 #endif // U_FORCE_HIDE_DEPRECATED_API
573 #ifndef U_HIDE_DEPRECATED_API
643 #ifndef U_FORCE_HIDE_DEPRECATED_API
675 virtual void roll(EDateFields field, int32_t amount,
UErrorCode& status);
676 #endif // U_FORCE_HIDE_DEPRECATED_API
711 #ifndef U_FORCE_HIDE_DEPRECATED_API
767 virtual int32_t fieldDifference(
UDate when, EDateFields field,
UErrorCode& status);
768 #endif // U_FORCE_HIDE_DEPRECATED_API
835 void adoptTimeZone(
TimeZone* value);
844 void setTimeZone(
const TimeZone& zone);
854 const TimeZone& getTimeZone()
const;
888 void setLenient(
UBool lenient);
896 UBool isLenient()
const;
974 #ifndef U_HIDE_DEPRECATED_API
981 EDaysOfWeek getFirstDayOfWeek()
const;
1002 void setMinimalDaysInFirstWeek(uint8_t value);
1013 uint8_t getMinimalDaysInFirstWeek()
const;
1015 #ifndef U_FORCE_HIDE_DEPRECATED_API
1024 virtual int32_t getMinimum(EDateFields field)
const;
1025 #endif // U_FORCE_HIDE_DEPRECATED_API
1037 #ifndef U_FORCE_HIDE_DEPRECATED_API
1046 virtual int32_t getMaximum(EDateFields field)
const;
1047 #endif // U_FORCE_HIDE_DEPRECATED_API
1059 #ifndef U_FORCE_HIDE_DEPRECATED_API
1068 virtual int32_t getGreatestMinimum(EDateFields field)
const;
1069 #endif // U_FORCE_HIDE_DEPRECATED_API
1081 #ifndef U_FORCE_HIDE_DEPRECATED_API
1090 virtual int32_t getLeastMaximum(EDateFields field)
const;
1091 #endif // U_FORCE_HIDE_DEPRECATED_API
1103 #ifndef U_HIDE_DEPRECATED_API
1118 int32_t getActualMinimum(EDateFields field,
UErrorCode& status)
const;
1199 void set(int32_t year, int32_t month, int32_t date);
1213 void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute);
1228 void set(int32_t year, int32_t month, int32_t date, int32_t hour, int32_t minute, int32_t second);
1298 virtual const char * getType()
const = 0;
1352 virtual UBool isWeekend()
const;
1368 virtual bool inTemporalLeapYear(
UErrorCode& status)
const;
1388 virtual const char* getTemporalMonthCode(
UErrorCode& status)
const;
1409 virtual void setTemporalMonthCode(
const char* temporalMonth,
UErrorCode& status);
1470 virtual void computeTime(
UErrorCode& status);
1483 virtual void computeFields(
UErrorCode& status);
1494 double getTimeInMillis(
UErrorCode& status)
const;
1504 void setTimeInMillis(
double millis,
UErrorCode& status );
1517 #ifndef U_HIDE_DEPRECATED_API
1529 #ifndef U_HIDE_INTERNAL_API
1569 virtual int32_t internalGetMonth(
UErrorCode& status)
const;
1584 virtual int32_t internalGetMonth(int32_t defaultValue,
UErrorCode& status)
const;
1586 #ifndef U_HIDE_DEPRECATED_API
1596 void internalSet(EDateFields field, int32_t value);
1623 #ifndef U_HIDE_INTERNAL_API
1624 UCAL_LIMIT_MINIMUM = 0,
1625 UCAL_LIMIT_GREATEST_MINIMUM,
1626 UCAL_LIMIT_LEAST_MAXIMUM,
1653 virtual int32_t handleGetLimit(
UCalendarDateFields field, ELimitType limitType)
const = 0;
1679 virtual int64_t handleComputeMonthStart(int32_t eyear, int32_t month,
1689 virtual int32_t handleGetMonthLength(int32_t extendedYear, int32_t month,
UErrorCode& status)
const ;
1698 virtual int32_t handleGetYearLength(int32_t eyear,
UErrorCode& status)
const;
1709 virtual int32_t handleGetExtendedYear(
UErrorCode& status) = 0;
1730 virtual int32_t handleGetExtendedYearFromWeekFields(int32_t yearWoy, int32_t woy,
UErrorCode& status);
1740 #ifndef U_HIDE_INTERNAL_API
1748 int32_t computeJulianDay(
UErrorCode &status);
1757 double computeMillisInDay();
1768 int32_t computeZoneOffset(
double millis,
double millisInDay,
UErrorCode &ec);
1787 static constexpr int32_t kResolveSTOP = -1;
1797 static constexpr int32_t kResolveRemap = 32;
1863 #ifndef U_HIDE_INTERNAL_API
1951 virtual void handleComputeFields(int32_t julianDay,
UErrorCode &status);
1953 #ifndef U_HIDE_INTERNAL_API
1960 return fGregorianYear;
1969 return fGregorianMonth;
1978 return fGregorianDayOfYear;
1987 return fGregorianDayOfMonth;
1999 virtual int32_t getDefaultMonthInYear(int32_t eyear,
UErrorCode& status);
2011 virtual int32_t getDefaultDayInMonth(int32_t eyear, int32_t month,
UErrorCode& status);
2092 int32_t weekNumber(int32_t desiredDay, int32_t dayOfPeriod, int32_t dayOfWeek);
2095 #ifndef U_HIDE_INTERNAL_API
2126 inline int32_t weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek);
2140 int8_t fNextStamp = kMinimumUserStamp;
2146 void recalculateStamp();
2173 bool fAreFieldsSet:1;
2179 bool fAreAllFieldsSet:1;
2187 bool fAreFieldsVirtuallySet:1;
2220 uint8_t fMinimalDaysInFirstWeek;
2221 int32_t fWeekendOnsetMillis;
2222 int32_t fWeekendCeaseMillis;
2234 void setWeekData(
const Locale& desiredLocale,
const char *type,
UErrorCode& success);
2252 int32_t fGregorianYear;
2259 int8_t fGregorianMonth;
2266 int8_t fGregorianDayOfMonth;
2273 int16_t fGregorianDayOfYear;
2286 void computeGregorianFields(int32_t julianDay,
UErrorCode &ec);
2332 #ifndef U_HIDE_INTERNAL_API
2342 static uint8_t julianDayToDayOfWeek(int32_t julian);
2346 CharString* validLocale =
nullptr;
2347 CharString* actualLocale =
nullptr;
2350 #if !UCONFIG_NO_SERVICE
2355 #ifndef U_HIDE_INTERNAL_API
2401 friend class CalendarFactory;
2407 friend class CalendarService;
2413 friend class DefaultCalendarFactory;
2420 virtual UBool haveDefaultCentury()
const = 0;
2426 virtual UDate defaultCenturyStart()
const = 0;
2431 virtual int32_t defaultCenturyStartYear()
const = 0;
2446 virtual int32_t getRelatedYear(
UErrorCode &status)
const;
2453 virtual void setRelatedYear(int32_t year);
2455 #ifndef U_HIDE_INTERNAL_API
2482 #ifndef U_HIDE_INTERNAL_API
2491 static Calendar * U_EXPORT2 makeInstance(
2504 static void U_EXPORT2 getCalendarTypeFromLocale(
2507 int32_t typeBufferSize,
2518 return createInstance(zone, Locale::getDefault(), errorCode);
2526 roll(field, static_cast<int32_t>(up ? +1 : -1), status);
2529 #ifndef U_HIDE_DEPRECATED_API
2533 roll(static_cast<UCalendarDateFields>(field), up, status);
2548 fFields[field] = value;
2549 fStamp[field] = kInternallySet;
2558 #define DECLARE_OVERRIDE_SYSTEM_DEFAULT_CENTURY \
2559 virtual UBool haveDefaultCentury() const override; \
2560 virtual UDate defaultCenturyStart() const override; \
2561 virtual int32_t defaultCenturyStartYear() const override;
2563 #ifndef U_HIDE_INTERNAL_API
2564 inline int32_t Calendar::weekNumber(int32_t dayOfPeriod, int32_t dayOfWeek)
2566 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.
UDate internalGetTime() const
Get the current time without recomputing.
C API: Miscellaneous definitions.
int32_t internalGet(UCalendarDateFields field) const
Gets the value for a given time field.
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.
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...
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.
virtual bool isEra0CountingBackward() const
The year in this calendar is counting from 1 backward if the era is 0.
One more than the highest normal UCalendarDateFields value.
UObject is the common ICU "boilerplate" class.
int32_t UFieldResolutionTable[12][8]
int8_t UBool
The ICU boolean type, a signed-byte integer.
A Locale object represents a specific geographical, political, or cultural region.