E-MailRelay
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
G::Date Class Reference

A day-month-year date class. More...

#include <gdate.h>

Classes

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

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

Detailed Description

A day-month-year date class.

See also
G::Time, G::DateTime

Definition at line 39 of file gdate.h.

Member Enumeration Documentation

◆ Format

enum class G::Date::Format
strong

Definition at line 49 of file gdate.h.

◆ Month

enum class G::Date::Month
strong

Definition at line 47 of file gdate.h.

◆ Weekday

enum class G::Date::Weekday
strong

Definition at line 45 of file gdate.h.

Constructor & Destructor Documentation

◆ Date() [1/6]

G::Date::Date ( )

Default constructor for the current date in the UTC timezone.

Definition at line 39 of file gdate.cpp.

◆ Date() [2/6]

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

Constructor for the current date in the local timezone.

Definition at line 59 of file gdate.cpp.

◆ Date() [3/6]

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

Constructor for the specified date.

Definition at line 54 of file gdate.cpp.

◆ Date() [4/6]

G::Date::Date ( SystemTime  t)
explicit

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

Definition at line 44 of file gdate.cpp.

◆ Date() [5/6]

G::Date::Date ( SystemTime  t,
const LocalTime  
)

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

Definition at line 49 of file gdate.cpp.

◆ Date() [6/6]

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

Constructor for the specified date.

Definition at line 64 of file gdate.cpp.

Member Function Documentation

◆ dd()

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

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

Definition at line 111 of file gdate.cpp.

◆ mm()

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

Returns the month as a two-digit decimal string.

Definition at line 118 of file gdate.cpp.

◆ month()

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

Returns the month.

Definition at line 148 of file gdate.cpp.

◆ monthday()

int G::Date::monthday ( ) const

Returns the day of the month.

Definition at line 106 of file gdate.cpp.

◆ monthName()

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

Returns the month as a string (in english).

Definition at line 153 of file gdate.cpp.

◆ operator!=()

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

Comparison operator.

Definition at line 268 of file gdate.cpp.

◆ operator++()

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

Increments the date by one day.

Definition at line 182 of file gdate.cpp.

◆ operator--()

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

Decrements the date by one day.

Definition at line 205 of file gdate.cpp.

◆ operator==()

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

Comparison operator.

Definition at line 260 of file gdate.cpp.

◆ str()

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

Returns a string representation of the date.

Definition at line 84 of file gdate.cpp.

◆ weekday()

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

Returns the day of the week.

Definition at line 125 of file gdate.cpp.

◆ weekdayName()

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

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

Definition at line 136 of file gdate.cpp.

◆ year()

int G::Date::year ( ) const

Returns the year.

Definition at line 170 of file gdate.cpp.

◆ yearLowerLimit()

int G::Date::yearLowerLimit ( )
static

Returns the smallest supported year value.

Definition at line 34 of file gdate.cpp.

◆ yearUpperLimit()

int G::Date::yearUpperLimit ( )
static

Returns the largest supported year value.

Definition at line 29 of file gdate.cpp.

◆ yyyy()

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

Returns the year as a four-digit decimal string.

Definition at line 175 of file gdate.cpp.


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