Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic / ConsoleInterface
diff options
context:
space:
mode:
Commit51e29b000ab58844060bdaea1a916a6ce637cec6 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-29 08:33:59 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-29 08:33:59 +0300
Filescea0155b8584b17fab5e20617bf1d844432a7352 /src/Generic/ConsoleInterface
FMI-OOP-P2_Tables-51e29b000ab58844060bdaea1a916a6ce637cec6.tar
FMI-OOP-P2_Tables-51e29b000ab58844060bdaea1a916a6ce637cec6.tar.gz
FMI-OOP-P2_Tables-51e29b000ab58844060bdaea1a916a6ce637cec6.zip
Parentf2ca647734572a2ab85228126c7b4c560536da52 (diff)
Autocommit at 29.05.2022 @ 08:33
3 files changed, 7 insertions, 13 deletions
-rw-r--r--src/Generic/ConsoleInterface/Menu.cpp7
-rw-r--r--src/Generic/ConsoleInterface/Toolbox.cpp4
-rw-r--r--src/Generic/ConsoleInterface/Toolbox.hpp9
diff --git a/src/Generic/ConsoleInterface/Menu.cpp b/src/Generic/ConsoleInterface/Menu.cpp
index c6e842a..90efc60 100644
--- a/src/Generic/ConsoleInterface/Menu.cpp
+++ b/src/Generic/ConsoleInterface/Menu.cpp
@@ -34,11 +34,12 @@ void Menu::navigate() const {
}
char buffer[MAX_LINE_WIDTH];
- unsigned startIndex = 0;
while (strncmp(buffer, "quit", 4) != 0) {
- startIndex = 0;
- inputLineBox("> ", buffer, MAX_LINE_WIDTH);
+ unsigned startIndex = 0;
+ inputLineBox(buffer, MAX_LINE_WIDTH, true);
+
+ std::cout << "\"" << buffer << "\"" << std::endl;
while (buffer[startIndex] == ' ') startIndex++;
diff --git a/src/Generic/ConsoleInterface/Toolbox.cpp b/src/Generic/ConsoleInterface/Toolbox.cpp
index cb17b47..dd88762 100644
--- a/src/Generic/ConsoleInterface/Toolbox.cpp
+++ b/src/Generic/ConsoleInterface/Toolbox.cpp
@@ -16,8 +16,8 @@ void __inputLineBoxGetInput(char* output, unsigned maxWidth, bool ignore) {
*
* Prints "(+)" before the label.
*/
-void inputLineBox(const char* label, char* output, unsigned maxWidth, bool ignore) {
- print(label);
+void inputLineBox(char* output, unsigned maxWidth, bool ignore) {
+ print("> ");
__inputLineBoxGetInput(output, maxWidth, ignore);
}
diff --git a/src/Generic/ConsoleInterface/Toolbox.hpp b/src/Generic/ConsoleInterface/Toolbox.hpp
index 99489f5..66d414b 100644
--- a/src/Generic/ConsoleInterface/Toolbox.hpp
+++ b/src/Generic/ConsoleInterface/Toolbox.hpp
@@ -16,7 +16,7 @@
#define MAX_LINE_WIDTH 1024
//! Prints label, gets a whole line of input and stores it to output
-void inputLineBox(const char* label, char* output, unsigned maxWidth, bool ignore = true);
+void inputLineBox(char* output, unsigned maxWidth, bool ignore = true);
//! Prints a string list as a table
void table(const List<String>& items, unsigned columns);
@@ -57,11 +57,4 @@ void printLine(const T& item) {
std::cout << item << std::endl;
}
-//! Prints a label and then reads user input and stores it
-template <typename T>
-void inputBox(const char* label, T* output) {
- print(label);
- std::cin >> *output;
-}
-
#endif