Time Class Reference
List of all members.
Detailed Description
A class for storing information about time in military format.
- Author:
- Mark Maloof (maloof@cs.georgetown.edu)
- Version:
- 1.0, 8/16/13
Constructor & Destructor Documentation
Default constructor. Sets this time object to 00:00.
Time::Time |
( |
const int |
newHours, |
|
|
const int |
newMinutes | |
|
) |
| | |
Explicit constructor. Sets this time object to the specified hours and minutes. Out-of-range values will not replace default values.
- Parameters:
-
| newHours | the hours of this time object |
| newMinutes | the minutes of this time object |
Member Function Documentation
void Time::add |
( |
const Time & |
time |
) |
|
Adds the specified time object to this time object.
- Parameters:
-
| time | the time object to be added |
void Time::enter |
( |
istream & |
in = cin |
) |
|
Extracts a time in the format "hh:mm" from the specified input stream. If there are problems with the format of the information in the stream, then no values are set. Out-of-range values do not replace current values.
- Parameters:
-
| in | the input stream for reading |
bool Time::equal |
( |
const Time & |
time |
) |
const |
Returns true if this time object is equal to the specified time object; returns false otherwise.
- Parameters:
-
| time | the time object to be compared |
- Returns:
- true if the objects are equal
int Time::getHours |
( |
|
) |
const |
Returns the hours of this time object.
- Returns:
- the hours
int Time::getMinutes |
( |
|
) |
const |
Returns the minutes of this time object.
- Returns:
- the minutes
bool Time::lessThan |
( |
const Time & |
time |
) |
const |
Returns true if this time object is less than the specified time object; returns false otherwise.
- Parameters:
-
| time | the time object to be compared |
- Returns:
- true if this object is less than the specified object
void Time::operator+= |
( |
const Time & |
time |
) |
|
Adds the specified time object to this time object.
- Parameters:
-
| time | the time object to be added |
bool Time::operator< |
( |
const Time & |
time |
) |
const |
Returns true if this time object is less than the specified time object; returns false otherwise.
- Parameters:
-
| time | the time object to be compared |
- Returns:
- true if this object is less than the specified object
bool Time::operator== |
( |
const Time & |
time |
) |
const |
Returns true if this time object is equal to the specified time object; returns false otherwise.
- Parameters:
-
| time | the time object to be compared |
- Returns:
- true if the objects are equal
void Time::print |
( |
ostream & |
out = cout |
) |
const |
Prints this time object to the specified output stream in the format "hh:mm" with no terminating end-of-line character.
- Parameters:
-
| out | the output stream for printing |
void Time::println |
( |
ostream & |
out = cout |
) |
const |
Prints this time object to the specified output stream in the format "hh:mm" with a terminating end-of-line character.
- Parameters:
-
| out | the output stream for printing |
void Time::read |
( |
istream & |
in |
) |
|
Reads a time in the format "hh mm" from the specified input stream. If there are problems with the format of the information in the stream, then no values are set. Out-of-range values do not replace current values.
- Parameters:
-
| in | the specified input stream for reading |
void Time::setHours |
( |
const int |
newHours |
) |
|
Sets the hours of this object to the specified hours, which must be in {0,..., 23}. Out-of-range values do not replace current values.
- Parameters:
-
| newHours | the specified hours |
void Time::setMinutes |
( |
const int |
newMinutes |
) |
|
Sets the minutes of this object to the specified minutes, which must be in {0,..., 59}. Out-of-range values do not replace current values.
- Parameters:
-
| newMinutes | the specified minutes |
void Time::write |
( |
ostream & |
out |
) |
const |
Writes this time object to the specified output stream in the format "hh mm" with no terminating end-of-line character.
- Parameters:
-
| out | the output stream for writing |
Member Data Documentation
the maximum value for hours
the maximum value for minutes
The documentation for this class was generated from the following file: