Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commit4c1f8f7c13f22fc701206ea56dae30d26aca9bda (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 16:03:34 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 16:03:34 +0300
Files1e916441f2c1cfd1eacd7bac6f7daa9e36c21ff9 /src
FMI-OOP-P1_TicketSystem-4c1f8f7c13f22fc701206ea56dae30d26aca9bda.tar
FMI-OOP-P1_TicketSystem-4c1f8f7c13f22fc701206ea56dae30d26aca9bda.tar.gz
FMI-OOP-P1_TicketSystem-4c1f8f7c13f22fc701206ea56dae30d26aca9bda.zip
Parentdda51cdb8b8495c5d41fc190c6a94d3ff8b1ed52 (diff)
Autocommit at 07.05.2022 @ 16:03
2 files changed, 14 insertions, 4 deletions
-rw-r--r--src/Generic/List/List.hpp9
-rw-r--r--src/Services/EventService.cpp9
diff --git a/src/Generic/List/List.hpp b/src/Generic/List/List.hpp
index d2a759f..2569380 100644
--- a/src/Generic/List/List.hpp
+++ b/src/Generic/List/List.hpp
@@ -25,6 +25,8 @@ public:
T& operator[](unsigned index);
const T& operator[](unsigned index) const;
+ List<T>& operator+=(const List<T> other);
+
std::istream& read(std::istream& istr);
std::ostream& write(std::ostream& ostr) const;
@@ -132,6 +134,13 @@ const T& List<T>::operator[](unsigned index) const {
return elements[index];
}
+template <typename T>
+List<T>& List<T>::operator+=(const List<T> other) {
+ for (unsigned i = 0; i < other.length; i++)
+ add(other[i]);
+ return *this;
+}
+
template <class T>
std::istream& List<T>::read(std::istream& istr) {
istr.read((char*)&length, sizeof(length));
diff --git a/src/Services/EventService.cpp b/src/Services/EventService.cpp
index dd8938f..26c9bb6 100644
--- a/src/Services/EventService.cpp
+++ b/src/Services/EventService.cpp
@@ -1,6 +1,7 @@
#include "EventService.h"
#include "StatusCode.h"
#include <cstring>
+#include <fstream>
/* Private */
@@ -180,9 +181,9 @@ StatusCode EventService::reportReservations(const char* name, const Date& date)
if (date.compare(Date(0, 0, 0)) == 0) cond_date = cond_event_all;
for (unsigned i = 0; i < events.get_count(); i++) {
- for (unsigned j = 0; i < events[i].get_reservations().get_count(); j++) {
- if (cond_name(events[i].get_reservations()[j], name) && cond_date(events[i].get_reservations()[j], date))
- result.add(events[i].get_reservations()[j]);
- }
+ if (cond_name(events[i], name) && cond_date(events[i], date))
+ result += events[i].get_reservations();
}
+
+
}