G::Date Class Reference

A date (dd/mm/yyyy) class. More...

#include <gdate.h>

List of all members.

Public Types

enum  Weekday {
  sunday, monday, tuesday, wednesday,
  thursday, friday, saturday
}
enum  Month {
  january = 1, february, march, april,
  may, june, july, august,
  september, october, november, december
}
enum  Format { yyyy_mm_dd_slash, yyyy_mm_dd, mm_dd }

Public Member Functions

 Date ()
 Default constructor the current date in the UTC timezone.
 Date (const LocalTime &)
 Constructor for the current date in the local timezone.
 Date (const G::DateTime::BrokenDownTime &tm)
 Constructor for the specified date.
 Date (G::DateTime::EpochTime t)
 Constructor for the date in the UTC timezone as at the given epoch time.
 Date (G::DateTime::EpochTime t, const LocalTime &)
 Constructor for the date in the local timezone as at the given epoch time.
 Date (int year, Month month, int day_of_month)
 Constructor for the specified date.
std::string string (Format format=yyyy_mm_dd_slash) const
 Returns a string representation of the date.
Weekday weekday () const
 Returns the day of the week.
std::string weekdayName (bool brief=false) const
 Returns an english string representation of the day of the week.
int monthday () const
 Returns the day of the month.
std::string dd () const
 Returns the day of the month as a two-digit decimal string.
Month month () const
 Returns the month.
std::string monthName (bool brief=false) const
 Returns the month as a string (in english).
std::string mm () const
 Returns the month as a two-digit decimal string.
int year () const
 Returns the year.
std::string yyyy () const
 Returns the year as a four-digit decimal string.
Dateoperator++ ()
 Increments the date by one day.
Dateoperator-- ()
 Decrements the date by one day.
bool operator== (const Date &rhs) const
 Comparison operator.
bool operator!= (const Date &rhs) const
 Comparison operator.

Static Public Member Functions

static int yearUpperLimit ()
 Returns the smallest supported year value.
static int yearLowerLimit ()
 Returns the largest supported year value.

Classes

class  LocalTime
 An overload discriminator class for Date constructors. More...


Detailed Description

A date (dd/mm/yyyy) class.

See also:
G::Time, G::DateTime

Definition at line 40 of file gdate.h.


Member Enumeration Documentation

Enumerator:
sunday 
monday 
tuesday 
wednesday 
thursday 
friday 
saturday 

Definition at line 47 of file gdate.h.

Enumerator:
january 
february 
march 
april 
may 
june 
july 
august 
september 
october 
november 
december 

Definition at line 50 of file gdate.h.

Enumerator:
yyyy_mm_dd_slash 
yyyy_mm_dd 
mm_dd 

Definition at line 54 of file gdate.h.


Constructor & Destructor Documentation

G::Date::Date (  ) 

Default constructor the current date in the UTC timezone.

Definition at line 38 of file gdate.cpp.

References G::DateTime::now(), and G::DateTime::utc().

G::Date::Date ( const LocalTime  )  [explicit]

Constructor for the current date in the local timezone.

Definition at line 58 of file gdate.cpp.

References G::DateTime::local(), and G::DateTime::now().

G::Date::Date ( const G::DateTime::BrokenDownTime tm  ) 

Constructor for the specified date.

Definition at line 53 of file gdate.cpp.

G::Date::Date ( G::DateTime::EpochTime  t  )  [explicit]

Constructor for the date in the UTC timezone as at the given epoch time.

Definition at line 43 of file gdate.cpp.

References G::DateTime::utc().

G::Date::Date ( G::DateTime::EpochTime  t,
const LocalTime  
)

Constructor for the date in the local timezone as at the given epoch time.

Definition at line 48 of file gdate.cpp.

References G::DateTime::local().

G::Date::Date ( int  year,
Month  month,
int  day_of_month 
)

Constructor for the specified date.

Definition at line 63 of file gdate.cpp.

References G_ASSERT, yearLowerLimit(), and yearUpperLimit().


Member Function Documentation

int G::Date::yearUpperLimit (  )  [static]

Returns the smallest supported year value.

Definition at line 28 of file gdate.cpp.

Referenced by Date().

int G::Date::yearLowerLimit (  )  [static]

Returns the largest supported year value.

Definition at line 33 of file gdate.cpp.

Referenced by Date().

std::string G::Date::string ( Format  format = yyyy_mm_dd_slash  )  const

Returns a string representation of the date.

Definition at line 87 of file gdate.cpp.

References dd(), G_ASSERT, mm(), mm_dd, yyyy(), yyyy_mm_dd, and yyyy_mm_dd_slash.

G::Date::Weekday G::Date::weekday (  )  const

Returns the day of the week.

Definition at line 128 of file gdate.cpp.

References G::DateTime::epochTime(), and G::DateTime::utc().

Referenced by weekdayName().

std::string G::Date::weekdayName ( bool  brief = false  )  const

Returns an english string representation of the day of the week.

(Was weekdayString().)

Definition at line 151 of file gdate.cpp.

References friday, monday, saturday, sunday, thursday, tuesday, wednesday, and weekday().

Referenced by GSmtp::ServerProtocolText::receivedLine().

int G::Date::monthday (  )  const

Returns the day of the month.

Definition at line 109 of file gdate.cpp.

Referenced by operator==(), and GSmtp::ServerProtocolText::receivedLine().

std::string G::Date::dd (  )  const

Returns the day of the month as a two-digit decimal string.

(Was monthdayString().)

Definition at line 114 of file gdate.cpp.

Referenced by string().

G::Date::Month G::Date::month (  )  const

Returns the month.

Definition at line 163 of file gdate.cpp.

Referenced by monthName(), and operator==().

std::string G::Date::monthName ( bool  brief = false  )  const

Returns the month as a string (in english).

(Was monthString().)

Definition at line 168 of file gdate.cpp.

References april, august, december, february, january, july, june, march, may, month(), november, october, and september.

Referenced by GSmtp::ServerProtocolText::receivedLine().

std::string G::Date::mm (  )  const

Returns the month as a two-digit decimal string.

Definition at line 121 of file gdate.cpp.

Referenced by string().

int G::Date::year (  )  const

Returns the year.

Definition at line 185 of file gdate.cpp.

Referenced by operator==().

std::string G::Date::yyyy (  )  const

Returns the year as a four-digit decimal string.

(Was yearString().)

Definition at line 190 of file gdate.cpp.

Referenced by GSmtp::ServerProtocolText::receivedLine(), and string().

G::Date & G::Date::operator++ (  ) 

Increments the date by one day.

Definition at line 197 of file gdate.cpp.

References saturday, and sunday.

G::Date & G::Date::operator-- (  ) 

Decrements the date by one day.

Definition at line 220 of file gdate.cpp.

References saturday, and sunday.

bool G::Date::operator== ( const Date rhs  )  const

Comparison operator.

Definition at line 275 of file gdate.cpp.

References month(), monthday(), and year().

bool G::Date::operator!= ( const Date rhs  )  const

Comparison operator.

Definition at line 283 of file gdate.cpp.


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

Generated on Fri Apr 18 15:56:13 2008 for E-MailRelay by  doxygen 1.5.5