VMime
datetime Class Reference

#include <dateTime.hpp>

Inheritance diagram for datetime:
Collaboration diagram for datetime:

Public Types

enum  TimeZones {
  GMT_12 = -720 , GMT_11 = -660 , GMT_10 = -600 , GMT_9 = -540 ,
  GMT_8 = -480 , GMT_7 = -420 , GMT_6 = -360 , GMT_5 = -300 ,
  GMT_4 = -240 , GMT_3 = -180 , GMT_2 = -120 , GMT_1 = -60 ,
  GMT = 0 , GMT1 = 60 , GMT2 = 120 , GMT3 = 180 ,
  GMT4 = 240 , GMT5 = 300 , GMT6 = 360 , GMT7 = 420 ,
  GMT8 = 480 , GMT9 = 540 , GMT10 = 600 , GMT11 = 660 ,
  GMT12 = 720 , UT = GMT , EST = GMT_5 , EDT = GMT_4 ,
  CST = GMT_6 , CDT = GMT_5 , MST = GMT_7 , MDT = GMT_6 ,
  PST = GMT_8 , PDT = GMT_7 , A = GMT_1 , B = GMT_2 ,
  C = GMT_3 , D = GMT_4 , E = GMT_5 , F = GMT_6 ,
  G = GMT_7 , H = GMT_8 , I = GMT_9 , K = GMT_10 ,
  L = GMT_11 , M = GMT_12 , N = GMT1 , O = GMT2 ,
  P = GMT3 , Q = GMT4 , R = GMT5 , S = GMT6 ,
  T = GMT7 , U = GMT8 , V = GMT9 , W = GMT10 ,
  X = GMT11 , Y = GMT12 , Z = GMT
}
enum  Months {
  JANUARY = 1 , FEBRUARY = 2 , MARCH = 3 , APRIL = 4 ,
  MAY = 5 , JUNE = 6 , JULY = 7 , AUGUST = 8 ,
  SEPTEMBER = 9 , OCTOBER = 10 , NOVEMBER = 11 , DECEMBER = 12 ,
  JAN = 1 , FEB = 2 , MAR = 3 , APR = 4 ,
  JUN = 6 , JUL = 7 , AUG = 8 , SEP = 9 ,
  OCT = 10 , NOV = 11 , DEC = 12
}
enum  DaysOfWeek {
  SUNDAY = 0 , MONDAY = 1 , TUESDAY = 2 , WEDNESDAY = 3 ,
  THURSDAY = 4 , FRIDAY = 5 , SATURDAY = 6 , SUN = 0 ,
  MON = 1 , TUE = 2 , WED = 3 , THU = 4 ,
  FRI = 5 , SAT = 6
}

Public Member Functions

 datetime ()
 datetime (const int year, const int month, const int day)
 datetime (const int year, const int month, const int day, const int hour, const int minute, const int second, const int zone=GMT)
 datetime (const datetime &d)
 datetime (const string &date)
 datetime (const time_t t, const int zone=GMT)
 ~datetime ()
int getYear () const
int getMonth () const
int getDay () const
int getHour () const
int getMinute () const
int getSecond () const
int getZone () const
int getWeekDay () const
int getWeek () const
void getTime (int &hour, int &minute, int &second, int &zone) const
void getTime (int &hour, int &minute, int &second) const
void getDate (int &year, int &month, int &day) const
void setYear (const int year)
void setMonth (const int month)
void setDay (const int day)
void setHour (const int hour)
void setMinute (const int minute)
void setSecond (const int second)
void setZone (const int zone)
void setTime (const int hour=0, const int minute=0, const int second=0, const int zone=GMT)
void setDate (const int year, const int month, const int day)
datetimeoperator= (const datetime &other)
datetimeoperator= (const string &s)
void copyFrom (const component &other)
shared_ptr< componentclone () const
bool operator== (const datetime &other) const
bool operator!= (const datetime &other) const
bool operator< (const datetime &other) const
bool operator<= (const datetime &other) const
bool operator> (const datetime &other) const
bool operator>= (const datetime &other) const
const std::vector< shared_ptr< component > > getChildComponents ()
Public Member Functions inherited from headerFieldValue
size_t getGeneratedSize (const generationContext &ctx)
Public Member Functions inherited from component
 component ()
virtual ~component ()
void parse (const string &buffer)
void parse (const parsingContext &ctx, const string &buffer)
void parse (shared_ptr< utility::inputStream > inputStream, const size_t length)
void parse (const string &buffer, const size_t position, const size_t end, size_t *newPosition=NULL)
void parse (const parsingContext &ctx, const string &buffer, const size_t position, const size_t end, size_t *newPosition=NULL)
void parse (shared_ptr< utility::inputStream > inputStream, const size_t position, const size_t end, size_t *newPosition=NULL)
void parse (const parsingContext &ctx, shared_ptr< utility::inputStream > inputStream, const size_t position, const size_t end, size_t *newPosition=NULL)
virtual const string generate (const size_t maxLineLength=lineLengthLimits::infinite, const size_t curLinePos=0) const
virtual void generate (utility::outputStream &outputStream, const size_t curLinePos=0, size_t *newLinePos=NULL) const
virtual void generate (const generationContext &ctx, utility::outputStream &outputStream, const size_t curLinePos=0, size_t *newLinePos=NULL) const
size_t getParsedOffset () const
size_t getParsedLength () const

Static Public Member Functions

static const datetime now ()

Protected Member Functions

