home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ool.zip / OOL / include / xtime.h < prev    next >
Text File  |  1997-02-23  |  3KB  |  60 lines

  1. #ifndef __OOL_XTIME_H__
  2. #define __OOL_XTIME_H__
  3.  
  4. /*===========================================================================*/
  5. /* OOL ------------------- the Open Object Library ------------- OS/2 Beta 1 */
  6. /*===========================================================================*/
  7. /*                              class: XTime                                 */
  8. /*                       derived from: XObject                               */
  9. /*                        last update: 12/96                                 */
  10. /*                      programmed by: Stefan von Brauk (sbrauk@gwdg.de)     */
  11. /*===========================================================================*/
  12.  
  13. #include "xobject.h"
  14. #include "string.h"
  15.  
  16.  
  17. class XString;
  18.  
  19. typedef struct XTimeStructure{
  20.     UCHAR hours;
  21.    UCHAR minutes;
  22.    UCHAR seconds;
  23.    BOOL dayLightSave;
  24. } XTimeStruct;
  25.  
  26. class _export_ XTime: public XObject
  27. {
  28.       friend class XContainerObject;
  29.       friend class XIO;
  30.       friend class XFileInfo;
  31. /*
  32.       friend _export_ BOOL operator == (const XTime &t1, const XTime &t2);
  33.       friend _export_ BOOL operator != (const XTime &t1, const XTime &t2);
  34.       friend _export_ BOOL operator < (const XTime &t1, const XTime &t2);
  35.       friend _export_ BOOL operator > (const XTime &t1, const XTime &t2);
  36. */
  37.    private:
  38.       XTimeStructure t;
  39.    public:
  40.       XTime( UCHAR hours=0, UCHAR minutes=0, UCHAR seconds=0);
  41.       XTime(const XTime &ti) { memcpy(&t, &ti.t,sizeof(t));}
  42.       virtual ~XTime() {;}
  43.       SHORT Compare( const XTime*) const;
  44.       void GetCurrentTime( void);
  45.       UCHAR GetHours(void) const { return t.hours; }
  46.       UCHAR GetMinutes(void) const { return t.minutes; }
  47.       UCHAR GetSeconds(void) const { return t.seconds; }
  48.       void Format( XString * buffer, const char * format);
  49.       void SetHours( const UCHAR hours ) { t.hours = hours; }
  50.       void SetMinutes( const UCHAR minutes ) { t.minutes = minutes; }
  51.       void SetSeconds( const UCHAR seconds ) { t.seconds = seconds; }
  52.       XTime operator =(const XTime &ti) { memcpy(&t, &ti.t,sizeof(t)); return *this; }
  53.         BOOL operator == (const XTime &ti) { return ( Compare( &ti ) == 0 ? TRUE : FALSE); }
  54.         BOOL operator != (const XTime &ti) { return ( Compare( &ti ) != 0 ? TRUE : FALSE); }
  55.         BOOL operator > (const XTime &ti) { return ( Compare( &ti ) > 0 ? TRUE : FALSE); }
  56.       BOOL operator <(const XTime& ti) { return( Compare(&ti) < 0 ? TRUE : FALSE); }
  57. };
  58.  
  59. #endif
  60.