Website Summary Files Commits Branches @commit @diff @stats
path: root / src
diff options
context:
space:
mode:
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();
}