#ifndef APPOINTMENT_H_ #define APPOINTMENT_H_ #include // ------------------------------------------------------------------------- /** * This class represents a single appointment that might be stored in * a timetable. The appointment consists of a time and a string * description. The time is stored as an hour number, 0-23 (military * time). * * @author Stephen Edwards * @version Feb 22, 2005 */ class Appointment { public: //~ Constructor ........................................................... // ---------------------------------------------------------- /** * Creates a new Appointment object. * @param anHour the time for this appointment (0-23, military time) * @param aDescription the description of this appointment */ Appointment( int anHour = 0, const std::string& aDescription = "" ); // ---------------------------------------------------------- /** * Destructor. */ virtual ~Appointment(); //~ Methods ............................................................... // ---------------------------------------------------------- /** * Getter for the appointment's description property. * @return the appointment's description */ virtual std::string description() const; // ---------------------------------------------------------- /** * Getter for the appointment's hour property. * @return the appointment's hour (time) as an integer (0-23, * military time) */ virtual int hour() const; // ---------------------------------------------------------- /** * Setter for the appointment's description property. * @param newDescription the new description for this appointment */ virtual void setDescription( const std::string& newDescription ); // ---------------------------------------------------------- /** * Setter for the appointment's hour property. * @param newHour the new hour for this appointment (0-23) */ virtual void setHour( int newHour ); // ---------------------------------------------------------- /** * A convenience setter that takes a time like "9am" or "11pm" and * sets this appointment's hour. * @param time a 12-hour am/pm time for this appointment */ virtual void setTime( const std::string& time ); // ---------------------------------------------------------- /** * Generate a string representation for this appointment, with the * form "11am: dentist" or "2pm: class". The string consists of the * 12-hour time representation with a (lower case) "am" or "pm" * designator, followed by a colon and space, and then the appointment * description. * @return a printable representation of this appointment */ virtual std::string toString() const; // ---------------------------------------------------------- /** * Check for equality with another Appointment. * @param rhs the Appointment to compare with * @return true if this appointment is equal to the rhs */ bool operator==( const Appointment& rhs ) const; // ---------------------------------------------------------- /** * Check for difference from another Appointment. * @param rhs the Appointment to compare with * @return true if this appointment is not equal to the rhs */ bool operator!=( const Appointment& rhs ) const; private: //~ Instance/static variables ............................................. int hr; std::string descr; }; #endif /*APPOINTMENT_H_*/