libcommonc++  0.7
Date Class Reference

A representation of a calendar date. More...

#include <Date.h++>

Inheritance diagram for Date:

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

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

Detailed Description

A representation of a calendar date.

Author
Mark Lindner

Member Enumeration Documentation

◆ Weekday

enum Weekday
Enumerator
Invalid 
Monday 
Tuesday 
Wednesday 
Thursday 
Friday 
Saturday 
Sunday 

Constructor & Destructor Documentation

◆ Date() [1/3]

Date ( )

Construct a new Date of January 1, year 1.

◆ Date() [2/3]

Date ( uint_t  day,
uint_t  month,
uint_t  year 
)

Construct a new Date with the given components.

◆ Date() [3/3]

Date ( const Date other)

Copy constructor.

◆ ~Date()

~Date ( )
virtual

Destructor.

Member Function Documentation

◆ getDay()

uint_t getDay ( ) const
inline

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

◆ getDayOfYear()

uint_t getDayOfYear ( ) const

Get the day of the year.

◆ getMonth()

uint_t getMonth ( ) const
inline

Get the month component of the date.

◆ getWeekday()

Date::Weekday getWeekday ( ) const

Get the weekday of the date.

◆ getWeekOfYear()

uint_t getWeekOfYear ( ) const

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

◆ getYear()

uint_t getYear ( ) const
inline

Get the year component of the date.

◆ isLeapYear()

bool isLeapYear ( uint_t  year)
static

Test if a year is a leap year.

◆ isValid()

bool isValid ( ) const

Test if the date is valid.

◆ operator!=()

bool operator!= ( const Date other) const
inline

◆ operator<()

bool operator< ( const Date other) const

◆ operator<=()

bool operator<= ( const Date other) const

◆ operator=()

Date & operator= ( const Date other)

◆ operator==()

bool operator== ( const Date other) const

◆ operator>()

bool operator> ( const Date other) const
inline

◆ operator>=()

bool operator>= ( const Date other) const
inline

◆ setDate()

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

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

◆ setDay()

void setDay ( uint_t  day)

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

◆ setMonth()

void setMonth ( uint_t  month)

Set the month component of the date.

◆ setYear()

void setYear ( uint_t  year)

Set the year component of the date.

Member Data Documentation

◆ APR

const uint_t APR = 4
static

The month of April.

◆ AUG

const uint_t AUG = 8
static

The month of August.

◆ DEC

const uint_t DEC = 12
static

The month of December.

◆ FEB

const uint_t FEB = 2
static

The month of February.

◆ JAN

const uint_t JAN = 1
static

The month of January.

◆ JUL

const uint_t JUL = 7
static

The month of July.

◆ JUN

const uint_t JUN = 6
static

The month of June.

◆ MAR

const uint_t MAR = 3
static

The month of March.

◆ MAY

const uint_t MAY = 5
static

The month of May.

◆ NOV

const uint_t NOV = 11
static

The month of November.

◆ OCT

const uint_t OCT = 10
static

The month of October.

◆ SEP

const uint_t SEP = 9
static

The month of September.


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