-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
73 lines (62 loc) · 1.97 KB
/
Copy pathtest.cpp
File metadata and controls
73 lines (62 loc) · 1.97 KB
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
#include <iostream>
#include <vector>
#include <string>
#include "table.h"
#include "style.h"
namespace termtab = bornageek::utils::termtab;
class TableTest {
public:
TableTest() {
std::cout << "Starting table test ..." << std::endl << std::endl;
}
~TableTest() {
std::cout << std::endl << "Stopping table test ..." << std::endl;
}
void run() {
std::vector<std::vector<std::string>> rows{
{"Karl Kangaroo", "13. Sep 1988", "jumping"},
{"Austin Ape", "24. Jul 2000", "climbing, jumping,\nsurfing"},
{"..."},
{"Bertha Bear", "3. Feb 1976", "sleeping", "Sherwood Forest"},
{"Toni Tiger", "31. Jan 1935", "sleeping, hunting"},
{"Paul Penguin", "6. Oct 1954"},
{"Gira Giraffe", "10. Sep 1943", "", "London Zoo"},
{"To be continued ..."}
};
termtab::Style style;
style.paddingLeft(3);
style.paddingRight(2);
style.borderTop('=');
style.borderTopMid('#');
style.borderTopLeft('@');
style.borderTopRight('@');
style.borderBottom('=');
style.borderBottomMid('#');
style.borderBottomLeft('@');
style.borderBottomRight('@');
style.borderLeft('[');
style.borderLeftMid('#');
style.borderMid('-');
style.borderMidMid('+');
style.borderRight(']');
style.borderRightMid('#');
style.borderMiddle('|');
termtab::Table table(style, rows);
table.title("A simple Test-Table");
table.headings({"Name", "Birthday", "Tags", "Adress"});
table.alignColumn(1, termtab::Alignment::RIGHT);
table.alignColumn(2, termtab::Alignment::CENTER);
table.row(2).cell(0).colSpan(4);
table.row(7).cell(0).colSpan(3);
try {
table.alignColumn(5, termtab::Alignment::RIGHT);
} catch (const std::exception &e) {
std::cerr << e.what() << std::endl;
}
std::cout << table;
}
};
int main(int argc, const char* argv[]) {
TableTest test;
test.run();
}