Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commit10d1ff68080549476a7529fe662eb3d91d18127b (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-05 13:53:32 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-05 13:53:32 +0300
Filesa64e470d857fb2b8dcc80908cccde79ea82ccd3d /src
FMI-OOP-P1_TicketSystem-10d1ff68080549476a7529fe662eb3d91d18127b.tar
FMI-OOP-P1_TicketSystem-10d1ff68080549476a7529fe662eb3d91d18127b.tar.gz
FMI-OOP-P1_TicketSystem-10d1ff68080549476a7529fe662eb3d91d18127b.zip
Parent9033a1d5f00607672c53168c1aa42bbe8b84384a (diff)
Autocommit at 05.05.2022 @ 13:53
4 files changed, 17 insertions, 5 deletions
-rw-r--r--src/ConsoleInterface/Toolbox.hpp8
-rw-r--r--src/Venue/Venue.cpp2
-rw-r--r--src/Venue/Venue.h2
-rw-r--r--src/VenueConsoleUI.cpp10
diff --git a/src/ConsoleInterface/Toolbox.hpp b/src/ConsoleInterface/Toolbox.hpp
index f7f0447..666ddfc 100644
--- a/src/ConsoleInterface/Toolbox.hpp
+++ b/src/ConsoleInterface/Toolbox.hpp
@@ -64,11 +64,15 @@ void inputLineBox(const char* label, char* output, unsigned maxWidth) {
}
void printTitle(const char* title) {
- std::cout << "## " << title << " ##";
+ std::cout << "## " << title << " ##" << std::endl;
+}
+
+void printSuccess(const char* message) {
+ std::cout << ") " << message << std::endl;
}
void printError(const char* message) {
- std::cout << "! Err: " << message;
+ std::cout << "! Err: " << message << std::endl;
}
#endif
diff --git a/src/Venue/Venue.cpp b/src/Venue/Venue.cpp
index 50fc9c1..dd29463 100644
--- a/src/Venue/Venue.cpp
+++ b/src/Venue/Venue.cpp
@@ -19,6 +19,6 @@ const List<Hall>& Venue::get_halls() const {
return this->halls;
}
-const EventSystem& Venue::get_es() const {
+EventSystem& Venue::get_es() {
return this->es;
}
diff --git a/src/Venue/Venue.h b/src/Venue/Venue.h
index c7ac46c..b23ebb5 100644
--- a/src/Venue/Venue.h
+++ b/src/Venue/Venue.h
@@ -17,7 +17,7 @@ public:
bool hallExists(const Hall& hall) const;
const List<Hall>& get_halls() const;
- const EventSystem& get_es() const;
+ EventSystem& get_es();
};
#endif
diff --git a/src/VenueConsoleUI.cpp b/src/VenueConsoleUI.cpp
index 46161bd..6cdeb31 100644
--- a/src/VenueConsoleUI.cpp
+++ b/src/VenueConsoleUI.cpp
@@ -1,11 +1,19 @@
#include "VenueConsoleUI.h"
#include "String/String.h"
#include "DateTime/DateTime.h"
+#include "EventSystem/StatusCodes.h"
#include "ConsoleInterface/Menu.h"
#include "ConsoleInterface/Toolbox.hpp"
Venue v;
+void handleStatusCode(StatusCode sc) {
+ switch (sc) {
+ case Success: printSuccess("Success!"); break;
+ default: break;
+ }
+}
+
void command_newEvent() {
printTitle("Creating new event");
@@ -21,7 +29,7 @@ void command_newEvent() {
DateTime dt;
inputBox("Enter event date and time: ", &dt);
- v.get_es().createEvent(v.get_halls()[hallIndex], name, dt);
+ handleStatusCode(v.get_es().createEvent(&v.get_halls()[hallIndex], name, dt));
}
void runUI(Venue& venue) {