Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Reservation.h
blob: 10035b98dcac6ef02637bca789a07b0596cfa4b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef HEADER_MODEL_RESERVATION
#define HEADER_MODEL_RESERVATION

/*! \file Reservation.h
 *  \brief Stores the declaration of class Reservation
 */

#include "Ticket.h"
#include <istream>
#include <ostream>

#define PASSWORD_LEN 8
#define NOTE_LEN 32

/*! \brief Each Reservations contains a ticket, a password and a note
 */
class Reservation {
	Ticket ticket;
	char password[PASSWORD_LEN];
	char note[NOTE_LEN];

public:
	//! Sets ticket as default value and leaves password and note blank
	Reservation();
	//! Sets ticket and leaves password and note blank
	Reservation(const Ticket& ticket);
	//! Sets ticket, password and note
	Reservation(const Ticket& ticket, const char* password, const char* note);

	//! Returns constant reference to ticket
	const Ticket& get_ticket() const;
	//! Returns constant C-style string to password
	const char* get_password() const;
	//! Returns constant C-style string to note
	const char* get_note() const;

	//! Reads Reservation from stream
	void read(std::istream& istr);
	//! Writes Reservation to stream
	void write(std::ostream& ostr) const;
	//! Compares two Reservations
	int compare(const Reservation& other) const;

	//! Reads Reservation from stream with >> operator
	friend std::istream& operator>>(std::istream& istr, Reservation& reservation);
	//! Writes Reservation to stream with << operator
	friend std::ostream& operator<<(std::ostream& ostr, const Reservation& reservation);
};

#endif