FMI Ticket System
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 1 | Project Topic 4 |
Public Member Functions | Friends | List of all members
Reservation Class Reference

Each Reservations contains a ticket, a password and a note. More...

#include <Reservation.h>

Public Member Functions

 Reservation ()
 Sets ticket as default value and leaves password and note blank.
 
 Reservation (const Ticket &ticket)
 Sets ticket and leaves password and note blank.
 
 Reservation (const Ticket &ticket, const char *password, const char *note)
 Sets ticket, password and note.
 
const Ticket & get_ticket () const
 Returns constant reference to ticket.
 
const char * get_password () const
 Returns constant C-style string to password.
 
const char * get_note () const
 Returns constant C-style string to note.
 
void read (std::istream &istr)
 Reads Reservation from stream. More...
 
void write (std::ostream &ostr) const
 Writes Reservation to stream. More...
 
int compare (const Reservation &other) const
 Compares two Reservations. More...
 

Friends

std::istream & operator>> (std::istream &istr, Reservation &reservation)
 Reads Reservation from stream with >> operator. More...
 
std::ostream & operator<< (std::ostream &ostr, const Reservation &reservation)
 Writes Reservation to stream with << operator. More...
 

Detailed Description

Each Reservations contains a ticket, a password and a note.

Member Function Documentation

◆ compare()

int Reservation::compare ( const Reservation &  other) const

Compares two Reservations.

Returns
Compares tickets

◆ read()

void Reservation::read ( std::istream &  istr)

Reads Reservation from stream.

Parameters
istrAn input stream

Directly reads bytes from stream (calls read() function). Uses ticket's read() function.

Remarks
Doesn't alter the stream in any other way.
Note
Best used with binary ifstream

◆ write()

void Reservation::write ( std::ostream &  ostr) const

Writes Reservation to stream.

Parameters
ostrAn output stream

Directly writes bytes to stream (calls write() function). Uses ticket's write() function.

Remarks
Doesn't alter the stream in any other way.
Note
Best used with binary ofstream

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  ostr,
const Reservation &  reservation 
)
friend

Writes Reservation to stream with << operator.

Uses the stream's << operator to write the ticket only.

Note
Best used with std::cout or text std::ofstream

◆ operator>>

std::istream & operator>> ( std::istream &  istr,
Reservation &  reservation 
)
friend

Reads Reservation from stream with >> operator.

Uses the stream's >> operator to read and parse the ticket. Password and note are left blank.

Note
Best used with std::cin or text std::ifstream

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