Project 1
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Event Class Reference

#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)
 

Detailed Description

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.

Author
Mark Maloof (maloof cs georgetown edu)
Version
1.1, 11/28/12
1.2, 11/10/16
1.3, 01/07/19
1.4, 01/08/20

Constructor & Destructor Documentation

◆ 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.

Member Function Documentation

◆ getLocation()

string Event::getLocation ( ) const

Returns this Event object's location.

Returns
a string representing this object's location

◆ getName()

string Event::getName ( ) const

Returns this Event object's name.

Returns
a string representing this object's name

◆ getStatus()

char Event::getStatus ( ) const

Returns this Event object's status.

Returns
a character representing this object's status

◆ matchNameOrLocation()

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.

Parameters
querythe search string
Returns
a bool indicating whether the event matches

◆ operator!=()

bool Event::operator!= ( const Event e) const

Returns true if this object's unique identifier is not equal to that of the Event object passed as the parameter; returns false otherwise.

Parameters
ethe Event object to be compared
Returns
the bool indicating whether the objects are not equal

◆ operator<()

bool Event::operator< ( const Event e) const

Returns true if this Event object's modification date is less than (i.e., earlier than) the parameter's modification date; returns false otherwise.

Parameters
ethe Event object to be compared
Returns
the bool indicating whether this object is less than the parameter

◆ operator==()

bool Event::operator== ( const Event e) const

Returns true if this object's unique identifier is equal to that of the Event object passed as the parameter; returns false otherwise.

Parameters
ethe Event object to be compared
Returns
the bool indicating whether the objects are equal

◆ operator>()

bool Event::operator> ( const Event e) const

Returns true if this Event object's modification date is greater than (i.e., later than) the parameter's modification date; returns false otherwise.

Parameters
ethe Event object to be compared
Returns
the bool indicating whether this object is greater than the parameter

◆ print()

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).

Parameters
outthe output stream for writing

◆ readDoubleQuotedString()

string Event::readDoubleQuotedString ( istream &  in) const
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.

Parameters
inthe input stream for reading
Returns
a string containing the character sequence

◆ setStatus()

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.

Parameters
statusa character indicating this Event object's status
Exceptions
invalid_argumentif an argument's value is invalid

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  out,
const Event e 
)
friend

Inserts an Event object in the internal format into the output stream, and returns the modified output stream.

Parameters
outthe output stream for insertion
ethe Event for insertion
Returns
the modified output stream

◆ operator>>

istream& operator>> ( istream &  in,
Event e 
)
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.

Parameters
inthe input stream for extraction
ethe Event for storing the extracted information
Returns
the modified input stream
Exceptions
invalid_argumentif an argument's value is invalid

Member Data Documentation

◆ end

DateTime Event::end
private

the date and end time of the event

◆ id

string Event::id
private

the unique identifier of the event record

◆ location

string Event::location
private

the location of the event

◆ modified

DateTime Event::modified
private

the date and time of the event record's last modification

◆ name

string Event::name
private

the name of the event

◆ start

DateTime Event::start
private

the date and start time of the event

◆ status

char Event::status
private

the status of the event record


The documentation for this class was generated from the following files: