Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Generic / ConsoleInterface / Toolbox.hpp
blob: a1a310b5554e8a7eefe15dd540e298658510f79d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef HEADER_CONSOLEINTERFACE_TOOLBOX
#define HEADER_CONSOLEINTERFACE_TOOLBOX

#include <iostream>

#define MAX_LINE_WIDTH 1024

void clear();
void titleBox(const char* title);
void subTitleBox(const char* title);

void successBox(const char* message);
void successSubBox(const char* message);
void warningBox(const char* message);
void warningSubBox(const char* message);
void errorBox(const char* message);
void errorSubBox(const char* message);

void inputLineBox(const char* label, char* output, unsigned maxWidth, bool ignore = true);
void inputLineSubBox(const char* label, char* output, unsigned maxWidth, bool ignore = true);
void pressEnterToContinue(bool ignore = true);

void resetOrderedList(int starter = 1);

void table(unsigned startNumber, unsigned columns, const char* items);

void _printSubBoxSpacing();
void _printInputBoxLabel(const char* label);
void _printOrderedListBeginning();

template <class T>
void read(T* storage) {
	std::cin >> storage;
}

template <class T>
void read(T& storage) {
	std::cin >> storage;
}

template <class T>
void print(const T* item) {
	std::cout << item;
}

template <class T>
void printLine(const T* item) {
	std::cout << item << std::endl;
}

template <class T>
void print(const T& item) {
	std::cout << item;
}

template <class T>
void printLine(const T& item) {
	std::cout << item << std::endl;
}


template <typename T>
void printOrderedListElem(const T& elem) {
	_printOrderedListBeginning();
	printLine(elem);
}

template <typename T>
void inputBox(const char* label, T* output) {
	_printInputBoxLabel(label);
	std::cin >> *output;
}

template <typename T>
void inputSubBox(const char* label, T* output) {
	_printSubBoxSpacing();
	_printInputBoxLabel(label);
	std::cin >> *output;
}

#endif