Date.h++
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __ccxx_Date_hxx
00024 #define __ccxx_Date_hxx
00025
00026 #include <commonc++/Common.h++>
00027 #include <commonc++/String.h++>
00028
00029 namespace ccxx {
00030
00036 class COMMONCPP_API Date
00037 {
00038 public:
00039
00041 static const uint_t JAN;
00043 static const uint_t FEB;
00045 static const uint_t MAR;
00047 static const uint_t APR;
00049 static const uint_t MAY;
00051 static const uint_t JUN;
00053 static const uint_t JUL;
00055 static const uint_t AUG;
00057 static const uint_t SEP;
00059 static const uint_t OCT;
00061 static const uint_t NOV;
00063 static const uint_t DEC;
00064
00065 enum Weekday { Invalid = 0, Monday, Tuesday, Wednesday, Thursday, Friday,
00066 Saturday, Sunday };
00067
00069 Date() throw();
00070
00072 Date(uint_t day, uint_t month, uint_t year) throw();
00073
00075 Date(const Date& other) throw();
00076
00078 virtual ~Date() throw();
00079
00081 void setMonth(uint_t month) throw();
00082
00084 void setDay(uint_t day) throw();
00085
00087 void setYear(uint_t year) throw();
00088
00090 void setDate(uint_t day, uint_t month, uint_t year) throw();
00091
00093 inline uint_t getMonth() const throw()
00094 { return(_month); }
00095
00097 inline uint_t getDay() const throw()
00098 { return(_day); }
00099
00101 inline uint_t getYear() const throw()
00102 { return(_year); }
00103
00105 Weekday getWeekday() const throw();
00106
00108 uint_t getDayOfYear() const throw();
00109
00111 static bool isLeapYear(uint_t year) throw();
00112
00116 uint_t getWeekOfYear() const throw();
00117
00119 bool isValid() const throw();
00120
00121 bool operator==(const Date& other) const throw();
00122 bool operator<(const Date& other) const throw();
00123 bool operator<=(const Date& other) const throw();
00124
00125 inline bool operator!=(const Date& other) const throw()
00126 { return(! operator==(other)); }
00127
00128 inline bool operator>(const Date& other) const throw()
00129 { return(! operator<=(other)); }
00130
00131 inline bool operator>=(const Date& other) const throw()
00132 { return(! operator<(other)); }
00133
00134 Date& operator=(const Date& other) throw();
00135
00136 protected:
00137
00139 uint_t _year;
00140 uint_t _month;
00141 uint_t _day;
00142 mutable Weekday _wday;
00143 mutable uint_t _yday;
00144 mutable int _wnum;
00147 private:
00148
00149 void _recalculate() const;
00150 };
00151
00152 };
00153
00154 #endif // __ccxx_Date_hxx
00155
00156