home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ool_main.zip / ool / include / xtime.h < prev    next >
Text File  |  1997-08-12  |  2KB  |  56 lines

  1. #ifndef __OOL_XTIME_H__
  2. #define __OOL_XTIME_H__
  3.  
  4. /*===========================================================================*/
  5. /* OOL ------------------- the Open Object Library ------------------- r 1.0 */
  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.  
  27. class _export_ XTime: public XObject
  28. {
  29.       friend class XContainerObject;
  30.       friend class XIO;
  31.       friend class XFileInfo;
  32.    private:
  33.       XTimeStructure t;
  34.    public:
  35.       XTime( const UCHAR hours=0, const UCHAR minutes=0, const UCHAR seconds=0);
  36.       XTime(const XTime &ti) { memcpy(&t, &ti.t,sizeof(t));}
  37.       virtual ~XTime() {;}
  38.       SHORT Compare( const XTime*) const;
  39.       void GetCurrentTime( void);
  40.       UCHAR GetHours(void) const { return t.hours; }
  41.       UCHAR GetMinutes(void) const { return t.minutes; }
  42.       UCHAR GetSeconds(void) const { return t.seconds; }
  43.       void Format( XString * buffer, const char * format) const ;
  44.       BOOL IsLegalTime(void) const;
  45.       void SetHours( const UCHAR hours ) { t.hours = hours; }
  46.       void SetMinutes( const UCHAR minutes ) { t.minutes = minutes; }
  47.       void SetSeconds( const UCHAR seconds ) { t.seconds = seconds; }
  48.       XTime operator =(const XTime &ti) { memcpy(&t, &ti.t,sizeof(t)); return *this; }
  49.       BOOL operator == (const XTime &ti) { return ( Compare( &ti ) == 0 ? TRUE : FALSE); }
  50.       BOOL operator != (const XTime &ti) { return ( Compare( &ti ) != 0 ? TRUE : FALSE); }
  51.       BOOL operator > (const XTime &ti) { return ( Compare( &ti ) > 0 ? TRUE : FALSE); }
  52.       BOOL operator <(const XTime& ti) { return( Compare(&ti) < 0 ? TRUE : FALSE); }
  53. };
  54.  
  55. #endif
  56.