OnixS CME Drop Copy Handler C++ library 5.7.1
API documentation
Loading...
Searching...
No Matches
YearMonth Class Reference

Public Member Functions

 YearMonth ()
 YearMonth (UInt32 year, Month month)
 YearMonth (UInt32 year, Month month, UInt32 day)
 YearMonth (UInt32 year, Month month, WeekCode week)
 YearMonth (const YearMonth &other)
UInt32 year () const
Month month () const
UInt32 day () const
WeekCode week () const
bool hasDay () const
bool hasWeek () const
bool operator== (const YearMonth &) const
bool operator!= (const YearMonth &) const
bool operator< (const YearMonth &other) const
bool operator> (const YearMonth &other) const
YearMonthoperator= (const YearMonth &other)
std::string toString () const
void toString (std::string &) const

Static Public Member Functions

static YearMonth deserialize (const StringRef &)

Detailed Description

Represents month-year pair. Year must fit into [0001, 9999] range. Month must fit into [01, 12] range.

Definition at line 277 of file Time.h.

Constructor & Destructor Documentation

◆ YearMonth() [1/5]

YearMonth ( )

Initializes instance as Jan, 0001.

◆ YearMonth() [2/5]

YearMonth ( UInt32 year,
Month month )

Initializes instance with given values according YYYYMM (year/month) format. Input parameters are checked for validness.

Exceptions
exceptionif input parameters do not fit into a valid range.

◆ YearMonth() [3/5]

YearMonth ( UInt32 year,
Month month,
UInt32 day )

Initializes instance with given values according YYYYMMDD (year/month/day) format. Input parameters are checked for validness.

Exceptions
exceptionif input parameters do not fit into a valid range.

◆ YearMonth() [4/5]

YearMonth ( UInt32 year,
Month month,
WeekCode week )

Initializes instance with given values according YYYYMMWW (year/month/week) format. Input parameters are checked for validness.

Exceptions
exceptionif input parameters do not fit into a valid range.

◆ YearMonth() [5/5]

YearMonth ( const YearMonth & other)

Initializes as copy of other instance.

Member Function Documentation

◆ day()

UInt32 day ( ) const
inline

Day component. Valid range of values is [01, 31].

Definition at line 323 of file Time.h.

◆ deserialize()

YearMonth deserialize ( const StringRef & )
static

De-serializes instance from its string presentation (YYYYMM/YYYYMMDD/YYYYMMWW) as it's used by CME Globex.

◆ hasDay()

bool hasDay ( ) const
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.

Definition at line 337 of file Time.h.

◆ hasWeek()

bool hasWeek ( ) const
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.

Definition at line 344 of file Time.h.

◆ month()

Month month ( ) const
inline

Month component. Valid range of values is [01, 12].

Definition at line 316 of file Time.h.

◆ operator!=()

bool operator!= ( const YearMonth & ) const

Compares with other instance for inequality.

◆ operator<()

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

◆ operator=()

YearMonth & operator= ( const YearMonth & other)

◆ operator==()

bool operator== ( const YearMonth & ) const

Compares with other instance for equality.

◆ operator>()

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

◆ toString() [1/2]

std::string toString ( ) const
inline

Serializes into text (YYYYMM/YYYYMMDD/YYYYMMWW) presentation.

Definition at line 394 of file Time.h.

◆ toString() [2/2]

void toString ( std::string & ) const

Serializes into text (YYYYMM/YYYYMMDD/YYYYMMWW) presentation.

◆ week()

WeekCode week ( ) const
inline

Week component. Valid range of values is [1, 5].

Definition at line 330 of file Time.h.

◆ year()

UInt32 year ( ) const
inline

Year component. Valid range of values is [0001, 9999].

Definition at line 309 of file Time.h.