OSB_LIB::Date Class Reference

Collaboration diagram for OSB_LIB::Date:

Collaboration graph
[legend]
List of all members.

Detailed Description

Date class.

This class provides Date operations.

Definition at line 64 of file chrono.h.

Public Member Functions

Read access functions
Functions for changing a Date.
Operators that need access to the class representation.

Static Public Member Functions

Special dates.

Static Public Attributes

Private Member Functions

Private Attributes

Static Private Attributes


Constructor & Destructor Documentation

OSB_LIB::Date::Date (  )  [inline]

Default constructor: the date is not set.

Definition at line 646 of file chrono.h.

Referenced by max(), and min().

OSB_LIB::Date::Date ( int  dd,
Month  mm,
int  yy 
)

Constructor with day, month and year.

Parameters:
dd Day of month.
mm Month.
yy Year.

OSB_LIB::Date::Date ( const std::string &  src,
const std::string &  format = "%d-%m-%Y" 
) [explicit]

Construct from string.

Parameters:
src String representing the date in format.
format Describes the format of src:
"%d-%m-%Y" corresponds to "dd-mm-yyyy", see man strptime for details.

OSB_LIB::Date::Date ( Weekday  dd,
int  ww,
Month  mm,
int  yy 
)

Constructor with year, month, week and weekday.

Parameters:
dd Day of the week.
ww Week of the month, see below.
mm Month.
yy Year.
This constructor determines the date from the parameters as explained in man tzset:

"The day of week ww of month mm of the year (1 < ww < 5, 1 < mm < 12). When ww is 5, it refers to the last dd day of month mm which may occur in either the fourth or fifth week. Week 1 is the first week in which the day dd occurs."

OSB_LIB::Date::Date ( long  days  )  [inline, explicit, private]

Construct from days since January 1st of the base year.

Definition at line 651 of file chrono.h.


Member Function Documentation

Date & OSB_LIB::Date::addDays ( long  n  )  [inline]

Add n days.

Definition at line 676 of file chrono.h.

References j_.

Date& OSB_LIB::Date::addMonths ( int  n  ) 

Add n months.

Date& OSB_LIB::Date::addYears ( int  n  ) 

Add n years.

int OSB_LIB::Date::day (  )  const

Returns day of month.

Weekday OSB_LIB::Date::dayOfWeek (  )  const

The day of the week: returns 1 (Monday) to 7 (Sunday).

int OSB_LIB::Date::dayOfYear (  )  const

Returns 1 to 365 or 366.

void OSB_LIB::Date::dmy2j ( int  dd,
Month  mm,
int  yy 
) [private]

Set j from day, month, year.

void OSB_LIB::Date::getDmy ( int &  day,
Month mon,
int &  year 
) const [inline]

Get day, year and month.

Definition at line 682 of file chrono.h.

References j2dmy().

bool OSB_LIB::Date::isSet (  )  const [inline]

Date set?

Returns:
true if the date was not default constructed, else false.

Definition at line 671 of file chrono.h.

References notSet().

Referenced by OSB_LIB::DateTime::isSet().

void OSB_LIB::Date::j2dmy ( int &  dd,
Month mm,
int &  yy 
) const [private]

Convert j to day, month, year.

Referenced by getDmy().

const Date OSB_LIB::Date::max (  )  [inline, static]

Largest date.

Larger dates are possible, with restrictions.

Definition at line 661 of file chrono.h.

References Date(), and maxDay_.

Referenced by OSB_LIB::BsPage::endDate(), and OSB_LIB::DateTime::max().

const Date OSB_LIB::Date::min (  )  [inline, static]

Smallest date.

Smaller dates are possible, however note that the day before the minimum date is considered not set.

Definition at line 656 of file chrono.h.

References Date(), and minDay_.

Referenced by OSB_LIB::DateTime::min().

Month OSB_LIB::Date::month (  )  const

Returns month.

bool OSB_LIB::Date::notSet (  )  const [inline]

Date not set?

Returns:
true if the date was default constructed, else false.

Definition at line 666 of file chrono.h.

References j_, and minDay_.

Referenced by isSet(), and OSB_LIB::DateTime::notSet().

bool OSB_LIB::Date::operator!= ( const Date b  )  const [inline]

operator!=.

Definition at line 202 of file chrono.h.

References j_.

long OSB_LIB::Date::operator- ( const Date b  )  const [inline]

operator-.

Definition at line 198 of file chrono.h.

References j_.

bool OSB_LIB::Date::operator< ( const Date b  )  const [inline]

operator<.

Definition at line 204 of file chrono.h.

References j_.

bool OSB_LIB::Date::operator<= ( const Date b  )  const [inline]

operator<=.

Definition at line 208 of file chrono.h.

References j_.

bool OSB_LIB::Date::operator== ( const Date b  )  const [inline]

operator==.

Definition at line 200 of file chrono.h.

References j_.

bool OSB_LIB::Date::operator> ( const Date b  )  const [inline]

operator>.

Definition at line 206 of file chrono.h.

References j_.

bool OSB_LIB::Date::operator>= ( const Date b  )  const [inline]

operator>=.

Definition at line 210 of file chrono.h.

References j_.

std::string OSB_LIB::Date::str ( const std::string &  format = "%d-%m-%Y"  )  const

Function to return date using a specific format.

This function will returns a date with the format in the parameter.
For more details about the format please look at standard C-function "strftime".

Parameters:
format Date format for the return value.
The default yields "dd-mm-yyyy", see man strftime for details.
Returns:
Date as a string in the requested format.

Referenced by OSB_LIB::operator<<().

static Date OSB_LIB::Date::today (  )  [static]

Current date.

int OSB_LIB::Date::year (  )  const

Returns year.


Member Data Documentation

const int OSB_LIB::Date::baseYear_ [static, private]

The base year used for conversions between j_ and year, month, day.

Its value is 2000, for performance reasons is should be reasonably close to the current year.

Definition at line 221 of file chrono.h.

const int OSB_LIB::Date::daytab_[2][13] [static]

Number of days per month.

The first row is for non-leap years, the second for leap years,
the days of each month is stored in the column (daytab_[][0] is not relevant).

Definition at line 74 of file chrono.h.

Referenced by OSB_LIB::lastDay().

long OSB_LIB::Date::j_ [private]

Days from 1/1 of the base year.

A value of 1 corresponds to January 1 of the base year.

Definition at line 243 of file chrono.h.

Referenced by addDays(), notSet(), operator!=(), operator-(), operator<(), operator<=(), operator==(), operator>(), and operator>=().

const int OSB_LIB::Date::maxDay_ [static, private]

Value of j_ for max(): around 31-Dec-2200.

Definition at line 227 of file chrono.h.

Referenced by max().

const int OSB_LIB::Date::minDay_ [static, private]

Value of j_ for min(): around 01-Jan-1880.

Definition at line 225 of file chrono.h.

Referenced by min(), and notSet().

const int OSB_LIB::Date::monday_ [static, private]

Value of j_ such that the date is a Monday.

Definition at line 223 of file chrono.h.


The documentation for this class was generated from the following file:
Generated on Sat Sep 2 14:11:01 2006 for OSB Library by  doxygen 1.4.7