Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic / ConsoleInterface / Toolbox.cpp
diff options
context:
space:
mode:
Commitff624f61d63dffe6c2b8ca9f3f20f2a8b5e85c33 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 14:43:16 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2022-05-07 14:43:16 +0300
Files9ef2d76390a9b24f03c30a8494f3dc1fc1fc6600 /src/Generic/ConsoleInterface/Toolbox.cpp
FMI-OOP-P1_TicketSystem-ff624f61d63dffe6c2b8ca9f3f20f2a8b5e85c33.tar
FMI-OOP-P1_TicketSystem-ff624f61d63dffe6c2b8ca9f3f20f2a8b5e85c33.tar.gz
FMI-OOP-P1_TicketSystem-ff624f61d63dffe6c2b8ca9f3f20f2a8b5e85c33.zip
Parentd570684aeffc41bd60ed09290f412cd923d346bc (diff)
Autocommit at 07.05.2022 @ 14:43
1 files changed, 54 insertions, 33 deletions
-rw-r--r--src/Generic/ConsoleInterface/Toolbox.cpp87
diff --git a/src/Generic/ConsoleInterface/Toolbox.cpp b/src/Generic/ConsoleInterface/Toolbox.cpp
index 1f2e42c..145e66c 100644
--- a/src/Generic/ConsoleInterface/Toolbox.cpp
+++ b/src/Generic/ConsoleInterface/Toolbox.cpp
@@ -6,12 +6,6 @@ void clear() {
std::cout << u8"\033[2J\033[1;1H";
}
-int orderedListIndex = 1;
-
-void resetOrderedList(int starter) {
- orderedListIndex = starter;
-}
-
void titleBox(const char* title) {
std::cout << std::endl << "=== " << title << " ===" << std::endl;
}
@@ -20,18 +14,72 @@ void subTitleBox(const char* title) {
std::cout << std::endl << "--- " << title << " ---" << std::endl;
}
+/* Status boxes */
+
+void __printSubBoxSpacing() {
+ std::cout << " ";
+}
+
void successBox(const char* message) {
std::cout << "<S> " << message << std::endl;
}
+void successSubBox(const char* message) {
+ __printSubBoxSpacing();
+ successBox(message);
+}
+
void warningBox(const char* message) {
std::cout << "<W> " << message << std::endl;
}
+void warningSubBox(const char* message) {
+ __printSubBoxSpacing();
+ warningBox(message);
+}
+
void errorBox(const char* message) {
std::cout << "<E> " << message << std::endl;
}
+void errorSubBox(const char* message) {
+ __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);
+}
+
+void inputLineBox(const char* label, char* output, unsigned maxWidth) {
+ _printInputBoxLabel(label);
+ __inputLineBoxGetInput(output, maxWidth);
+}
+
+void inputLineSubBox(const char* label, char* output, unsigned maxWidth) {
+ _printInputSubBoxLabel(label);
+ __inputLineBoxGetInput(output, maxWidth);
+}
+
+/* Table */
+
void __printTableHeaderNumber(unsigned number) {
std::cout << ":" << ((number < 100) ? " " : "") << number << ((number < 10) ? " " : "");
}
@@ -70,30 +118,3 @@ void table(unsigned startNumber, unsigned columns, const char* items) {
std::cout << ":" << std::endl;
}
-void _printOrderedListBeginning() {
- std::cout << "[" << orderedListIndex++ << "] ";
-}
-
-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);
-}
-
-void inputLineBox(const char* label, char* output, unsigned maxWidth) {
- _printInputBoxLabel(label);
- __inputLineBoxGetInput(output, maxWidth);
-}
-
-void inputLineSubBox(const char* label, char* output, unsigned maxWidth) {
- _printInputSubBoxLabel(label);
- __inputLineBoxGetInput(output, maxWidth);
-}