void parseImpl (const parsingContext &ctx, const string &buffer, const size_t position, const size_t end, size_t *newPosition=NULL)
void generateImpl (const generationContext &ctx, utility::outputStream &os, const size_t curLinePos=0, size_t *newLinePos=NULL) const
Protected Member Functions inherited from component
void setParsedBounds (const size_t start, const size_t end)
virtual void parseImpl (const parsingContext &ctx, shared_ptr< utility::parserInputStreamAdapter > parser, const size_t position, const size_t end, size_t *newPosition=NULL)
Protected Member Functions inherited from object
 object ()
 object (const object &)
objectoperator= (const object &)
virtual ~object ()

Detailed Description

Date and time (basic type).

Member Enumeration Documentation

◆ DaysOfWeek

enum DaysOfWeek
Enumerator
SUNDAY 
MONDAY 
TUESDAY 
WEDNESDAY 
THURSDAY 
FRIDAY 
SATURDAY 
SUN 
MON 
TUE 
WED 
THU 
FRI 
SAT 

◆ Months

enum Months
Enumerator
JANUARY 
FEBRUARY 
MARCH 
APRIL 
MAY 
JUNE 
JULY 
AUGUST 
SEPTEMBER 
OCTOBER 
NOVEMBER 
DECEMBER 
JAN 
FEB 
MAR 
APR 
JUN 
JUL 
AUG 
SEP 
OCT 
NOV 
DEC 

◆ TimeZones

enum TimeZones
Enumerator
GMT_12 
GMT_11 
GMT_10 
GMT_9 
GMT_8 
GMT_7 
GMT_6 
GMT_5 
GMT_4 
GMT_3 
GMT_2 
GMT_1 
GMT 
GMT1 
GMT2 
GMT3 
GMT4 
GMT5 
GMT6 
GMT7 
GMT8 
GMT9 
GMT10 
GMT11 
GMT12 
UT 
EST 
EDT 
CST 
CDT 
MST 
MDT 
PST 
PDT 

Constructor & Destructor Documentation

◆ datetime() [1/6]

◆ datetime() [2/6]

datetime ( const int year,
const int month,
const int day )

◆ datetime() [3/6]

datetime ( const int year,
const int month,
const int day,
const int hour,
const int minute,
const int second,
const int zone = GMT )

◆ datetime() [4/6]

datetime ( const datetime & d)

References datetime().

◆ datetime() [5/6]

datetime ( const string & date)

References component::parse().

◆ datetime() [6/6]

datetime ( const time_t t,
const int zone = GMT )

◆ ~datetime()

~datetime ( )

Member Function Documentation

◆ clone()

shared_ptr< component > clone ( ) const
virtual

Clone this component.

Returns
a copy of this component

Implements component.

◆ copyFrom()

void copyFrom ( const component & other)
virtual

Replace data in this component by data in other component.

Both components must be of the same type.

Exceptions
std::bad_cast_exceptionif the components are not of the same (dynamic) type
Parameters
otherother component to copy data from

Implements component.

References datetime().

Referenced by operator=().

◆ generateImpl()

void generateImpl ( const generationContext & ctx,
utility::outputStream & os,
const size_t curLinePos = 0,
size_t * newLinePos = NULL ) const
protectedvirtual

Implements component.

References getWeekDay().

◆ getChildComponents()

const std::vector< shared_ptr< component > > getChildComponents ( )
virtual

Return the list of children of this component.

Returns
list of child components

Implements component.

◆ getDate()

void getDate ( int & year,
int & month,
int & day ) const

◆ getDay()

int getDay ( ) const

◆ getHour()

int getHour ( ) const

◆ getMinute()

int getMinute ( ) const

◆ getMonth()

int getMonth ( ) const

◆ getSecond()

int getSecond ( ) const

◆ getTime() [1/2]

void getTime ( int & hour,
int & minute,
int & second ) const

◆ getTime() [2/2]

void getTime ( int & hour,
int & minute,
int & second,
int & zone ) const

◆ getWeek()

int getWeek ( ) const

◆ getWeekDay()

int getWeekDay ( ) const

References datetimeUtils::getDayOfWeek().

Referenced by generateImpl().

◆ getYear()

int getYear ( ) const

Referenced by parseImpl().

◆ getZone()

int getZone ( ) const

◆ now()

◆ operator!=()

bool operator!= ( const datetime & other) const

◆ operator<()

bool operator< ( const datetime & other) const

◆ operator<=()

bool operator<= ( const datetime & other) const

◆ operator=() [1/2]

datetime & operator= ( const datetime & other)

References copyFrom(), and datetime().

◆ operator=() [2/2]

datetime & operator= ( const string & s)

References datetime(), and component::parse().

◆ operator==()

bool operator== ( const datetime & other) const

◆ operator>()

bool operator> ( const datetime & other) const

◆ operator>=()

bool operator>= ( const datetime & other) const

◆ parseImpl()

void parseImpl ( const parsingContext & ctx,
const string & buffer,
const size_t position,
const size_t end,
size_t * newPosition = NULL )
protectedvirtual

◆ setDate()

void setDate ( const int year,
const int month,
const int day )

◆ setDay()

void setDay ( const int day)

◆ setHour()

void setHour ( const int hour)

◆ setMinute()

void setMinute ( const int minute)

◆ setMonth()

void setMonth ( const int month)

◆ setSecond()

void setSecond ( const int second)

◆ setTime()

void setTime ( const int hour = 0,
const int minute = 0,
const int second = 0,
const int zone = GMT )

◆ setYear()

void setYear ( const int year)

◆ setZone()

void setZone ( const int zone)

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