Date Class Reference
#include <date.h>
List of all members.
Detailed Description
A class for storing dates. Dates are in the format MM/DD/YYYY.
- Author:
- Mark Maloof (maloof@cs)
- Version:
- 1.0, 1/19/11
Constructor & Destructor Documentation
Default constructor. Sets a defalt object to "01/01/1970".
Date::Date |
( |
int |
mm, |
|
|
int |
dd, |
|
|
int |
yy | |
|
) |
| | |
Explicit constructor. Sets the date to the specified values.
- Parameters:
-
| mm | the month, an int value in [1, 12] |
| dd | the day, an int value in [1, 28, 30, 31], depending on the month |
| yy | the year, an int value greater than or equal to 0 |
Member Function Documentation
void Date::input |
( |
istream & |
in |
) |
|
Inputs or reads a Date object in the format "MM/DD/YYYY" from the input stream. Sets the fail bit of the input stream if the object is improperly formatted.
- Parameters:
-
| in | the input stream for reading |
bool Date::operator< |
( |
const Date & |
date |
) |
const |
Returns true if this date is before (i.e., less than) the specified date; returns false otherwise.
- Parameters:
-
- Returns:
- a bool indicating whether this date is before the specified date
bool Date::operator> |
( |
const Date & |
date |
) |
const |
Returns true if this date is after (i.e., greater than) the specified date; returns false otherwise.
- Parameters:
-
- Returns:
- a bool indicating whether this date is after the specified date
void Date::output |
( |
ostream & |
out |
) |
const |
Ouputs this Date object in the format "MM/DD/YYYY" to the specified output stream with an end-of-line character.
- Parameters:
-
void Date::setDate |
( |
int |
mm, |
|
|
int |
dd, |
|
|
int |
yy | |
|
) |
| | |
Sets this Date object. Fails silently by not setting values that are out of range.
- Parameters:
-
| mm | the month, an int value in [1, 12] |
| dd | the day, an int value in [1, 28, 30, 31], depending on the month |
| yy | the year, an int value greater than or equal to 0 |
Friends And Related Function Documentation
ostream& operator<< |
( |
ostream & |
out, |
|
|
const Date & |
date | |
|
) |
| | [friend] |
Returns true if this date is after the specified date; returns false otherwise.
- Parameters:
-
- Returns:
- a bool indicating whether this date is after the parameter Inserts a Date object in the format "MM/DD/YYYY" into the output stream, and returns the modified output stream.
- Parameters:
-
| out | the output stream for insertion |
| date | the Date object for insertion |
- Returns:
- the modified output stream
istream& operator>> |
( |
istream & |
in, |
|
|
Date & |
date | |
|
) |
| | [friend] |
Extracts a Date object in the format "MM/DD/YYYY" from the input stream, and returns the modified input stream.
- Parameters:
-
| in | the input stream for extraction |
| date | the Date object for storing the extracted information |
- Returns:
- the modified input stream
Member Data Documentation
The documentation for this class was generated from the following files: