MT Core (C++)
Core library for replacing C++ standard in project usage
|
Represents a date without a time component. More...
#include <core.hpp>
Public Types | |
using | CalendarSystem = Calendar |
Public Member Functions | |
CalDate ()=default | |
CalDate (const CalDate &)=default | |
CalDate (CalDate &&)=default | |
CalDate & | operator= (const CalDate &)=default |
CalDate & | operator= (CalDate &&)=default |
CalDate (const Calendar &c) | |
template<typename... Args> | |
constexpr CalDate & | init (Args... args) |
template<IsDayCalendarSystem Other> | |
constexpr | operator CalDate< Other > () const |
template<IsDayCalendarSystem Other> | |
constexpr auto | operator<=> (const CalDate< Other > &o) const |
Compares dates between two different calendar systems. | |
template<IsDayCalendarSystem Other> | |
constexpr auto | operator== (const CalDate< Other > &o) const -> bool |
template<IsDayCalendarSystem Other> | |
constexpr auto | operator!= (const CalDate< Other > &o) const -> bool |
template<IsDayCalendarSystem Other> | |
constexpr auto | operator<= (const CalDate< Other > &o) const -> bool |
template<IsDayCalendarSystem Other> | |
constexpr auto | operator>= (const CalDate< Other > &o) const -> bool |
template<IsDayCalendarSystem Other> | |
constexpr auto | operator< (const CalDate< Other > &o) const -> bool |
template<IsDayCalendarSystem Other> | |
constexpr auto | operator> (const CalDate< Other > &o) const -> bool |
constexpr CalDate | nearest_valid () const |
Moves the date to the nearest valid date. | |
constexpr bool | is_valid () const |
Checks that a date is valid. | |
constexpr DayOfWeek | day_of_week () const |
Gets the day of week for a calendar. | |
constexpr CalDate | add_days (const i32 days) const |
Adds days to a date. | |
constexpr CalDate | sub_days (const i32 days) const |
Subtracts days from a date. | |
template<IsDayCalendarSystem Other> | |
constexpr i32 | day_difference (const CalDate< Other > &other) const |
Gets the difference in days between dates. | |
constexpr CalDate | nth_week_day (const i32 n, const DayOfWeek k) const |
Gets the nth day of week. | |
constexpr CalDate | day_of_week_before (const DayOfWeek k) const |
Gets the day of week before current date. | |
constexpr CalDate | day_of_week_after (const DayOfWeek k) const |
Gets the day of week after the current date. | |
constexpr CalDate | day_of_week_nearest (const DayOfWeek k) const |
Gets the day of week nearest to the current date. | |
constexpr CalDate | day_of_week_on_or_before (const DayOfWeek k) const |
Gets the day of week on or before the current date. | |
constexpr CalDate | day_of_week_on_or_after (const DayOfWeek k) const |
Gets the day of week on or after the current date. | |
constexpr CalDate | first_week_day (const DayOfWeek k) const |
Gets the first week day in a month (assuming current date is the start of the month) | |
constexpr CalDate | last_week_day (const DayOfWeek k) const |
Gets the last week day in a month (assuming current date is the end of the month) | |
template<IsDayCalendarSystem Other> | |
auto | positions_in_range (Allocator &alloc, const CalDate< Other > &end, i32 pthMoment, i32 cDayCycle, i32 delta) const -> Result< ArrayList< CalDate >, AllocationError > |
Return the cyclic positions in the range of the current date to the end date (exclusive) Used to collect all occurrences of events (e.g. | |
i32 | day_of_m_cycle (i32 m, i32 offset) const |
Gets which day the current date occurs in an m-length ("month") cycle. | |
auto | kth_day_of_m_cycle_on_or_before (i32 k, i32 m, i32 offset) const noexcept -> CalDate |
Finds the kth day of the m-cycle that occurs on or before the current date. | |
auto | kth_day_of_m_cycle_before (i32 k, i32 m, i32 offset) const noexcept -> CalDate |
Finds the kth day of the m-cycle that occurs before the current date. | |
auto | kth_day_of_m_cycle_on_or_after (i32 k, i32 m, i32 offset) const noexcept -> CalDate |
Finds the kth day of the m-cycle that occurs on or after the current date. | |
auto | kth_day_of_m_cycle_after (i32 k, i32 m, i32 offset) const noexcept -> CalDate |
Finds the kth day of the m-cycle that occurs after the current date. | |
auto | kth_day_of_m_cycle_nearest (i32 k, i32 m, i32 offset) const noexcept -> CalDate |
Finds the kth day of the m-cycle that occurs nearest the current date. | |
Static Public Member Functions | |
template<typename... Args> | |
static constexpr CalDate | make (Args... args) |
Public Attributes | |
Calendar | cal |
Represents a date without a time component.
Calendar | Calendar system used for date |
Definition at line 116 of file calendars/mtcore_calendars/core.hpp.
using mtcore::calendars::CalDate< Calendar >::CalendarSystem = Calendar |
Definition at line 117 of file calendars/mtcore_calendars/core.hpp.
|
default |
|
default |
|
default |
|
inline |
Definition at line 125 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Adds days to a date.
Definition at line 205 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the difference in days between dates.
Definition at line 216 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscard |
Gets which day the current date occurs in an m-length ("month") cycle.
m | Length of cycle |
offset | Offset for start of cycle |
Definition at line 305 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the day of week for a calendar.
Definition at line 202 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the day of week after the current date.
Definition at line 231 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the day of week before current date.
Definition at line 226 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the day of week nearest to the current date.
Definition at line 236 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the day of week on or after the current date.
Definition at line 246 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the day of week on or before the current date.
Definition at line 241 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the first week day in a month (assuming current date is the start of the month)
Definition at line 251 of file calendars/mtcore_calendars/core.hpp.
|
inlineconstexpr |
Definition at line 128 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Checks that a date is valid.
Definition at line 199 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardnoexcept |
Finds the kth day of the m-cycle that occurs after the current date.
k | The kth day of the m-cycle |
m | The number of days in the m-cycle |
offset | The offset of the m-cycle |
Definition at line 347 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardnoexcept |
Finds the kth day of the m-cycle that occurs before the current date.
k | The kth day of the m-cycle |
m | The number of days in the m-cycle |
offset | The offset of the m-cycle |
Definition at line 325 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardnoexcept |
Finds the kth day of the m-cycle that occurs nearest the current date.
k | The kth day of the m-cycle |
m | The number of days in the m-cycle |
offset | The offset of the m-cycle |
Definition at line 358 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardnoexcept |
Finds the kth day of the m-cycle that occurs on or after the current date.
k | The kth day of the m-cycle |
m | The number of days in the m-cycle |
offset | The offset of the m-cycle |
Definition at line 336 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardnoexcept |
Finds the kth day of the m-cycle that occurs on or before the current date.
k | The kth day of the m-cycle |
m | The number of days in the m-cycle |
offset | The offset of the m-cycle |
Definition at line 314 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the last week day in a month (assuming current date is the end of the month)
Definition at line 256 of file calendars/mtcore_calendars/core.hpp.
|
inlinestaticconstexpr |
Definition at line 139 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Moves the date to the nearest valid date.
Definition at line 196 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Gets the nth day of week.
Definition at line 221 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Definition at line 146 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Definition at line 170 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
Compares dates between two different calendar systems.
Other | Calendar system to compare to |
o | Other date to compare to |
Definition at line 156 of file calendars/mtcore_calendars/core.hpp.
|
default |
|
default |
|
inlinenodiscardconstexpr |
Definition at line 165 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
|
inlinenodiscardconstexpr |
|
inlinenodiscard |
Return the cyclic positions in the range of the current date to the end date (exclusive) Used to collect all occurrences of events (e.g.
holidays) in an interval of time (e.g. a Gregorian year)
Assumes $0 \le pthMoment \lt cDayCycle$
alloc | Allocator to use |
end | End of the cyclic range |
pthMoment | Starting pth moment search. First result on or after a given moment of the pth moment (basically the cycle start) |
cDayCycle | The number of days in the occurrence day cycle (basically the cycle length) |
delta | Congruent modulo of cDayCycle to the position of RdDate{0} in the repeating cycle (basically the cycle modulo offset) |
Definition at line 276 of file calendars/mtcore_calendars/core.hpp.
|
inlinenodiscardconstexpr |
Subtracts days from a date.
Definition at line 210 of file calendars/mtcore_calendars/core.hpp.
Calendar mtcore::calendars::CalDate< Calendar >::cal |
Definition at line 118 of file calendars/mtcore_calendars/core.hpp.