Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

PhxDates.h

00001 /******************************************************************************
00002 *       04/04/2005 Snugglebear
00003 *       Date utility classes. More to come...
00004 *       PS, don't try compiling this just yet. Makefile.am reflects this.
00005 ******************************************************************************/
00006 
00007 #ifndef PHXDATES_H
00008 #define PHXDATES_H
00009 
00010 #include <Phx/PhxConfig.h>
00011 #include <Phx/PhxTypes.h>
00012 #include <Phx/Util/PhxTimes.h>
00013 
00014 namespace Phx {
00015 class Date
00016 {
00017         private:
00018                 int64_t mDays;          // count of days
00019         public:
00020                 // garden variety constructors
00021                 Date();
00022                 Date(int64_t);
00023                 Date(const Date&);
00024 
00025                 // get & sets
00026                 int64_t days();
00027 
00028                 void days(int64_t);
00029 
00030                 virtual bool operator==(const Date&) const;
00031                 virtual bool operator!=(const Date&) const;
00032                 virtual bool operator<(const Date&) const;
00033                 virtual bool operator>(const Date&) const;
00034                 virtual bool operator<=(const Date&) const;
00035                 virtual bool operator>=(const Date&) const;
00036 
00037                 virtual Date operator+(const Date&) const;
00038                 virtual Date operator-(const Date&) const;
00039                 virtual Date operator*(const Date&) const;
00040                 virtual Date operator/(const Date&) const;
00041                 virtual Date operator%(const Date&) const;
00042 
00043                 virtual Date& operator++();
00044                 virtual Date& operator--();
00045                 virtual Date& operator=(const Date&);
00046                 virtual Date& operator+=(const Date&);
00047                 virtual Date& operator-=(const Date&);
00048                 virtual Date& operator*=(const Date&);
00049                 virtual Date& operator/=(const Date&);
00050                 virtual Date& operator%=(const Date&);
00051 
00052                 virtual Date operator+(const int64_t) const;
00053                 virtual Date operator-(const int64_t) const;
00054                 virtual Date operator*(const int64_t) const;
00055                 virtual Date operator/(const int64_t) const;
00056                 virtual Date operator%(const int64_t) const;
00057 
00058                 virtual Date& operator=(const int64_t);
00059                 virtual Date& operator+=(const int64_t);
00060                 virtual Date& operator-=(const int64_t);
00061                 virtual Date& operator*=(const int64_t);
00062                 virtual Date& operator/=(const int64_t);
00063                 virtual Date& operator%=(const int64_t);
00064 // ostream
00065 };      // end class Date
00066 
00067 class Gregorian : public Date
00068 {
00069         private:
00070                 int16_t mDayOfMonth,    // [1-31] *POSIX really does define it this way
00071                                 mMonth;                 // [0-11] - likewise, number of months since January
00072                 int64_t mYear;                  // reconcile against POSIX, where year is years
00073                                                                 // since 1900
00074                                                                 // don't forget the following issues in the next time object...
00075                                                                 // extras in BSD?
00076                                                                 // long    tm_gmtoff;      /* offset from CUT in seconds */
00077                                                                 // char    *tm_zone;       /* timezone abbreviation */
00078 
00079                 static const int16_t    LB_DAYOFMONTH = 1;
00080                 static const int16_t    UB_DAYOFMONTH = 31;
00081                 static const int16_t    LB_MONTH = 0;
00082                 static const int16_t    UB_MONTH = 11;
00083 
00084         public:
00085                 // garden variety constructors
00086                 Gregorian();
00087                 Gregorian(int16_t, int16_t, int64_t);
00088                 Gregorian(const Gregorian&);
00089 
00090                 // get & sets
00091                 int16_t dayofMonth() const;
00092                 int16_t month() const;
00093                 int64_t year() const;
00094 
00095                 void dayOfMonth(const int16_t);
00096                 void month(const int16_t);
00097                 void year(const int64_t);       
00098                 void printGregorian();
00099 
00100                 bool isLeapYear(const int64_t);
00101                 String monthName(int16_t);
00102                 int16_t daysInMonth(int16_t);
00103                 int32_t syncDate(); 
00104                 void addDay(const int64_t);
00105                 void addMonth(const int64_t);
00106                 void addYear(const int64_t);
00107                 void subtractDay(const int64_t);
00108                 void subtractMonth(const int64_t);
00109                 void subtractYear(const int64_t);
00110                 int64_t dateDiff(const Date&, const String&) const;
00111                 String dateName(const String&) const;
00112                 void dateAdd(const Date&, const String&);
00113 };      // end class Gregorian
00114 
00115 };      // end namespace Phx
00116 #endif

Generated on Wed Dec 21 22:05:37 2005 for Phoenix OSFS by  doxygen 1.4.2