Date Struct Reference
|
CPP API
|
Public Member Functions |
Static Public Member Functions |
Public Attributes |
Static Public Attributes |
Friends |
List of all members
mio::Date Struct Reference
Simple date representation as year, month, and day. More...
#include <date.h>
Public Member Functions | |
| Date ()=default | |
| default constructor. More... | |
| Date (int y, int m, int d) | |
| initializing constructor. More... | |
| bool | operator!= (const Date &other) const |
| bool | operator< (const Date &other) const |
| bool | operator<= (const Date &other) const |
| bool | operator== (const Date &other) const |
| equality comparison operators. More... | |
| bool | operator> (const Date &other) const |
| bool | operator>= (const Date &other) const |
| template<class IOContext > | |
| void | serialize (IOContext &io) const |
| serialize this. More... | |
| std::string | to_iso_string () const |
| Formats the date into a string in ISO 8601 format (YYYY-MM-DD). More... | |
Static Public Member Functions | |
| template<class IOContext > | |
| static IOResult< Date > | deserialize (IOContext &io) |
| deserialize an object of this class. More... | |
Public Attributes | |
| int | day |
| int | month |
| int | year |
Static Public Attributes | |
| static constexpr std::array< int, 12 > | month_lengths = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} |
| static constexpr std::array< int, 12 > | month_lengths_leap_year = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} |
Friends | |
| std::ostream & | operator<< (std::ostream &os, const Date &date) |
| Overload for stream operator to use the ISO 8601 format. More... | |
Detailed Description
Simple date representation as year, month, and day.
month in [1, 12], day in [1, 31]
Constructor & Destructor Documentation
◆ Date() [1/2]
|
default |
default constructor.
◆ Date() [2/2]
|
inline |
initializing constructor.
- Parameters
-
y year as int m month as int, 1 - 12 d day as int, 1 - 31
Member Function Documentation
◆ deserialize()
template<class IOContext >
|
inlinestatic |
deserialize an object of this class.
- See also
- mio::deserialize
◆ operator!=()
|
inline |
◆ operator<()
|
inline |
◆ operator<=()
|
inline |
◆ operator==()
|
inline |
equality comparison operators.
- Parameters
-
other another date.
◆ operator>()
|
inline |
◆ operator>=()
|
inline |
◆ serialize()
template<class IOContext >
|
inline |
serialize this.
- See also
- mio::serialize
◆ to_iso_string()
|
inline |
Formats the date into a string in ISO 8601 format (YYYY-MM-DD).
- Returns
- A string representing the date in ISO 8601 format.
Friends And Related Function Documentation
◆ operator<<
|
friend |
Overload for stream operator to use the ISO 8601 format.
- Parameters
-
os Output stream. date Date to output.
- Returns
- Reference to the output stream.
Member Data Documentation
◆ day
| int mio::Date::day |
◆ month
| int mio::Date::month |
◆ month_lengths
|
staticconstexpr |
◆ month_lengths_leap_year
|
staticconstexpr |
◆ year
| int mio::Date::year |
Generated by