-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConsoleTable.h
68 lines (48 loc) · 1.49 KB
/
ConsoleTable.h
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
#ifndef CONSOLETABLE_CONSOLETABLE_H
#define CONSOLETABLE_CONSOLETABLE_H
#include <string>
#include <vector>
#include <iostream>
#include "ConsoleTableRow.h"
#include "ConsoleTableUtils.h"
#include <sstream>
enum TableStyle {
BASIC,
LINED,
DOUBLE_LINE,
};
enum HorizontalSeperator {
SEPERATOR_TOP,
SEPERATOR_MIDDLE,
SEPERATOR_BOTTOM
};
class ConsoleTable {
public:
ConsoleTable(TableStyle style);
void setPadding(unsigned int width);
void addColumn(std::string name);
void addRow(ConsoleTableRow* item);
bool removeRow(int index);
bool editRow(std::string data, int row, int col);
void printTable();
private:
unsigned int padding = 1;
std::vector<std::string> columns;
std::vector<ConsoleTableRow*> entries;
ConsoleTableUtils* utils;
// Table Style variables
std::string style_line_horizontal;
std::string style_line_vertical;
std::string style_line_cross;
std::string style_t_intersect_right;
std::string style_t_intersect_left;
std::string style_t_intersect_top;
std::string style_t_intersect_bottom;
std::string style_edge_topleft;
std::string style_edge_topright;
std::string style_edge_buttomleft;
std::string style_edge_buttomright;
void printHorizontalSeperator(const std::vector<int>& maxWidths, HorizontalSeperator seperator) const;
void setTableStyle(TableStyle style);
};
#endif //CONSOLETABLE_CONSOLETABLE_H