Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / Project 1 / src / Models / Event.h
blob: 1162b8f84e29e9453c4f2972cd2d0a3626539742 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef HEADER_MODEL_EVENT
#define HEADER_MODEL_EVENT

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

#include "../Generic/List/OrderedList.hpp"
#include "../Generic/Date/Date.h"
#include "../Generic/String/String.h"
#include "Hall.h"
#include "Ticket.h"
#include "Reservation.h"
#include <istream>
#include <ostream>

/*! \brief Stores an event's hall, name, date, bought tickets and reservations
 */
class Event {
	Hall hall;
	String name;
	Date date;
	OrderedList<Ticket> tickets;
	OrderedList<Reservation> reservations;

public:
	//! Calls default constructors on data
	Event();
	//! Copies given hall and sets name and date
	Event(const Hall& hall, String name, Date date);

	//! Returns constant reference Hall in which event will be held
	const Hall& get_hall() const;
	//! Returns constant reference to name of event
	const String& get_name() const;
	//! Returns constant reference to date on which event will be held
	const Date& get_date() const;

	//! Returns reference to bought tickets
	OrderedList<Ticket>& get_tickets();
	//! Returns constant reference to bought tickets
	const OrderedList<Ticket>& get_tickets() const;
	//! Returns reference to reservations
	OrderedList<Reservation>& get_reservations();
	//! Returns constant reference to reservations
	const OrderedList<Reservation>& get_reservations() const;

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

//! Reads Event from stream with >> operator
std::istream& operator>>(std::istream& istr, Event& event);
//! Configures how Event should be shown, when written to stream with << operator
void configureEventInsertionOp(unsigned setting);
//! Writes Event to stream with << operator
std::ostream& operator<<(std::ostream& ostr, const Event& event);

#endif