#ifndef Time_First #define Time_First #ifdef __GNUG__ #pragma interface #endif #include "Types.h" #include "Stream.h" //---- Time -------------------------------------------------------------------- class Time { public: Time(); Time(long msec); Time(const Time&); //----- operators Time operator=(const Time &t); Time operator+=(const Time &t); Time operator-=(const Time &t); Time operator*=(const Time &t); Time operator/=(const Time &t); friend Time operator+(const Time &t1, const Time &t2); friend Time operator-(const Time &t1, const Time &t2); friend Time operator*(const Time &t1, const Time &t2); friend Time operator/(const Time &t1, const Time &t2); //--- conversion operator long() const; const char *AsString() const; //---- relational operators friend bool operator== (const Time &t1, const Time &t2); friend bool operator!= (const Time &t1, const Time &t2); friend bool operator< (const Time &t1, const Time &t2); friend bool operator<= (const Time &t1, const Time &t2); friend bool operator> (const Time &t1, const Time &t2); friend bool operator>= (const Time &t1, const Time &t2); //---- Stream operators friend OStream &operator<< (OStream&, const Time &t); friend IStream &operator>> (IStream&, Time &t); private: long val; }; inline Time::Time() { val= 0; } inline Time::Time(long msec) { val= msec; } inline Time::Time(const Time &t) { val= t.val; } inline Time Time::operator= (const Time &t) { val= t.val; return *this; } inline Time Time::operator+=(const Time &t) { val+= t.val; return *this; } inline Time Time::operator-=(const Time &t) { val-= t.val; return *this; } inline Time Time::operator*=(const Time &t) { val*= t.val; return *this; } inline Time Time::operator/=(const Time &t) { val/= t.val; return *this; } inline Time operator+(const Time &t1, const Time &t2) { return Time(t1.val+t2.val); } inline Time operator-(const Time &t1, const Time &t2) { return Time(t1.val-t2.val); } inline Time operator*(const Time &t1, const Time &t2) { return Time(t1.val*t2.val); } inline Time operator/(const Time &t1, const Time &t2) { return Time(t1.val/t2.val); } inline Time::operator long() const { return val; } inline bool operator== (const Time &t1, const Time &t2) { return t1.val == t2.val; } inline bool operator!= (const Time &t1, const Time &t2) { return t1.val != t2.val; } inline bool operator< (const Time &t1, const Time &t2) { return t1.val < t2.val; } inline bool operator<= (const Time &t1, const Time &t2) { return t1.val <= t2.val; } inline bool operator> (const Time &t1, const Time &t2) { return t1.val > t2.val; } inline bool operator>= (const Time &t1, const Time &t2) { return t1.val >= t2.val; } SimpleMetaDef(Time); #endif