author | František Kučera <franta-hg@frantovo.cz> |
Mon, 20 Jun 2022 00:55:56 +0200 | |
branch | v_0 |
changeset 38 | 2cc2d3f658f4 |
parent 31 | c22577615ce4 |
child 39 | f33464965693 |
permissions | -rw-r--r-- |
30
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
1 |
/** |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
2 |
* Relational pipes |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
3 |
* Copyright © 2020 František Kučera (Frantovo.cz, GlobalCode.info) |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
4 |
* |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
5 |
* This program is free software: you can redistribute it and/or modify |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
7 |
* the Free Software Foundation, version 3 of the License. |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
8 |
* |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
13 |
* |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
15 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
16 |
*/ |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
17 |
#pragma once |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
18 |
|
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
19 |
#include <vector> |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
20 |
#include <iostream> |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
21 |
|
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
22 |
#include <relpipe/reader/typedefs.h> |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
23 |
|
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
24 |
|
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
25 |
namespace relpipe { |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
26 |
namespace out { |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
27 |
namespace tabular { |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
28 |
|
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
29 |
class RelationConfiguration { |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
30 |
public: |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
31 |
|
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
32 |
virtual ~RelationConfiguration() { |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
33 |
} |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
34 |
|
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
35 |
relpipe::reader::string_t relation; |
31
c22577615ce4
rename: --print-types, --print-relation-name, --print-record-count to --write-types, --write-relation-name, --write-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
30
diff
changeset
|
36 |
relpipe::reader::boolean_t writeTypes = true; |
c22577615ce4
rename: --print-types, --print-relation-name, --print-record-count to --write-types, --write-relation-name, --write-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
30
diff
changeset
|
37 |
relpipe::reader::boolean_t writeRecordCount = true; |
c22577615ce4
rename: --print-types, --print-relation-name, --print-record-count to --write-types, --write-relation-name, --write-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
30
diff
changeset
|
38 |
relpipe::reader::boolean_t writeRelationName = true; |
30
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
39 |
}; |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
40 |
|
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
41 |
class Configuration { |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
42 |
public: |
38
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
43 |
|
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
44 |
enum class ColorScheme { |
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
45 |
GreenScreen, |
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
46 |
Monochrome, |
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
47 |
Midnight |
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
48 |
}; |
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
49 |
|
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
50 |
enum class TableStyle { |
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
51 |
Rounded, |
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
52 |
Sharp, |
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
53 |
SharpDouble, |
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
54 |
HorizontalOnly, |
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
55 |
Ascii |
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
56 |
}; |
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
57 |
|
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
58 |
|
31
c22577615ce4
rename: --print-types, --print-relation-name, --print-record-count to --write-types, --write-relation-name, --write-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
30
diff
changeset
|
59 |
relpipe::reader::boolean_t writeTypes = true; |
c22577615ce4
rename: --print-types, --print-relation-name, --print-record-count to --write-types, --write-relation-name, --write-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
30
diff
changeset
|
60 |
relpipe::reader::boolean_t writeRecordCount = true; |
c22577615ce4
rename: --print-types, --print-relation-name, --print-record-count to --write-types, --write-relation-name, --write-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
30
diff
changeset
|
61 |
relpipe::reader::boolean_t writeRelationName = true; |
30
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
62 |
std::vector<RelationConfiguration> relationConfigurations; |
38
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
63 |
ColorScheme colorScheme = ColorScheme::GreenScreen; |
2cc2d3f658f4
configurable table style: rounded, sharp, sharp-double, horizontal-only, ascii
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
64 |
TableStyle tableStyle = TableStyle::Rounded; |
30
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
65 |
|
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
66 |
virtual ~Configuration() { |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
67 |
} |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
68 |
}; |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
69 |
|
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
70 |
} |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
71 |
} |
3c6374467a82
change CLI interface: options: --relation --print-types --print-relation-name --print-record-count
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
72 |
} |