Project 1
|
#include <event.h>
Public Member Functions | |
Event () | |
string | getName () const |
string | getLocation () const |
char | getStatus () const |
bool | matchNameOrLocation (const string &query) const |
bool | operator== (const Event &e) const |
bool | operator!= (const Event &e) const |
bool | operator< (const Event &e) const |
bool | operator> (const Event &e) const |
void | print (ostream &out=cout) const |
void | setStatus (char status) |
Private Member Functions | |
string | readDoubleQuotedString (istream &in) const |
Private Attributes | |
char | status |
string | id |
string | name |
string | location |
DateTime | start |
DateTime | end |
DateTime | modified |
Friends | |
ostream & | operator<< (ostream &out, const Event &e) |
istream & | operator>> (istream &in, Event &e) |
A class for storing information about a calendar event. An Event consists of a status, a unique identifier, a name, a location, a start date and time, an end date and time, and a date and time of the event's last modification. The class include methods for reading and writing events in both external and internal formats. That is, the internal format consists of all information, which is required for transfer, storage, and synchronization. The external format consists of information required for a user view: the name, location, and start and end times of the event.
Event::Event | ( | ) |
Default constructor. Sets status to a default value of 'A', indicating an active record. String and DateTime objects keep their default values.
string Event::getLocation | ( | ) | const |
Returns this Event object's location.
string Event::getName | ( | ) | const |
Returns this Event object's name.
char Event::getStatus | ( | ) | const |
Returns this Event object's status.
bool Event::matchNameOrLocation | ( | const string & | query | ) | const |
Returns true if this event is active and the query is found in its name or location; returns false otherwise.
query | the search string |
bool Event::operator!= | ( | const Event & | e | ) | const |
bool Event::operator< | ( | const Event & | e | ) | const |
bool Event::operator== | ( | const Event & | e | ) | const |
bool Event::operator> | ( | const Event & | e | ) | const |
void Event::print | ( | ostream & | out = cout | ) | const |
Prints this Event object in the external format (i.e., a format that would be useful for display in an interface).
out | the output stream for writing |
|
private |
Reads the next character sequence between two double quotation marks from the input stream and returns the characters as a string. The first printable character in the stream must be a double quote.
in | the input stream for reading |
void Event::setStatus | ( | char | status | ) |
Sets the status of this Event object. The status of an Event object is either 'A' for an active event or 'D' for a deleted object. For invalid values for status, the method directly throws invalid_argument.
status | a character indicating this Event object's status |
invalid_argument | if an argument's value is invalid |
|
friend |
|
friend |
Extracts an Event object in an internal format from the input stream and returns the modified input stream. The internal format of an object consists of its status, unique identifier, name, location, start date and time, end date and time, and the date and time of the event's last modification. Indirectly throws an exception if the input stream contains an invalid value.
in | the input stream for extraction |
e | the Event for storing the extracted information |
invalid_argument | if an argument's value is invalid |
|
private |
the date and end time of the event
|
private |
the unique identifier of the event record
|
private |
the location of the event
|
private |
the date and time of the event record's last modification
|
private |
the name of the event
|
private |
the date and start time of the event
|
private |
the status of the event record