Represents month-year pair. More...
Public Member Functions | |
YearMonth () | |
Initializes instance as Jan, 0001. | |
YearMonth (UInt32 year, Month month) | |
Initializes instance with given values according YYYYMM (year/month) format. More... | |
YearMonth (UInt32 year, Month month, UInt32 day) | |
Initializes instance with given values according YYYYMMDD (year/month/day) format. More... | |
YearMonth (UInt32 year, Month month, WeekCode week) | |
Initializes instance with given values according YYYYMMWW (year/month/week) format. More... | |
YearMonth (const YearMonth &other) | |
Initializes as copy of other instance. | |
UInt32 | year () const |
Year component. More... | |
Month | month () const |
Month component. More... | |
UInt32 | day () const |
Day component. More... | |
WeekCode | week () const |
Week component. More... | |
bool | hasDay () const |
Checks that instance has valid day component. More... | |
bool | hasWeek () const |
Checks that instance has valid week component. More... | |
bool | operator== (const YearMonth &) const |
Compares with other instance for equality. | |
bool | operator!= (const YearMonth &) const |
Compares with other instance for inequality. | |
bool | operator< (const YearMonth &other) const |
Checks whether this instance is less than other one. More... | |
bool | operator> (const YearMonth &other) const |
Checks whether this instance is greater than other one. More... | |
YearMonth & | operator= (const YearMonth &other) |
std::string | toString () const |
Serializes into text (YYYYMM/YYYYMMDD/YYYYMMWW) presentation. | |
void | toString (std::string &) const |
Serializes into text (YYYYMM/YYYYMMDD/YYYYMMWW) presentation. | |
Static Public Member Functions | |
static YearMonth | deserialize (const StringRef &) |
De-serializes instance from its string presentation (YYYYMM/YYYYMMDD/YYYYMMWW) as it's used by CME Globex. More... | |
Represents month-year pair.
Year must fit into [0001, 9999] range. Month must fit into [01, 12] range.
YearMonth | ( | UInt32 | year, |
Month | month | ||
) |
Initializes instance with given values according YYYYMM (year/month) format.
Input parameters are checked for validness.
exception | if input parameters do not fit into a valid range. |
YearMonth | ( | UInt32 | year, |
Month | month, | ||
UInt32 | day | ||
) |
Initializes instance with given values according YYYYMMDD (year/month/day) format.
Input parameters are checked for validness.
exception | if input parameters do not fit into a valid range. |
YearMonth | ( | UInt32 | year, |
Month | month, | ||
WeekCode | week | ||
) |
Initializes instance with given values according YYYYMMWW (year/month/week) format.
Input parameters are checked for validness.
exception | if input parameters do not fit into a valid range. |
|
inline |
Day component.
Valid range of values is [01, 31].
De-serializes instance from its string presentation (YYYYMM/YYYYMMDD/YYYYMMWW) as it's used by CME Globex.
|
inline |
Checks that instance has valid day component.
Note: it's not valid to have both valid day and week, only one of them allowed.
|
inline |
Checks that instance has valid week component.
Note: it's not valid to have both valid day and week, only one of them allowed.
|
inline |
Month component.
Valid range of values is [01, 12].
bool operator< | ( | const YearMonth & | other | ) | const |
Checks whether this instance is less than other one.
Note: when comparing objects with different date components, e.g. days vs weeks (but same year and month) following order is applied: YYYYMM < YYYYMMWW < YYYYMMDD
bool operator> | ( | const YearMonth & | other | ) | const |
Checks whether this instance is greater than other one.
Note: when comparing objects with different date components, e.g. days vs weeks (but same year and month) following order is applied: YYYYMMDD > YYYYMMWW > YYYYMM
|
inline |
Week component.
Valid range of values is [1, 5].
|
inline |
Year component.
Valid range of values is [0001, 9999].