-
Notifications
You must be signed in to change notification settings - Fork 1
/
ColumnCollection.h
66 lines (50 loc) · 1.37 KB
/
ColumnCollection.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
#ifndef _COLUMNCOLLECTION_H_
#define _COLUMNCOLLECTION_H_
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include "Helper.h"
#include "global.h"
#define COLUMN_FILE "columns.cfg"
#define CFG_SEPARATOR '|'
struct singleColumn
{
std::string alias;
std::string expression;
bool shown;
singleColumn();
singleColumn(std::string exp)
{
alias = validateFilename(exp);
expression = exp;
shown = true;
}
singleColumn(bool _shown, std::string exp, std::string _alias)
{
shown = _shown;
expression = exp;
alias = _alias;
}
};
class ColumnCollection
{
private:
public:
ColumnCollection();
ColumnCollection(std::vector<std::string> columns);
~ColumnCollection();
std::vector<singleColumn*> columns;
// when considerShown is true, the expression/alias from the column marked
// as not shown is not included
std::vector<std::string> getExpressions(bool considerShown = false);
std::vector<std::string> getAliases(bool considerShown = false);
int size(bool considerShown = false);
void addColumn (singleColumn * c);
void removeColumn (int index);
void print();
void saveToFile();
static ColumnCollection* readFromFile();
// ColumnCollection* clone();
};
#endif /* _COLUMNCOLLECTION_H_ */