Date Class Reference

A representation of a calendar date. More...

#include <Date.h++>

Inheritance diagram for Date:

Inheritance graph
[legend]

List of all members.

Public Types

enum  Weekday {
  Invalid = 0, Monday, Tuesday, Wednesday,
  Thursday, Friday, Saturday, Sunday
}

Public Member Functions

 Date () throw ()
 Construct a new Date of January 1, year 1.
 Date (uint_t day, uint_t month, uint_t year) throw ()
 Construct a new Date with the given components.
 Date (const Date &other) throw ()
 Copy constructor.
virtual ~Date () throw ()
 Destructor.
void setMonth (uint_t month) throw ()
 Set the month component of the date.
void setDay (uint_t day) throw ()
 Set the day-of-month component of the date.
void setYear (uint_t year) throw ()
 Set the year component of the date.
void setDate (uint_t day, uint_t month, uint_t year) throw ()
 Set the day, month, and year components of the date.
uint_t getMonth () const throw ()
 Get the month component of the date.
uint_t getDay () const throw ()
 Get the day-of-month component of the date.
uint_t getYear () const throw ()
 Get the year component of the date.
Weekday getWeekday () const throw ()
 Get the weekday of the date.
uint_t getDayOfYear () const throw ()
 Get the day of the year.
uint_t getWeekOfYear () const throw ()
 Get the week number of the year, where weeks are defined as beginning on Monday (ISO standard).
bool isValid () const throw ()
 Test if the date is valid.
bool operator== (const Date &other) const throw ()
bool operator< (const Date &other) const throw ()
bool operator<= (const Date &other) const throw ()
bool operator!= (const Date &other) const throw ()
bool operator> (const Date &other) const throw ()
bool operator>= (const Date &other) const throw ()
Dateoperator= (const Date &other) throw ()

Static Public Member Functions

static bool isLeapYear (uint_t year) throw ()
 Test if a year is a leap year.

Static Public Attributes

static const uint_t JAN = 1
 The month of January.
static const uint_t FEB = 2
 The month of February.
static const uint_t MAR = 3
 The month of March.
static const uint_t APR = 4
 The month of April.
static const uint_t MAY = 5
 The month of May.
static const uint_t JUN = 6
 The month of June.
static const uint_t JUL = 7
 The month of July.
static const uint_t AUG = 8
 The month of August.
static const uint_t SEP = 9
 The month of September.
static const uint_t OCT = 10
 The month of October.
static const uint_t NOV = 11
 The month of November.
static const uint_t DEC = 12
 The month of December.

Protected Attributes

uint_t _year
uint_t _month
uint_t _day
Weekday _wday
uint_t _yday
int _wnum


Detailed Description

A representation of a calendar date.

Author:
Mark Lindner

Member Enumeration Documentation

enum Weekday

Enumerator:
Invalid 
Monday 
Tuesday 
Wednesday 
Thursday 
Friday 
Saturday 
Sunday 


Constructor & Destructor Documentation

Date (  )  throw ()

Construct a new Date of January 1, year 1.

Date ( uint_t  day,
uint_t  month,
uint_t  year 
) throw ()

Construct a new Date with the given components.

Date ( const Date other  )  throw ()

Copy constructor.

~Date (  )  throw () [virtual]

Destructor.


Member Function Documentation

uint_t getDay (  )  const throw () [inline]

Get the day-of-month component of the date.

uint_t getDayOfYear (  )  const throw ()

Get the day of the year.

uint_t getMonth (  )  const throw () [inline]

Get the month component of the date.

Date::Weekday getWeekday (  )  const throw ()

Get the weekday of the date.

uint_t getWeekOfYear (  )  const throw ()

Get the week number of the year, where weeks are defined as beginning on Monday (ISO standard).

uint_t getYear (  )  const throw () [inline]

Get the year component of the date.

bool isLeapYear ( uint_t  year  )  throw () [static]

Test if a year is a leap year.

bool isValid (  )  const throw ()

Test if the date is valid.

bool operator!= ( const Date other  )  const throw () [inline]

bool operator< ( const Date other  )  const throw ()

bool operator<= ( const Date other  )  const throw ()

Date & operator= ( const Date other  )  throw ()

bool operator== ( const Date other  )  const throw ()

bool operator> ( const Date other  )  const throw () [inline]

bool operator>= ( const Date other  )  const throw () [inline]

void setDate ( uint_t  day,
uint_t  month,
uint_t  year 
) throw ()

Set the day, month, and year components of the date.

Reimplemented in DateTime.

void setDay ( uint_t  day  )  throw ()

Set the day-of-month component of the date.

void setMonth ( uint_t  month  )  throw ()

Set the month component of the date.

void setYear ( uint_t  year  )  throw ()

Set the year component of the date.


Member Data Documentation

uint_t _day [protected]

uint_t _month [protected]

Weekday _wday [mutable, protected]

int _wnum [mutable, protected]

uint_t _yday [mutable, protected]

uint_t _year [protected]

const uint_t APR = 4 [static]

The month of April.

const uint_t AUG = 8 [static]

The month of August.

const uint_t DEC = 12 [static]

The month of December.

const uint_t FEB = 2 [static]

The month of February.

const uint_t JAN = 1 [static]

The month of January.

const uint_t JUL = 7 [static]

The month of July.

const uint_t JUN = 6 [static]

The month of June.

const uint_t MAR = 3 [static]

The month of March.

const uint_t MAY = 5 [static]

The month of May.

const uint_t NOV = 11 [static]

The month of November.

const uint_t OCT = 10 [static]

The month of October.

const uint_t SEP = 9 [static]

The month of September.


The documentation for this class was generated from the following files:

Generated on Sat Apr 17 23:03:08 2010 for libcommonc++ by  doxygen 1.5.9