Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / Project 1 / src / Models / Event.h
diff options
context:
space:
mode:
Commit24bdf39e6c21ab846f6c86803761d78a094e05c0 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-26 20:31:26 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-26 20:31:26 +0300
Files1b2077b088098cc7ae6afc946b10a4d680110294 /Year 1/Object-oriented Programming/Project 1/src/Models/Event.h
uni-projects-24bdf39e6c21ab846f6c86803761d78a094e05c0.tar
uni-projects-24bdf39e6c21ab846f6c86803761d78a094e05c0.tar.gz
uni-projects-24bdf39e6c21ab846f6c86803761d78a094e05c0.zip
Parentcbe944835cc0951a946d01f034b4d28ff9874a4e (diff)
Added files from project 1 (mirror)
1 files changed, 63 insertions, 0 deletions
-rw-r--r--Year 1/Object-oriented Programming/Project 1/src/Models/Event.h63
diff --git a/Year 1/Object-oriented Programming/Project 1/src/Models/Event.h b/Year 1/Object-oriented Programming/Project 1/src/Models/Event.h
new file mode 100644
index 0000000..1162b8f
--- /dev/null
+++ b/Year 1/Object-oriented Programming/Project 1/src/Models/Event.h
@@ -0,0 +1,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