A class to represent and handle date ranges. They can be sorted, checked for uniqueness and a date can be compared to the range (is it before or after?).
#include <Date.h>
Public Member Functions | |
DateRange () | |
DateRange (const Date &d1, const Date &d2) | |
DateRange (const std::string &range_spec, const double &tz) | |
void | setRange (const std::string &range_spec, const double &tz) |
Set the date range from a provided date range string (at most daily resolution) More... | |
bool | isUndef () const |
bool | in (const Date &a) const |
Is the provided date within the current range? More... | |
bool | hasOverlap (const Date &i_start, const Date &i_end) const |
Is the provided date range within the current range? More... | |
bool | operator< (const Date &a) const |
Is the range before the provided date? More... | |
bool | operator> (const Date &a) const |
Is the range after the provided date? More... | |
bool | operator< (const DateRange &a) const |
bool | operator== (const DateRange &a) const |
const std::string | toString () const |
Public Attributes | |
Date | start |
Date | end |
|
inline |
|
inline |
Is the provided date range within the current range?
[in] | i_start | start of the range to check |
[in] | i_end | end of the range to check |
|
inline |
Is the provided date within the current range?
[in] | a | Date to check |
|
inline |
|
inline |
Is the range before the provided date?
[in] | a | Date to check |
|
inline |
|
inline |
|
inline |
Is the range after the provided date?
[in] | a | Date to check |
void mio::DateRange::setRange | ( | const std::string & | range_spec, |
const double & | tz | ||
) |
Set the date range from a provided date range string (at most daily resolution)
Such a string can either contain only one date (at least the year must be provided, everything else is optional) or two dates separated by a dash. Examples of valid ranges:
[in] | range_spec | the range string |
[in] | tz | timezone of the dates provided in range_spec |
|
inline |
Date mio::DateRange::end |
Date mio::DateRange::start |