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

xdate.h

Go to the documentation of this file.
00001 /* $Id: xdate.h,v 1.9 2003/08/16 19:59:39 gkunkel Exp $ 00002 00003 Xbase project source code 00004 00005 This file contains a header file for the xbDate object, which is 00006 used for handling dates. 00007 00008 Copyright (C) 1997 Gary A. Kunkel 00009 00010 This library is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU Lesser General Public 00012 License as published by the Free Software Foundation; either 00013 version 2.1 of the License, or (at your option) any later version. 00014 00015 This library is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public 00021 License along with this library; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 00024 Contact: 00025 00026 Mail: 00027 00028 Technology Associates, Inc. 00029 XBase Project 00030 1455 Deming Way #11 00031 Sparks, NV 89434 00032 USA 00033 00034 Email: 00035 00036 xbase@techass.com 00037 xdb-devel@lists.sourceforge.net 00038 xdb-users@lists.sourceforge.net 00039 00040 See our website at: 00041 00042 xdb.sourceforge.net 00043 00044 */ 00045 00049 #ifndef __XB_XDATE_H__ 00050 #define __XB_XDATE_H__ 00051 00052 #ifdef __GNUG__ 00053 #pragma interface 00054 #endif 00055 00056 #ifdef __WIN32__ 00057 #include <xbase/xbconfigw32.h> 00058 #else 00059 #include <xbase/xbconfig.h> 00060 #endif 00061 00062 #include <xbase/xbstring.h> 00063 00064 #define XB_FMT_WEEK 1 00065 #define XB_FMT_MONTH 2 00066 #define XB_FMT_YEAR 3 00067 00069 00072 class XBDLLEXPORT xbDate { 00073 public: 00074 xbDate(); 00075 xbDate( const char * Date8 ); 00076 xbDate( const xbString &Date8 ); 00077 virtual ~xbDate(); 00078 00080 00082 const xbString & GetDate() const 00083 { return cDate8; }; 00085 00087 xbString & GetDate() 00088 { return cDate8; }; 00090 00092 const xbString & GetFormattedDate() const 00093 { return fDate; }; 00095 00097 xbString & GetFormattedDate() 00098 { return fDate; }; 00099 00100 int SetDate( const char * Date8 ); 00102 00104 int SetDate( const xbString & Date8 ) 00105 { return SetDate((const char *) Date8 ); }; 00106 00107 long JulianDays ( const char *Date8 ) const; 00109 00111 long JulianDays ( const xbString & Date8 ) const 00112 { return JulianDays((const char *) Date8 ); }; 00114 00116 long JulianDays () const 00117 { return JulianDays((const char *) cDate8 ); }; 00118 00119 int YearOf ( const char *Date8 ) const; 00121 00123 int YearOf ( const xbString & Date8 ) const 00124 { return YearOf((const char *) Date8 ); }; 00126 00128 int YearOf () const 00129 { return YearOf((const char *) cDate8 ); }; 00130 00131 int MonthOf ( const char *Date8 ) const; 00133 00135 int MonthOf ( const xbString &Date8 ) const 00136 { return MonthOf((const char *) Date8 ); }; 00138 00140 int MonthOf () const 00141 { return MonthOf(( const char *) cDate8 ); }; 00142 00143 int DayOf ( int Format, const char *Date8 ) const; 00145 00147 int DayOf ( int Format, const xbString &Date8 ) const 00148 { return DayOf( Format, (const char *) Date8 ); }; 00150 00152 int DayOf ( int Format ) const 00153 { return DayOf( Format, (const char *) cDate8 ); }; 00154 00155 int IsLeapYear ( const char *Date8 ) const; 00157 00159 int IsLeapYear ( const xbString &Date8 ) const 00160 { return IsLeapYear((const char *) Date8 ); }; 00162 00164 int IsLeapYear () const 00165 { return IsLeapYear((const char *) cDate8 ); }; 00166 00167 int DateIsValid ( const char *Date8 ) const; 00169 00171 int DateIsValid ( const xbString & Date8 ) const 00172 { return DateIsValid( (const char *) Date8 ); }; 00173 00174 xbString& LastDayOfMonth( const char *Date8 ); 00176 00178 xbString& LastDayOfMonth( const xbString & Date8 ) 00179 { return LastDayOfMonth((const char *) Date8 ); }; 00181 00183 xbString& LastDayOfMonth() 00184 { return LastDayOfMonth((const char *) cDate8 ); }; 00185 00186 xbString& Sysdate (); 00187 xbString& JulToDate8( long ); 00188 00189 xbString& FormatDate( const char *Format, const char *Date8 ); 00191 00193 xbString& FormatDate( const xbString &Format, const char *Date8 ) 00194 { return FormatDate((const char *) Format, Date8 ); }; 00196 00198 xbString& FormatDate( const char *Format, const xbString &Date8 ) 00199 { return FormatDate( Format, (const char *) Date8 ); }; 00201 00203 xbString& FormatDate( const xbString &Format, const xbString &Date8 ) 00204 { return FormatDate((const char *) Format,(const char *) Date8 ); }; 00206 00208 xbString& FormatDate( const char *Format ) 00209 { return FormatDate( (const char *) Format, (const char *) cDate8 ); }; 00211 00213 xbString& FormatDate( const xbString &Format ) 00214 { return FormatDate((const char *) Format, (const char *) cDate8 ); }; 00215 00216 xbString& CharDayOf ( const char *Date8 ); 00218 00220 xbString& CharDayOf ( const xbString &Date8 ) 00221 { return CharDayOf((const char *) Date8 ); }; 00223 00225 xbString& CharDayOf () 00226 { return CharDayOf((const char *) cDate8 ); }; 00227 00228 xbString& CharMonthOf ( const char *Date8 ); 00230 00232 xbString& CharMonthOf ( const xbString &Date8 ) 00233 { return CharMonthOf(( const char *) Date8 ); }; 00235 00237 xbString& CharMonthOf () 00238 { return CharMonthOf(( const char *) cDate8 ); }; 00239 00240 xbString &operator+=( int ); 00241 xbString &operator-=( int ); 00242 xbString &operator++( int ); /* post increment */ 00243 xbString &operator--( int ); /* post increment */ 00244 xbString &operator+ ( int ); 00245 xbString &operator- ( int ); 00246 long operator-( const xbDate & ) const; 00247 int operator==( const xbDate & ) const; 00248 int operator!=( const xbDate & ) const; 00249 int operator< ( const xbDate & ) const; 00250 int operator> ( const xbDate & ) const; 00251 int operator<=( const xbDate & ) const; 00252 int operator>=( const xbDate & ) const; 00253 00254 protected: 00255 void SetDateTables(); 00256 xbString cDate8; /* CCYYMMDD date format */ 00257 xbString fDate; /* other date format */ 00258 static int AggregatedDaysInMonths[2][13]; 00259 static int DaysInMonths[2][13]; 00260 static const xbString *Days[7]; 00261 static const xbString *Months[12]; 00262 }; 00263 00264 #endif // __XB_XDATE_H__ 00265

Generated on Sat Sep 11 04:01:10 2004 for Xbase Class Library by doxygen 1.3.7