Time.h++
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __ccxx_Time_hxx
00024 #define __ccxx_Time_hxx
00025
00026 #include <commonc++/Common.h++>
00027 #include <commonc++/String.h++>
00028
00029 #include <ctime>
00030
00031 namespace ccxx {
00032
00038 class COMMONCPP_API Time
00039 {
00040 public:
00041
00043 Time() throw();
00044
00046 Time(uint_t hour, uint_t minute, uint_t second = 0, uint_t msec = 0)
00047 throw();
00048
00050 Time(const Time& other) throw();
00051
00053 virtual ~Time() throw();
00054
00056 void setHour(uint_t hour) throw();
00057
00059 void setHour12(uint_t hour, bool pm = false) throw();
00060
00062 void setMinute(uint_t minute) throw();
00063
00065 void setSecond(uint_t second) throw();
00066
00068 void setMillisecond(uint_t msec) throw();
00069
00073 void setTime(uint_t hour, uint_t minute, uint_t second = 0,
00074 uint_t msec = 0) throw();
00075
00077 inline uint_t getHour() const throw()
00078 { return(_hour); }
00079
00081 inline uint_t getHour12() const throw()
00082 { return(_hour == 0 ? 12 : _hour % 12); }
00083
00085 inline bool isPM() const throw()
00086 { return(_hour >= 12); }
00087
00089 inline bool isAM() const throw()
00090 { return(_hour < 12); }
00091
00093 inline uint_t getMinute() const throw()
00094 { return(_minute); }
00095
00097 inline uint_t getSecond() const throw()
00098 { return(_second); }
00099
00101 inline uint_t getMillisecond() const throw()
00102 { return(_msec); }
00103
00104 bool operator==(const Time& other) const throw();
00105 bool operator<(const Time& other) const throw();
00106 bool operator<=(const Time& other) const throw();
00107
00108 inline bool operator!=(const Time& other) const throw()
00109 { return(! operator==(other)); }
00110
00111 inline bool operator>(const Time& other) const throw()
00112 { return(! operator<=(other)); }
00113
00114 inline bool operator>=(const Time& other) const throw()
00115 { return(! operator<(other)); }
00116
00117 Time& operator=(const Time& other) throw();
00118
00119 protected:
00120
00122 uint_t _hour;
00123 uint_t _minute;
00124 uint_t _second;
00125 uint_t _msec;
00127 };
00128
00129 };
00130
00131 #endif // __ccxx_Time_hxx
00132
00133