CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
gregorian_calendar.h
1
2#pragma once
3
4#include <system/globalization/calendar.h>
5#include <system/globalization/gregorian_calendar_types.h>
6#include <system/details/icu_namespace.h>
7
8#ifdef ASPOSECPPLIB_BEING_BUILT
9#include <unicode/calendar.h>
10#endif
11
13ASPOSECPP_3RD_PARTY_ICU_NAMESPACE_START {
15 ASPOSECPP_3RD_PARTY_CLASS(Calendar);
16}
17
18namespace System { namespace Globalization {
19
20class GregorianCalendar;
23
28class ASPOSECPP_SHARED_CLASS GregorianCalendar : public Calendar
29{
31 RTTI_INFO(System::Globalization::GregorianCalendar, ::System::BaseTypesInfo<System::Globalization::Calendar>)
32
33public:
42
44 static constexpr int ADEra = 1;
45
49
52 virtual ASPOSECPP_SHARED_API GregorianCalendarTypes get_CalendarType() const;
53
56 virtual ASPOSECPP_SHARED_API void set_CalendarType(GregorianCalendarTypes value);
57
58 ASPOSECPP_SHARED_API CalendarAlgorithmType get_AlgorithmType() const override;
59 ASPOSECPP_SHARED_API DateTime get_MinSupportedDateTime() const override;
60 ASPOSECPP_SHARED_API DateTime get_MaxSupportedDateTime() const override;
61 ASPOSECPP_SHARED_API ArrayPtr<int> get_Eras() const override;
62 ASPOSECPP_SHARED_API int GetMonthsInYear(int year, int era) const override;
63 ASPOSECPP_SHARED_API int GetDaysInYear(int year, int era) const override;
64 ASPOSECPP_SHARED_API int GetDaysInMonth(int year, int month, int era) const override;
65 ASPOSECPP_SHARED_API int GetDayOfYear(DateTime time) const override;
66 ASPOSECPP_SHARED_API DayOfWeek GetDayOfWeek(DateTime time) const override;
67 ASPOSECPP_SHARED_API int GetEra(DateTime time) const override;
68 ASPOSECPP_SHARED_API int GetYear(DateTime time) const override;
69 ASPOSECPP_SHARED_API int GetMonth(DateTime time) const override;
70 ASPOSECPP_SHARED_API int GetDayOfMonth(DateTime time) const override;
71 ASPOSECPP_SHARED_API int GetLeapMonth(int year, int era) const override;
72 ASPOSECPP_SHARED_API bool IsLeapYear(int year, int era) const override;
73 ASPOSECPP_SHARED_API bool IsLeapMonth(int year, int month, int era) const override;
74 ASPOSECPP_SHARED_API bool IsLeapDay(int year, int month, int day, int era) const override;
75 ASPOSECPP_SHARED_API DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) const override;
76
77 ASPOSECPP_SHARED_API SharedPtr<Object> Clone() override;
78
80 static ASPOSECPP_SHARED_API CalendarPtr GetDefaultInstance();
81
82protected:
83 Details::CalendarId get_ID() const override;
84 bool IsGregorianBasedCalendar() const override;
85
86private:
89
90 void VerifyYear(int year, int era) const override;
91 void VerifyMonth(int year, int month, int era) const override;
92 void VerifyDate(int year, int month, int day, int era) const override;
93
94 int EraToIcuEra(int era) const override;
95 int IcuEraToEra(int icu_era) const override;
96};
97
98}} // namespace System::Globalization
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
virtual int GetDaysInMonth(int year, int month) const
Gets number of days in specific month.
virtual int GetLeapMonth(int year) const
Gets the leap month for the specified year.
virtual bool IsLeapDay(int year, int month, int day) const
Checks if the day is leap.
virtual int GetMonthsInYear(int year) const
Gets number of months in the specified year.
virtual int GetDaysInYear(int year) const
Gets number of days in specific year.
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.
virtual bool IsLeapYear(int year) const
Checks if the year is leap.
Gregorian calendar. Objects of this class should only be allocated using System::MakeObject() functio...
Definition: gregorian_calendar.h:29
virtual void set_CalendarType(GregorianCalendarTypes value)
Sets Gregorian calendar type.
CalendarAlgorithmType get_AlgorithmType() const override
Gets algorithm type.
int GetMonth(DateTime time) const override
Gets month for the specified time point.
bool IsLeapMonth(int year, int month, int era) const override
Checks if the month is leap.
bool IsLeapDay(int year, int month, int day, int era) const override
Checks if the day is leap.
virtual GregorianCalendarTypes get_CalendarType() const
Gets Gregorian calendar type.
SharedPtr< Object > Clone() override
Creates a copy of the current object and returns a shared pointer to it.
DateTime get_MinSupportedDateTime() const override
Minimal point in time that is supported by the calendar.
DateTime get_MaxSupportedDateTime() const override
Maximal point in time that is supported by the calendar.
int GetLeapMonth(int year, int era) const override
Gets the leap month for the specified year.
DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) const override
Constructs DateTime object from components.
bool IsGregorianBasedCalendar() const override
Checks if the calendar is Gregorian-based.
bool IsLeapYear(int year, int era) const override
Checks if the year is leap.
int GetDayOfYear(DateTime time) const override
Gets day of year for the specified time point.
static CalendarPtr GetDefaultInstance()
Gets default gregorian calendar instance.
int GetDaysInMonth(int year, int month, int era) const override
Gets number of days in specific month.
DayOfWeek GetDayOfWeek(DateTime time) const override
Gets day of week for the specified time point.
int GetMonthsInYear(int year, int era) const override
Gets number of months in the specified year.
GregorianCalendar(GregorianCalendarTypes type=GregorianCalendarTypes::Localized)
Constructs specific gregorian calendar.
ArrayPtr< int > get_Eras() const override
Gets list of eras existing in calendar.
int GetDayOfMonth(DateTime time) const override
Gets day of month for the specified time point.
int GetDaysInYear(int year, int era) const override
Gets number of days in specific year.
Details::CalendarId get_ID() const override
Gets calendar identifier.
int GetYear(DateTime time) const override
Gets year for the specified time point.
int GetEra(DateTime time) const override
Gets era for the specified time point.
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
GregorianCalendarTypes
Types of gregorian calendars.
Definition: gregorian_calendar_types.h:12
@ Localized
Locale-specific gregorian calendar.
SharedPtr< GregorianCalendar > GregorianCalendarPtr
GregorianCalendar pointer type.
Definition: gregorian_calendar.h:22
CalendarAlgorithmType
Calendar type.
Definition: calendar_algorithm_type.h:10
Definition: db_command.h:9
DayOfWeek
Enumeration that represents a day of week.
Definition: day_of_week.h:11