6#include <system/object.h>
7#include <system/array.h>
8#include <system/date_time.h>
9#include <system/icloneable.h>
10#include <system/globalization/calendar_algorithm_type.h>
11#include <system/globalization/calendar_week_rule.h>
12#include <system/globalization/details/calendar_id.h>
13#include <system/details/icu_namespace.h>
14#include <system/details/lock_context.h>
16#ifdef ASPOSECPPLIB_BEING_BUILT
17#include <unicode/calendar.h>
21ASPOSECPP_3RD_PARTY_ICU_NAMESPACE_START {
23 ASPOSECPP_3RD_PARTY_CLASS(Calendar);
26namespace System {
namespace Globalization {
120 virtual ASPOSECPP_SHARED_API
int GetDaysInMonth(
int year,
int month,
int era)
const;
146 virtual ASPOSECPP_SHARED_API
int GetLeapMonth(
int year,
int era)
const = 0;
188 virtual ASPOSECPP_SHARED_API
bool IsLeapDay(
int year,
int month,
int day)
const;
195 virtual ASPOSECPP_SHARED_API
bool IsLeapDay(
int year,
int month,
int day,
int era)
const = 0;
200 virtual ASPOSECPP_SHARED_API
bool IsLeapMonth(
int year,
int month)
const;
206 virtual ASPOSECPP_SHARED_API
bool IsLeapMonth(
int year,
int month,
int era)
const;
210 virtual ASPOSECPP_SHARED_API
bool IsLeapYear(
int year)
const;
215 virtual ASPOSECPP_SHARED_API
bool IsLeapYear(
int year,
int era)
const = 0;
226 virtual ASPOSECPP_SHARED_API
DateTime ToDateTime(
int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond)
const;
237 virtual ASPOSECPP_SHARED_API
DateTime ToDateTime(
int year,
int month,
int day,
int hour,
int minute,
int second,
int millisecond,
int era)
const;
257 bool IsValidDay(
int year,
int month,
int day,
int era)
const;
276 static constexpr int CurrentEra = 0;
282 Calendar(std::unique_ptr<codeporting_icu::Calendar>&& calendar);
295 virtual void VerifyDate(
int year,
int month,
int day,
int era)
const;
298 void VerifyTime(
int hour,
int minute,
int second,
int millisecond)
const;
336 const std::unique_ptr<codeporting_icu::Calendar> m_calendar;
339 bool m_is_read_only =
false;
341 bool m_use_extended_year =
false;
343 int m_year_offset = 0;
345 int m_two_digit_year_max = 0;
347 int m_date_adjustment = 0;
350 struct DateTimeFields;
353 codeporting_icu::Calendar& GetCalendar(
const LockContext&)
const;
356 Object* GetLockable()
const;
365 void SetDateTime(
DateTime time,
const LockContext&)
const;
368 void SetDateTime(
const DateTimeFields& time,
const LockContext&)
const;
371 void VerifyField(
int field,
int value,
const char16_t* field_name,
const LockContext&)
const;
378 int GetDateTimeField(
DateTime time,
int field,
const char16_t* field_name)
const;
385 int GetMaximumForDateTimeField(
const DateTimeFields& time,
int field,
const char16_t* field_name)
const;
393 DateTime AddValueToDateTimeField(
DateTime time,
int field,
int value,
const char16_t* field_name)
const;
396 [[noreturn]]
void ResultOutOfRange()
const;
Represents a specific date and time value on the time continuum. This type should be allocated on sta...
Definition: date_time.h:50
Calendar which defines how the dates are handled, calculated, formatted, etc. Setter operations are o...
Definition: calendar.h:38
void SetTwoDigitYearMaxInternal(int year)
Sets the last year that can be represented by a 2-digit.
void VerifyDateTimeRange(DateTime time) const
Verify time value.
virtual int get_TwoDigitYearMax() const
Gets the last year that can be represented by a 2-digit.
Calendar(std::unique_ptr< codeporting_icu::Calendar > &&calendar)
Constructor.
virtual bool IsLeapDay(int year, int month, int day, int era) const =0
Checks if the day is leap.
virtual int EraToIcuEra(int era) const
Convert Framework era value to ICU era format.
virtual DateTime AddWeeks(DateTime time, int weeks) const
Adds weeks to time point.
void VerifyTime(int hour, int minute, int second, int millisecond) const
Verify hour, minute, second and millisecond values.
bool get_IsReadOnly() const
Checks if the calendar is read only.
virtual DateTime AddMilliseconds(DateTime time, double milliseconds) const
Adds milliseconds to time point.
virtual int IcuEraToEra(int icu_era) const
Convert ICU era value to Framework era format.
virtual int GetDaysInYear(int year, int era) const
Gets number of days in specific year.
virtual DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) const
Constructs DateTime object from components.
virtual int GetMonthsInYear(int year, int era) const
Gets number of months in the specified year.
virtual DateTime get_MinSupportedDateTime() const =0
Minimal point in time that is supported by the calendar.
virtual int GetEra(DateTime time) const
Gets era for the specified time point.
virtual int GetWeekOfYear(DateTime time, CalendarWeekRule rule, DayOfWeek first_day_of_week) const
Gets week of the year for the specified time point.
virtual int GetLeapMonth(int year, int era) const =0
Gets the leap month for the specified year.
virtual void VerifyYear(int year, int era) const
Verify year and era values.
bool IsValidDay(int year, int month, int day, int era) const
Checks year, month, day and era values.
virtual DateTime AddDays(DateTime time, int days) const
Adds days to time point.
Calendar()
Default constructor.
virtual int ToFourDigitYear(int year) const
Converts the year to 4-digit year using TwoDigitYearMax property.
virtual int GetDayOfYear(DateTime time) const
Gets day of year for the specified time point.
virtual void VerifyDate(int year, int month, int day, int era) const
Verify year, month, day and era values.
virtual void VerifyMonth(int year, int month, int era) const
Verify year, month and era values.
virtual bool IsGregorianBasedCalendar() const
Checks if the calendar is Gregorian-based.
virtual int GetMonth(DateTime time) const
Gets month for the specified time point.
virtual int GetDaysInMonth(int year, int month) const
Gets number of days in specific month.
virtual int GetYear(DateTime time) const
Gets year for the specified time point.
virtual int GetMinute(DateTime time) const
Gets minutes for the specified time point.
void VerifyWriteable() const
Verify that calendar is not read-only.
virtual double GetMilliseconds(DateTime time) const
Gets milliseconds for the specified time point.
virtual bool IsLeapYear(int year, int era) const =0
Checks if the year is leap.
virtual DayOfWeek GetDayOfWeek(DateTime time) const
Gets day of week for the specified time point.
virtual DateTime AddSeconds(DateTime time, int seconds) const
Adds seconds to time point.
virtual DateTime AddMinutes(DateTime time, int minutes) const
Adds minutes to time point.
virtual int GetHour(DateTime time) const
Gets hours for the specified time point.
virtual DateTime AddHours(DateTime time, int hours) const
Adds hours to time point.
virtual int GetLeapMonth(int year) const
Gets the leap month for the specified year.
virtual void set_TwoDigitYearMax(int value)
Sets the last year that can be represented by a 2-digit.
int GetYearInternal(DateTime time) const
Gets year (UCAL_YEAR) for the specified time point.
virtual bool IsLeapDay(int year, int month, int day) const
Checks if the day is leap.
void UseExtendedYearField()
Use the UCAL_EXTENDED_YEAR field instead of the UCAL_YEAR field. Must be set for the ChineseLunisolar...
virtual int GetMonthsInYear(int year) const
Gets number of months in the specified year.
virtual DateTime AddYears(DateTime time, int years) const
Adds years to time point.
DateTime ToDateTimeInternal(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) const
Constructs DateTime object from components.
virtual bool IsLeapMonth(int year, int month, int era) const
Checks if the month is leap.
virtual CalendarAlgorithmType get_AlgorithmType() const =0
Gets algorithm type.
Calendar & operator=(const Calendar &)=delete
int GetDaysInMonthInternal(int year, int month, int era) const
Gets days in month (UCAL_DAY_OF_MONTH) for the specified year, month and era.
virtual int GetDaysInYear(int year) const
Gets number of days in specific year.
virtual int GetDaysInMonth(int year, int month, int era) const
Gets number of days in specific month.
void SetDateAdjustment(int date_adjustment)
Sets the number of days to add or subtract from the calendar.
virtual bool IsLeapMonth(int year, int month) const
Checks if the month is leap.
virtual DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond) const
Constructs DateTime object from components.
Calendar(const Calendar &)=delete
RTTI information.
static CalendarPtr ReadOnly(const CalendarPtr &calendar)
Gets read only version of calendar.
int get_CurrentEra() const
Gets index of current era.
int get_CurrentEraValue() const
Gets value of current era.
void SetYearOffset(int year_offset)
Set year offset. result_year = icu_year + year_offset.
virtual DateTime AddMonths(DateTime time, int months) const
Adds months to time point.
virtual DateTime get_MaxSupportedDateTime() const =0
Maximal point in time that is supported by the calendar.
virtual int GetSecond(DateTime time) const
Gets seconds for the specified time point.
virtual ArrayPtr< int > get_Eras() const =0
Gets list of eras existing in calendar.
virtual bool IsLeapYear(int year) const
Checks if the year is leap.
virtual Details::CalendarId get_ID() const
Gets calendar identifier.
virtual int GetDayOfMonth(DateTime time) const
Gets day of month for the specified time point.
Defies a method that enables object cloning - creating a copy of an object. Objects of this class sho...
Definition: icloneable.h:16
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
CalendarId
Identifiers of known calendars.
Definition: calendar_id.h:8
CalendarAlgorithmType
Calendar type.
Definition: calendar_algorithm_type.h:10
CalendarWeekRule
How to determine first week of the year.
Definition: calendar_week_rule.h:11
SharedPtr< Calendar > CalendarPtr
Calendar pointer type.
Definition: calendar.h:30
Definition: db_command.h:9
DateTimeKind
Enumeration values of which represent the kinds of date and time.
Definition: date_time_kind.h:10
DayOfWeek
Enumeration that represents a day of week.
Definition: day_of_week.h:11