Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
Commit0802d9d40c70e960def1fb70f650b26b75c39049 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-05 13:38:27 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-05 13:38:27 +0300
Files633f66a41f839e6cce280dd7d7d823c25ba0e382 /src
FMI-OOP-P1_TicketSystem-0802d9d40c70e960def1fb70f650b26b75c39049.tar
FMI-OOP-P1_TicketSystem-0802d9d40c70e960def1fb70f650b26b75c39049.tar.gz
FMI-OOP-P1_TicketSystem-0802d9d40c70e960def1fb70f650b26b75c39049.zip
Parent45f11f684101c1683251f591a135fe292268b8f7 (diff)
Autocommit at 05.05.2022 @ 13:38
2 files changed, 14 insertions, 7 deletions
-rw-r--r--src/ConsoleInterface/Toolbox.hpp16
-rw-r--r--src/VenueConsoleUI.cpp5
diff --git a/src/ConsoleInterface/Toolbox.hpp b/src/ConsoleInterface/Toolbox.hpp
index b9f57b6..a198684 100644
--- a/src/ConsoleInterface/Toolbox.hpp
+++ b/src/ConsoleInterface/Toolbox.hpp
@@ -4,6 +4,8 @@
#include "../String/String.h"
#include <iostream>
+#define MAX_LINE_WIDTH 1024
+
template <class T>
void read(T* storage) {
std::cin >> storage;
@@ -46,15 +48,19 @@ void resetOrderedList(int starter = 1) {
orderedListIndex = starter;
}
-template <typename T>
-void inputBox(T* output, const char* label) {
+void inputBoxLabel(const char* label) {
std::cout << "+ " << label;
+}
+
+template <typename T>
+void inputBox(const char* label, T* output) {
+ inputBoxLabel(label);
std::cin >> output;
}
-void inputStrBox(char* output, unsigned maxLength, const char* label) {
- std::cout << "+ " << label;
- std::cin.getline(output, maxLength);
+void inputLineBox(const char* label, char* output, unsigned maxWidth) {
+ inputBoxLabel(label);
+ std::cin.getline(output, maxWidth);
}
#endif
diff --git a/src/VenueConsoleUI.cpp b/src/VenueConsoleUI.cpp
index 45be474..539ad4e 100644
--- a/src/VenueConsoleUI.cpp
+++ b/src/VenueConsoleUI.cpp
@@ -6,8 +6,9 @@
Venue v;
void command_newEvent() {
- String name;
- inputStrBox(name, 1024, "Enter event name: ");
+ char name[MAX_LINE_WIDTH];
+ inputLineBox("Enter event name: ", name, MAX_LINE_WIDTH);
+
v.es.createEvent();
}