diff options
Autocommit at 07.05.2022 @ 14:48
2 files changed, 27 insertions, 20 deletions
| -rw-r--r-- | src/Generic/ConsoleInterface/Toolbox.cpp | 41 | ||||
| -rw-r--r-- | src/Generic/ConsoleInterface/Toolbox.hpp | 6 |
diff --git a/src/Generic/ConsoleInterface/Toolbox.cpp b/src/Generic/ConsoleInterface/Toolbox.cpp index 145e66c..7fd64ab 100644 --- a/src/Generic/ConsoleInterface/Toolbox.cpp +++ b/src/Generic/ConsoleInterface/Toolbox.cpp @@ -6,6 +6,12 @@ void clear() { std::cout << u8"\033[2J\033[1;1H"; } +void _printSubBoxSpacing() { + std::cout << " "; +} + +/* Title boxes */ + void titleBox(const char* title) { std::cout << std::endl << "=== " << title << " ===" << std::endl; } @@ -16,16 +22,12 @@ void subTitleBox(const char* title) { /* Status boxes */ -void __printSubBoxSpacing() { - std::cout << " "; -} - void successBox(const char* message) { std::cout << "<S> " << message << std::endl; } void successSubBox(const char* message) { - __printSubBoxSpacing(); + _printSubBoxSpacing(); successBox(message); } @@ -34,7 +36,7 @@ void warningBox(const char* message) { } void warningSubBox(const char* message) { - __printSubBoxSpacing(); + _printSubBoxSpacing(); warningBox(message); } @@ -43,26 +45,16 @@ void errorBox(const char* message) { } void errorSubBox(const char* message) { - __printSubBoxSpacing(); + _printSubBoxSpacing(); errorBox(message); } - -void _printOrderedListBeginning() { - std::cout << "[" << orderedListIndex++ << "] "; -} - /* Input line boxes */ void _printInputBoxLabel(const char* label) { std::cout << "(+) " << label; } -void _printInputSubBoxLabel(const char* label) { - std::cout << " "; - _printInputBoxLabel(label); -} - void __inputLineBoxGetInput(char* output, unsigned maxWidth) { std::cin.ignore(); std::cin.getline(output, maxWidth); @@ -74,10 +66,23 @@ void inputLineBox(const char* label, char* output, unsigned maxWidth) { } void inputLineSubBox(const char* label, char* output, unsigned maxWidth) { - _printInputSubBoxLabel(label); + _printSubBoxSpacing(); + _printInputBoxLabel(label); __inputLineBoxGetInput(output, maxWidth); } +/* Ordered list */ + +int orderedListIndex = 1; + +void _printOrderedListBeginning() { + std::cout << "[" << orderedListIndex++ << "] "; +} + +void resetOrderedList(int starter) { + orderedListIndex = starter; +} + /* Table */ void __printTableHeaderNumber(unsigned number) { diff --git a/src/Generic/ConsoleInterface/Toolbox.hpp b/src/Generic/ConsoleInterface/Toolbox.hpp index ebead10..98a2002 100644 --- a/src/Generic/ConsoleInterface/Toolbox.hpp +++ b/src/Generic/ConsoleInterface/Toolbox.hpp @@ -18,13 +18,14 @@ void errorSubBox(const char* message); void inputLineBox(const char* label, char* output, unsigned maxWidth); void inputLineSubBox(const char* label, char* output, unsigned maxWidth); +void pressEnterToContinue(); void resetOrderedList(int starter = 1); void table(unsigned startNumber, unsigned columns, const char* items); +void _printSubBoxSpacing(); void _printInputBoxLabel(const char* label); -void _printInputSubBoxLabel(const char* label); void _printOrderedListBeginning(); template <class T> @@ -72,7 +73,8 @@ void inputBox(const char* label, T* output) { template <typename T> void inputSubBox(const char* label, T* output) { - _printInputSubBoxLabel(label); + _printSubBoxSpacing(); + _printInputBoxLabel(label); std::cin >> *output; } |
