Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

mpcl::text::IDate Class Reference

BaseDate abstract data class. More...

#include <date.hh>

Inheritance diagram for mpcl::text::IDate:

mpcl::text::TGmtDate mpcl::text::TLocalDate List of all members.

Public Types

enum  EDateType
 Date types.


Public Methods

 IDate (const int kiYEAR, const int kiMONTH, const int kiDAY, const int kiHOUR=0, const int kiMINUTES=0, const int kiSECONDS=0)
 IDate (const EDateType keDATE_TYPE=eNow) throw (TConstraintException)
IDate & addSeconds (const int kiSECONDS) throw (TConstraintException)
IDate & addMinutes (const int kiMINUTES)
IDate & addHours (const int kiHOURS)
IDate & addDays (const int kiDAYS)
void set (const int kiYEAR, const int kiMONTH, const int kiDAY, const int kiHOUR=0, const int kiMINUTES=0, const int kiSECONDS=0) throw (TConstraintException)
bool empty (void) const
 Tells if a date is empty.

virtual TString get (const char *pkcDATE_FORMAT) const=0
TString get (const TString &rkyDATE_FORMAT) const
bool in (const IDate &rktBEGIN_DATE, const IDate &rktEND_DATE) const
bool operator== (const IDate &rktDATE) const throw (TConstraintException)
bool operator< (const IDate &rktDATE) const throw (TConstraintException)
TTimeInterval operator- (const IDate &rktDATE) const

Protected Attributes

time_t tSecondsFromEpoch
 Total number of seconds from the Epoch.


Static Protected Attributes

const int _kiMaxFormattedDate = 517
 Constants.


Detailed Description

BaseDate abstract data class.

Definition at line 103 of file date.hh.


Constructor & Destructor Documentation

mpcl::text::IDate::IDate const int    kiYEAR,
const int    kiMONTH,
const int    kiDAY,
const int    kiHOUR = 0,
const int    kiMINUTES = 0,
const int    kiSECONDS = 0
[inline]
 

Builds a new instance. The base date must be supplied but the hour is optional.

Parameters:
kiYEAR  Year.
kiMONTH  Month.
kiDAY  Day.
kiHOUR  Hour.
kiMINUTES  Minutes.
kiSECONDS  Seconds.

Definition at line 137 of file date.hh.

References set(), and tSecondsFromEpoch.

mpcl::text::IDate::IDate const EDateType    keDATE_TYPE = eNow throw (TConstraintException)
 

Builds a new instance.

Parameters:
keDATE_TYPE  Date type.

Definition at line 37 of file date.cc.


Member Function Documentation

IDate& mpcl::text::IDate::addDays const int    kiDAYS [inline]
 

Adds a specified number of days.

Parameters:
kiDAYS  Days to be added.

Definition at line 195 of file date.hh.

References addSeconds().

IDate& mpcl::text::IDate::addHours const int    kiHOURS [inline]
 

Adds a specified number of hours.

Parameters:
kiHOURS  Hours to be added.

Definition at line 186 of file date.hh.

References addSeconds().

IDate& mpcl::text::IDate::addMinutes const int    kiMINUTES [inline]
 

Adds a specified number of minutes.

Parameters:
kiMINUTESS  Minutess to be added.

Definition at line 177 of file date.hh.

References addSeconds().

IDate& mpcl::text::IDate::addSeconds const int    kiSECONDS throw (TConstraintException) [inline]
 

Adds a specified number of seconds.

Parameters:
kiSECONDS  Seconds to be added.

Definition at line 159 of file date.hh.

References empty(), and tSecondsFromEpoch.

Referenced by addDays(), addHours(), and addMinutes().

TString mpcl::text::IDate::get const TString   rkyDATE_FORMAT const [inline]
 

Gets the current date in an specified strftime-like format.

See also:
std::strftime().

Definition at line 241 of file date.hh.

References get(), and mpcl::text::TString.

virtual TString mpcl::text::IDate::get const char *    pkcDATE_FORMAT const [pure virtual]
 

Gets the current date in an specified strftime-like format.

See also:
std::strftime().

Implemented in mpcl::text::TGmtDate, and mpcl::text::TLocalDate.

Referenced by get().

bool mpcl::text::IDate::in const IDate &    rktBEGIN_DATE,
const IDate &    rktEND_DATE
const [inline]
 

Returns true if this instance is between rktBEGIN_SQL_DATE and rktEND_SQL_DATE dates.

Parameters:
rktBEGIN_SQL_DATE  Beginning date.
rktEND_SQL_DATE  Ending date.
Returns:
True if current date is between beginning and ending dates.

Definition at line 253 of file date.hh.

TTimeInterval mpcl::text::IDate::operator- const IDate &    rktDATE const [inline]
 

Gets the difference in seconds between two IDate objects.

Parameters:
rktDATE  The date to substract.

Definition at line 315 of file date.hh.

References tSecondsFromEpoch.

bool mpcl::text::IDate::operator< const IDate &    rktDATE const throw (TConstraintException) [inline]
 

Returns true if second dates are previous than the first.

Returns:
True if second dates are previous than the first.
Exceptions:
TConstraintException  If at least one of the exceptions is empty.

Definition at line 286 of file date.hh.

References empty(), and tSecondsFromEpoch.

bool mpcl::text::IDate::operator== const IDate &    rktDATE const throw (TConstraintException) [inline]
 

Returns true if two dates are equal.

Returns:
True if two dates are equal.
Exceptions:
TConstraintException  If at least one of the exceptions is empty.

Definition at line 265 of file date.hh.

References empty(), and tSecondsFromEpoch.

void mpcl::text::IDate::set const int    kiYEAR,
const int    kiMONTH,
const int    kiDAY,
const int    kiHOUR = 0,
const int    kiMINUTES = 0,
const int    kiSECONDS = 0
throw (TConstraintException)
 

Sets a new date.

Parameters:
kiYEAR  Year.
kiMONTH  Month.
kiDAY  Day.
kiHOUR  Hour.
kiMINUTES  Minutes.
kiSECONDS  Seconds.
Exceptions:
TConstraintException  When the date isn't valid.

Definition at line 72 of file date.cc.

Referenced by IDate().


The documentation for this class was generated from the following files:
Generated on Mon Oct 13 02:35:25 2003 for MPCL by doxygen1.2.18