From b844597fd23bc57aa97e231fc90eecfd6322cecc Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sat, 7 May 2022 08:28:27 +0300 Subject: Reorganized whole architecture --- src/Generic/ConsoleInterface/Toolbox.hpp | 76 ++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/Generic/ConsoleInterface/Toolbox.hpp (limited to 'src/Generic/ConsoleInterface/Toolbox.hpp') diff --git a/src/Generic/ConsoleInterface/Toolbox.hpp b/src/Generic/ConsoleInterface/Toolbox.hpp new file mode 100644 index 0000000..ed5d6ac --- /dev/null +++ b/src/Generic/ConsoleInterface/Toolbox.hpp @@ -0,0 +1,76 @@ +#ifndef HEADER_CONSOLEINTERFACE_TOOLBOX +#define HEADER_CONSOLEINTERFACE_TOOLBOX + +#include "../String/String.h" +#include + +#define MAX_LINE_WIDTH 1024 + +void clear(); +void titleBox(const char* title); +void subTitleBox(const char* title); + +void successBox(const char* message); +void warningBox(const char* message); +void errorBox(const char* message); + +void table(unsigned startNumber, unsigned columns, const char* items); + +void inputLineBox(const char* label, char* output, unsigned maxWidth); +void inputLineSubBox(const char* label, char* output, unsigned maxWidth); +void resetOrderedList(int starter = 1); + +void _printInputBoxLabel(const char* label); +void _printInputSubBoxLabel(const char* label); +void _printOrderedListBeginning(); + +template +void read(T* storage) { + std::cin >> storage; +} + +template +void read(T& storage) { + std::cin >> storage; +} + +template +void print(const T* item) { + std::cout << item; +} + +template +void printLine(const T* item) { + std::cout << item << std::endl; +} + +template +void print(const T& item) { + std::cout << item; +} + +template +void printLine(const T& item) { + std::cout << item << std::endl; +} + + +template +void printOrderedListElem(const T& elem) { + _printOrderedListBeginning(); + printLine(elem); +} + +template +void inputBox(const char* label, T* output) { + _printInputBoxLabel(label); + std::cin >> *output; +} + +template +void inputSubBox(const char* label, T* output) { + _printInputSubBoxLabel(label); + std::cin >> *output; +} + +#endif -- cgit v1.3.1-23-gd82d