home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ool.zip / OOL / include / xdate.h < prev    next >
Text File  |  1997-03-09  |  2KB  |  61 lines

  1. #ifndef __OOL_XDATE_H__
  2. #define __OOL_XDATE_H__
  3.  
  4. /*===========================================================================*/
  5. /* OOL ------------------- the Open Object Library ------------- OS/2 Beta 1 */
  6. /*===========================================================================*/
  7. /*                              class: XDate                                 */
  8. /*                       derived from: XObject                               */
  9. /*                        last update: 1/97                                  */
  10. /*                      programmed by: Stefan von Brauk (sbrauk@gwdg.de)     */
  11. /*===========================================================================*/
  12.  
  13.  
  14. #include "xobject.h"
  15. #include "string.h"
  16.  
  17. typedef struct XDateStructure{
  18.     UCHAR days;
  19.     UCHAR months;
  20.     USHORT years;
  21.     UCHAR weekday;
  22.     USHORT dayOfYear;
  23. } XDateStruct;
  24.  
  25.  
  26. class XString;
  27.  
  28.  
  29. class _export_ XDate: public XObject
  30. {
  31.       friend class XContainerObject;
  32.       friend class XIO;
  33.       friend class XFileInfo;
  34.    private:
  35.       XDateStructure d;
  36.    public:
  37.       XDate( UCHAR day=0, UCHAR month=0, SHORT year=0, UCHAR weekd=0, USHORT dayOfYear=0);
  38.       XDate( const XDate& da) { memcpy(&d, &da.d, sizeof(d));}
  39.       virtual ~XDate() {;}
  40.       SHORT Compare(const XDate*d) const;
  41.       void GetCurrentDate( void);
  42.       UCHAR GetDays( void ) const { return d.days; }
  43.       USHORT GetDayOfYear(void) const { return d.dayOfYear; }
  44.       UCHAR GetMonths( void ) const { return d.months; }
  45.       USHORT GetWeekDay( void ) const { return d.weekday; }   
  46.       USHORT GetYears( void ) const { return d.years; }   
  47.       void Format( XString * buffer, const char * format);
  48.       void SetDays( const UCHAR days) { d.days = days; }
  49.       void SetMonths( const UCHAR months) { d.months = months; }
  50.       void SetWeekDay( const UCHAR weekd) { d.weekday = weekd; }
  51.       void SetYears( const USHORT years) { d.years = years; }   
  52.       XDate operator =(const XDate& da) { memcpy(&d, &da.d, sizeof(d)); return *this; }
  53.         BOOL operator == (const XDate &da) { return ( Compare( &da ) == 0 ? TRUE : FALSE); }
  54.         BOOL operator != (const XDate &da) { return ( Compare( &da ) != 0 ? TRUE : FALSE); }
  55.         BOOL operator > (const XDate &da) { return ( Compare( &da ) > 0 ? TRUE : FALSE); }
  56.       BOOL operator <(const XDate& da) { return( Compare(&da) < 0 ? TRUE : FALSE); }
  57. };
  58.  
  59.  
  60. #endif
  61.