author | František Kučera <franta-hg@frantovo.cz> |
Wed, 23 Sep 2020 16:58:48 +0200 | |
branch | v_0 |
changeset 16 | 15ee963675af |
parent 15 | 157bb1d5e08a |
permissions | -rw-r--r-- |
0 | 1 |
/** |
2 |
* Relational pipes |
|
3 |
* Copyright © 2018 František Kučera (Frantovo.cz, GlobalCode.info) |
|
4 |
* |
|
5 |
* This program is free software: you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
10
1ae185cac1f3
fix license version: GNU GPLv3
František Kučera <franta-hg@frantovo.cz>
parents:
3
diff
changeset
|
7 |
* the Free Software Foundation, version 3 of the License. |
0 | 8 |
* |
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
*/ |
|
14
012d491e219a
separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents:
10
diff
changeset
|
17 |
#pragma once |
012d491e219a
separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents:
10
diff
changeset
|
18 |
|
012d491e219a
separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents:
10
diff
changeset
|
19 |
#include <iostream> |
012d491e219a
separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents:
10
diff
changeset
|
20 |
#include <sstream> |
1
5eb4d149c6e2
first working version
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
21 |
#include <vector> |
15
157bb1d5e08a
work with writer instead of ostream
František Kučera <franta-hg@frantovo.cz>
parents:
14
diff
changeset
|
22 |
#include <memory> |
0 | 23 |
|
24 |
#include <relpipe/writer/TypeId.h> |
|
25 |
||
16
15ee963675af
change CLI interface: options: --relation --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
15
diff
changeset
|
26 |
#include "Configuration.h" |
15ee963675af
change CLI interface: options: --relation --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
15
diff
changeset
|
27 |
|
14
012d491e219a
separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents:
10
diff
changeset
|
28 |
namespace relpipe { |
012d491e219a
separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents:
10
diff
changeset
|
29 |
namespace in { |
012d491e219a
separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents:
10
diff
changeset
|
30 |
namespace csv { |
1
5eb4d149c6e2
first working version
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
31 |
|
14
012d491e219a
separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents:
10
diff
changeset
|
32 |
class CSVCommand { |
012d491e219a
separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents:
10
diff
changeset
|
33 |
private: |
012d491e219a
separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents:
10
diff
changeset
|
34 |
bool readValue(std::istream& input, std::stringstream& currentValue, bool& lastInRecord); |
012d491e219a
separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents:
10
diff
changeset
|
35 |
public: |
16
15ee963675af
change CLI interface: options: --relation --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
15
diff
changeset
|
36 |
void process(std::istream& input, std::shared_ptr<writer::RelationalWriter> writer, Configuration& configuration); |
3
d7907be4cc40
allow also custom relation name, attribute names and types (optional)
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
37 |
|
14
012d491e219a
separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents:
10
diff
changeset
|
38 |
}; |
0 | 39 |
|
14
012d491e219a
separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents:
10
diff
changeset
|
40 |
} |
0 | 41 |
} |
14
012d491e219a
separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents:
10
diff
changeset
|
42 |
} |