MT Core (C++)
Core library for replacing C++ standard in project usage
Loading...
Searching...
No Matches
mtcore::calendars::AstronomicalYear Class Reference

Astronomical Year. More...

#include <core.hpp>

Public Member Functions

 AstronomicalYear ()=default
 
 AstronomicalYear (const YearBase year)
 
 operator YearBase () const
 
 operator AnnoDominiYear () const
 
AstronomicalYear operator+ (YearBase years) const
 
AstronomicalYear operator- (YearBase years) const
 
YearBase difference (AstronomicalYear o) const
 
auto operator<=> (const AstronomicalYear &o) const -> std::strong_ordering
 
auto operator== (const AstronomicalYear &o) const -> bool
 
auto operator!= (const AstronomicalYear &o) const -> bool
 
auto operator< (const AstronomicalYear &o) const -> bool
 
auto operator> (const AstronomicalYear &o) const -> bool
 
auto operator>= (const AstronomicalYear &o) const -> bool
 
auto operator<= (const AstronomicalYear &o) const -> bool
 

Static Public Member Functions

static bool is_valid (const YearBase year)
 

Detailed Description

Astronomical Year.

1 B.C. is year 0.

Definition at line 35 of file calendars/mtcore_calendars/core.hpp.

Constructor & Destructor Documentation

◆ AstronomicalYear() [1/2]

mtcore::calendars::AstronomicalYear::AstronomicalYear ( )
default
Here is the caller graph for this function:

◆ AstronomicalYear() [2/2]

mtcore::calendars::AstronomicalYear::AstronomicalYear ( const YearBase year)
inline

Definition at line 40 of file calendars/mtcore_calendars/core.hpp.

40: year(year) { ensure(is_valid(year)); }
#define ensure(check,...)
Ensures that a check holds true, aborts the program if not true Will print error if the condition is ...
Here is the call graph for this function:

Member Function Documentation

◆ difference()

YearBase mtcore::calendars::AstronomicalYear::difference ( AstronomicalYear o) const
inlinenodiscard

Definition at line 47 of file calendars/mtcore_calendars/core.hpp.

47{ return year - o.year; }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_valid()

static bool mtcore::calendars::AstronomicalYear::is_valid ( const YearBase year)
inlinestatic

Definition at line 56 of file calendars/mtcore_calendars/core.hpp.

56{ return year > std::numeric_limits<YearBase>::min(); }
Here is the caller graph for this function:

◆ operator AnnoDominiYear()

mtcore::calendars::AstronomicalYear::operator AnnoDominiYear ( ) const
inlineexplicit

Definition at line 89 of file calendars/mtcore_calendars/core.hpp.

89{ return {year > 0 ? year : year - 1}; }

◆ operator YearBase()

mtcore::calendars::AstronomicalYear::operator YearBase ( ) const
inlineexplicit

Definition at line 42 of file calendars/mtcore_calendars/core.hpp.

42{ return year; }

◆ operator!=()

auto mtcore::calendars::AstronomicalYear::operator!= ( const AstronomicalYear & o) const -> bool
inlinenodiscard

Definition at line 50 of file calendars/mtcore_calendars/core.hpp.

50{ return year != o.year; }
Here is the call graph for this function:

◆ operator+()

AstronomicalYear mtcore::calendars::AstronomicalYear::operator+ ( YearBase years) const
inlinenodiscard

Definition at line 45 of file calendars/mtcore_calendars/core.hpp.

45{ return {year + years}; }
Here is the call graph for this function:

◆ operator-()

AstronomicalYear mtcore::calendars::AstronomicalYear::operator- ( YearBase years) const
inlinenodiscard

Definition at line 46 of file calendars/mtcore_calendars/core.hpp.

46{ return {year - years}; }
Here is the call graph for this function:

◆ operator<()

auto mtcore::calendars::AstronomicalYear::operator< ( const AstronomicalYear & o) const -> bool
inlinenodiscard

Definition at line 51 of file calendars/mtcore_calendars/core.hpp.

51{ return year < o.year; }
Here is the call graph for this function:

◆ operator<=()

auto mtcore::calendars::AstronomicalYear::operator<= ( const AstronomicalYear & o) const -> bool
inlinenodiscard

Definition at line 54 of file calendars/mtcore_calendars/core.hpp.

54{ return year <= o.year; }
Here is the call graph for this function:

◆ operator<=>()

auto mtcore::calendars::AstronomicalYear::operator<=> ( const AstronomicalYear & o) const -> std::strong_ordering
inlinenodiscard

Definition at line 48 of file calendars/mtcore_calendars/core.hpp.

48{ return year <=> o.year; }
Here is the call graph for this function:

◆ operator==()

auto mtcore::calendars::AstronomicalYear::operator== ( const AstronomicalYear & o) const -> bool
inlinenodiscard

Definition at line 49 of file calendars/mtcore_calendars/core.hpp.

49{ return year == o.year; }
Here is the call graph for this function:

◆ operator>()

auto mtcore::calendars::AstronomicalYear::operator> ( const AstronomicalYear & o) const -> bool
inlinenodiscard

Definition at line 52 of file calendars/mtcore_calendars/core.hpp.

52{ return year > o.year; }
Here is the call graph for this function:

◆ operator>=()

auto mtcore::calendars::AstronomicalYear::operator>= ( const AstronomicalYear & o) const -> bool
inlinenodiscard

Definition at line 53 of file calendars/mtcore_calendars/core.hpp.

53{ return year >= o.year; }
Here is the call graph for this function:

The documentation for this class was generated from the following file: