Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::PDate Class Reference

#include <PDate.h>

Collaboration diagram for PLearn::PDate:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 PDate ()
 Create a missing date by default.

 PDate (short the_year, unsigned char the_month, unsigned char the_day)
 PDate (int the_year, int the_month, int the_day)
 PDate (int julian_day)
 convert a Julian day into a PDate.

 PDate (string date)
 Initialize a date from a string.

bool isMissing () const
 Missing date handling.

void setMissing ()
string info () const
 returns the date in the format //!< yyyy/mm/dd

bool operator== (const PDate &rhs) const
 Equality comparison.

bool operator!= (const PDate &rhs) const
bool operator< (const PDate &rhs) const
bool operator<= (const PDate &rhs) const
bool operator> (const PDate &rhs) const
bool operator>= (const PDate &rhs) const
int toJulianDay () const
int dayOfWeek () const

Static Public Member Functions

PDate today ()

Public Attributes

short year
 ex: 1983, 2001, -350, ...

unsigned char month
 1..12

unsigned char day
 1..31


Detailed Description

PDate must be a concrete class with no virtual function. Hence it MUST NOT UNDER ANY CONSIDERATION UNDER HEAVY PRISON PENALTY derive from Object.

Definition at line 62 of file PDate.h.


Constructor & Destructor Documentation

PLearn::PDate::PDate  ) 
 

Create a missing date by default.

Definition at line 51 of file PDate.cc.

References setMissing().

Referenced by today().

PLearn::PDate::PDate short  the_year,
unsigned char  the_month,
unsigned char  the_day
[inline]
 

Definition at line 72 of file PDate.h.

References day, month, and year.

PLearn::PDate::PDate int  the_year,
int  the_month,
int  the_day
[inline]
 

Definition at line 75 of file PDate.h.

References day, month, and year.

PLearn::PDate::PDate int  julian_day  ) 
 

convert a Julian day into a PDate.

Day 0 of the Julian calendar is about 6000 years ago...

Definition at line 56 of file PDate.cc.

References day, month, and year.

PLearn::PDate::PDate string  date  ) 
 

Initialize a date from a string.

Currently recognized formats are: "2003/01/27", "27JAN2003"

Definition at line 72 of file PDate.cc.

References day, month, PLearn::pl_isnumber(), PLERROR, PLearn::toint(), and year.


Member Function Documentation

int PLearn::PDate::dayOfWeek  )  const [inline]
 

Definition at line 126 of file PDate.h.

References toJulianDay().

Referenced by PLearn::VMatLanguage::run().

string PLearn::PDate::info  )  const
 

returns the date in the format //!< yyyy/mm/dd

Definition at line 140 of file PDate.cc.

References day, month, PLearn::right(), slash, PLearn::tostring(), and year.

Referenced by PLearn::operator<<().

bool PLearn::PDate::isMissing  )  const
 

Missing date handling.

Definition at line 128 of file PDate.cc.

References day, month, and year.

Referenced by PLearn::SDBVMFieldDateDiff::convertField(), and PLearn::date_to_float().

bool PLearn::PDate::operator!= const PDate rhs  )  const [inline]
 

Definition at line 97 of file PDate.h.

bool PLearn::PDate::operator< const PDate rhs  )  const [inline]
 

Definition at line 101 of file PDate.h.

References day, month, and year.

bool PLearn::PDate::operator<= const PDate rhs  )  const [inline]
 

Definition at line 107 of file PDate.h.

bool PLearn::PDate::operator== const PDate rhs  )  const [inline]
 

Equality comparison.

Definition at line 93 of file PDate.h.

References day, month, and year.

bool PLearn::PDate::operator> const PDate rhs  )  const [inline]
 

Definition at line 111 of file PDate.h.

bool PLearn::PDate::operator>= const PDate rhs  )  const [inline]
 

Definition at line 115 of file PDate.h.

void PLearn::PDate::setMissing  ) 
 

Definition at line 133 of file PDate.cc.

References day, month, and year.

Referenced by PLearn::SDBVMFieldDateDiff::convertField(), and PDate().

PDate PLearn::PDate::today  )  [inline, static]
 

Definition at line 129 of file PDate.h.

References PDate().

int PLearn::PDate::toJulianDay  )  const
 

Convert a PDate into a Julian day. See http://quasar.as.utexas.edu/BillInfo/JulianDatesG.html (if still existing...) for details.

Definition at line 147 of file PDate.cc.

References day, month, PLERROR, and year.

Referenced by PLearn::SDBVMFieldDateDiff::convertField(), dayOfWeek(), PLearn::operator+(), PLearn::operator-(), and PLearn::VMatLanguage::run().


Member Data Documentation

unsigned char PLearn::PDate::day
 

1..31

Definition at line 67 of file PDate.h.

Referenced by PLearn::SDBVMFieldDay::convertField(), PLearn::SDBVMFieldDate::convertField(), PLearn::date_to_float(), PLearn::float_to_date(), info(), PLearn::FieldValue::isMissing(), isMissing(), operator<(), operator==(), PDate(), PLearn::VMatLanguage::run(), PLearn::JulianDateCommand::run(), PLearn::FieldValue::setMissing(), setMissing(), and toJulianDay().

unsigned char PLearn::PDate::month
 

1..12

Definition at line 66 of file PDate.h.

Referenced by PLearn::FinancePreprocVMatrix::build_(), PLearn::SDBVMFieldICBCTargets::convertField(), PLearn::SDBVMFieldDateDiff::convertField(), PLearn::SDBVMFieldMonths::convertField(), PLearn::SDBVMFieldDay::convertField(), PLearn::SDBVMFieldDate::convertField(), PLearn::date_to_float(), PLearn::float_to_date(), info(), PLearn::FieldValue::isMissing(), isMissing(), operator<(), operator==(), PDate(), PLearn::VMatLanguage::run(), PLearn::JulianDateCommand::run(), PLearn::FieldValue::setMissing(), setMissing(), and toJulianDay().

short PLearn::PDate::year
 

ex: 1983, 2001, -350, ...

Definition at line 65 of file PDate.h.

Referenced by PLearn::SDBVMFieldICBCTargets::convertField(), PLearn::SDBVMFieldDateDiff::convertField(), PLearn::SDBVMFieldMonths::convertField(), PLearn::SDBVMFieldDay::convertField(), PLearn::SDBVMFieldDate::convertField(), PLearn::date_to_float(), PLearn::float_to_date(), info(), PLearn::FieldValue::isMissing(), isMissing(), operator<(), operator==(), PDate(), PLearn::VMatLanguage::run(), PLearn::JulianDateCommand::run(), PLearn::FieldValue::setMissing(), setMissing(), and toJulianDay().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:22:35 2004 for PLearn by doxygen 1.3.7