diff options
Autocommit at 05.05.2022 @ 13:53
4 files changed, 17 insertions, 5 deletions
| -rw-r--r-- | src/ConsoleInterface/Toolbox.hpp | 8 | ||||
| -rw-r--r-- | src/Venue/Venue.cpp | 2 | ||||
| -rw-r--r-- | src/Venue/Venue.h | 2 | ||||
| -rw-r--r-- | src/VenueConsoleUI.cpp | 10 |
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) { |
