Summary Files Commits Branches @commit @diff @stats
path: root / Year 1 / Object-oriented Programming / Project 1 / src / Models / Reservation.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/Reservation.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, 50 insertions, 0 deletions
-rw-r--r--Year 1/Object-oriented Programming/Project 1/src/Models/Reservation.h50
diff --git a/Year 1/Object-oriented Programming/Project 1/src/Models/Reservation.h b/Year 1/Object-oriented Programming/Project 1/src/Models/Reservation.h
new file mode 100644
index 0000000..10035b9
--- /dev/null
+++ b/Year 1/Object-oriented Programming/Project 1/src/Models/Reservation.h
@@ -0,0 +1,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