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

d_Date.h

Go to the documentation of this file.
00001 
00002 #ifndef d_Date_h
00003 #define d_Date_h 1
00004 
00005 #include "oTime.h"
00006 
00007 class _ODLL d_Timestamp;
00008 class _ODLL d_Interval;
00009 
00010 /**
00011  * SEE ALSO: d_Time, d_Timestamp
00012  */
00013 
00014 class _ODLL d_Date : private oTime
00015 {
00016   public:
00017     enum Weekday { Sunday=0, Monday=1, Tuesday=2, Wednesday=3, Thursday=4, Friday=5, Saturday=6};
00018         enum Month { January=1, February=2, March=3, April=4, May=5, June=6, July=7, August=8, September=9,October=10, November=11, December=12};
00019       
00020         d_Date( void );
00021     d_Date(long julian_day);
00022     d_Date(unsigned short year, unsigned short month=1, unsigned short day=1);
00023     d_Date(const d_Date&);
00024     d_Date(const d_Timestamp&);
00025     d_Date& operator=(const d_Date&);
00026     d_Date& operator=(const d_Timestamp&);
00027 
00028     void setDate(unsigned short year, unsigned short month, unsigned short day);
00029 
00030     unsigned short year() const;
00031     unsigned short month() const;
00032     unsigned short day() const;
00033     unsigned short day_of_year() const;
00034     Weekday day_of_week() const;
00035 
00036     static d_Date current();
00037     d_Date& next(Weekday);
00038     d_Date& previous(Weekday);
00039 
00040     d_Date& operator+=(const d_Interval&);
00041     d_Date& operator+=(int ndays);
00042     d_Date& operator++(); // prefix ++d
00043     d_Date operator++(int); // postfix d++
00044     d_Date& operator-=(const d_Interval&);
00045     d_Date& operator-=(int ndays);
00046     d_Date& operator--(); // prefix --d
00047     d_Date operator--(int); // postfix d--
00048     d_Interval operator-(const d_Date&);
00049 
00050 /*
00051     friend d_Date operator+(const d_Date&, const d_Interval&);
00052     friend d_Date operator+(const d_Interval&, const d_Date&);
00053     friend d_Date operator-(const d_Date&, const d_Interval&);
00054     friend int operator==(const d_Date&, const d_Date&);
00055     friend int operator!=(const d_Date&, const d_Date&);
00056     friend int operator<(const d_Date&, const d_Date&);
00057     friend int operator<=(const d_Date&, const d_Date&);
00058     friend int operator>(const d_Date&, const d_Date&);
00059     friend int operator>=(const d_Date&, const d_Date&);
00060     friend int overlaps(const d_Date&, const d_Date&, const d_Date&, const d_Date&);
00061     friend int overlaps(const d_Timestamp&, const d_Timestamp&, const d_Date&, const d_Date&);
00062     friend int overlaps(const d_Date&, const d_Date&, const d_Timestamp&, const d_Timestamp&);
00063 */
00064 
00065     int is_leap_year() const;
00066     static int is_leap_year(unsigned short year);
00067     int is_between(const d_Date&, const d_Date&) const;
00068     static int days_in_year(unsigned short);
00069     int days_in_year() const;
00070     static int days_in_month(unsigned short, unsigned short);
00071     int days_in_month() const;
00072     static int is_valid_date(unsigned short, unsigned short, unsigned short);
00073 
00074   private:
00075     void setCurrent( void );
00076 
00077     static d_Date* staticDate;
00078 };
00079 //------------------------------------------------------------------------------
00080 //------------------------------------------------------------------------------
00081 
00082 #endif

Generated on Fri Nov 29 17:12:13 2002 for Orient ODBMS Just Edition v. 2.0e by doxygen1.3-rc1