#ifndef __OOL_XDATE_H__
#define __OOL_XDATE_H__

/*===========================================================================*/
/* OOL ------------------- the Open Object Library ------------- OS/2 Beta 1 */
/*===========================================================================*/
/*                              class: XDate                                 */
/*                       derived from: XObject                               */
/*                        last update: 1/97                                  */
/*                      programmed by: Stefan von Brauk (sbrauk@gwdg.de)     */
/*===========================================================================*/


#include "xobject.h"
#include "string.h"

typedef struct XDateStructure{
	UCHAR days;
	UCHAR months;
	USHORT years;
	UCHAR weekday;
	USHORT dayOfYear;
} XDateStruct;


class XString;


class _export_ XDate: public XObject
{
      friend class XContainerObject;
      friend class XIO;
      friend class XFileInfo;
   private:
      XDateStructure d;
   public:
      XDate( UCHAR day=0, UCHAR month=0, SHORT year=0, UCHAR weekd=0, USHORT dayOfYear=0);
      XDate( const XDate& da) { memcpy(&d, &da.d, sizeof(d));}
      virtual ~XDate() {;}
      SHORT Compare(const XDate*d) const;
      void GetCurrentDate( void);
      UCHAR GetDays( void ) const { return d.days; }
      USHORT GetDayOfYear(void) const { return d.dayOfYear; }
      UCHAR GetMonths( void ) const { return d.months; }
      USHORT GetWeekDay( void ) const { return d.weekday; }   
      USHORT GetYears( void ) const { return d.years; }   
      void Format( XString * buffer, const char * format);
      void SetDays( const UCHAR days) { d.days = days; }
      void SetMonths( const UCHAR months) { d.months = months; }
      void SetWeekDay( const UCHAR weekd) { d.weekday = weekd; }
      void SetYears( const USHORT years) { d.years = years; }   
      XDate operator =(const XDate& da) { memcpy(&d, &da.d, sizeof(d)); return *this; }
		BOOL operator == (const XDate &da) { return ( Compare( &da ) == 0 ? TRUE : FALSE); }
		BOOL operator != (const XDate &da) { return ( Compare( &da ) != 0 ? TRUE : FALSE); }
		BOOL operator > (const XDate &da) { return ( Compare( &da ) > 0 ? TRUE : FALSE); }
      BOOL operator <(const XDate& da) { return( Compare(&da) < 0 ? TRUE : FALSE); }
};


#endif
