From: Christian P. <cp...@us...> - 2004-12-27 05:33:27
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29200/include/pclasses Modified Files: Date.h DateTime.h Time.h Log Message: Added copy & assign operators Index: Date.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Date.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Date.h 26 Dec 2004 17:02:55 -0000 1.1 +++ Date.h 27 Dec 2004 05:33:16 -0000 1.2 @@ -66,6 +66,8 @@ Date(unsigned int year = 1970, unsigned int month = 1, unsigned int day = 1) throw(InvalidDate); + Date(const Date& d) throw(); + ~Date() throw(); double julianDayNumber() const throw(); @@ -89,6 +91,8 @@ //! Test if date is in a leap year bool isInLeapYear() const throw(); + Date& operator=(const Date& d) throw(); + bool operator>(const Date& d) const throw(); bool operator<(const Date& d) const throw(); bool operator>=(const Date& d) const throw(); Index: Time.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Time.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Time.h 26 Dec 2004 16:45:49 -0000 1.1 +++ Time.h 27 Dec 2004 05:33:16 -0000 1.2 @@ -28,44 +28,49 @@ //! Invalid time error class InvalidTime: public RuntimeError { - public: - InvalidTime(const char* _what, const SourceInfo& si) - : RuntimeError(_what, si) {} + public: + InvalidTime(const char* _what, const SourceInfo& si) + : RuntimeError(_what, si) {} }; //! Time class class Time { public: - Time(unsigned int hour = 0, unsigned int minute = 0, - unsigned int second = 0, unsigned int usec = 0) throw(InvalidTime); - ~Time() throw(); + Time(unsigned int hour = 0, unsigned int minute = 0, + unsigned int second = 0, unsigned int usec = 0) throw(InvalidTime); + + Time(const Time& t) throw(); - void setHour(unsigned int hour) throw(InvalidTime); - unsigned int hour() const throw(); + ~Time() throw(); - void setMinute(unsigned int minute) throw(InvalidTime); - unsigned int minute() const throw(); + void setHour(unsigned int hour) throw(InvalidTime); + unsigned int hour() const throw(); - void setSecond(unsigned int second) throw(InvalidTime); - unsigned int second() const throw(); + void setMinute(unsigned int minute) throw(InvalidTime); + unsigned int minute() const throw(); - void setUsec(unsigned int usec) throw(InvalidTime); - unsigned int usec() const throw(); + void setSecond(unsigned int second) throw(InvalidTime); + unsigned int second() const throw(); - bool operator>(const Time& t) const throw(); - bool operator<(const Time& t) const throw(); - bool operator>=(const Time& t) const throw(); - bool operator<=(const Time& t) const throw(); - bool operator==(const Time& t) const throw(); - bool operator!=(const Time& t) const throw(); + void setUsec(unsigned int usec) throw(InvalidTime); + unsigned int usec() const throw(); - friend std::ostream& operator << (std::ostream& os, const Time& t); + bool operator>(const Time& t) const throw(); + bool operator<(const Time& t) const throw(); + bool operator>=(const Time& t) const throw(); + bool operator<=(const Time& t) const throw(); + bool operator==(const Time& t) const throw(); + bool operator!=(const Time& t) const throw(); - private: - unsigned char _hour; - unsigned char _minute; - unsigned char _second; - unsigned int _usec; + Time& operator=(const Time& t) throw(); + + friend std::ostream& operator << (std::ostream& os, const Time& t); + + private: + unsigned char _hour; + unsigned char _minute; + unsigned char _second; + unsigned int _usec; }; } // !namespace P Index: DateTime.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/DateTime.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- DateTime.h 27 Dec 2004 05:21:53 -0000 1.1 +++ DateTime.h 27 Dec 2004 05:33:16 -0000 1.2 @@ -34,6 +34,7 @@ public: DateTime(); DateTime(const Date& d, const Time& t, const std::string& tzname = ""); + DateTime(const DateTime& dt); ~DateTime(); //! Returns the name of the timezone @@ -42,6 +43,8 @@ //! Set the timezone void setTimeZone(const std::string& tzname); + DateTime& operator=(const DateTime& dt); + bool operator>(const DateTime& dt) const throw(); bool operator<(const DateTime& dt) const throw(); bool operator>=(const DateTime& dt) const throw(); |