|
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 |
|
7 * the Free Software Foundation, either version 3 of the License, or |
|
8 * (at your option) any later version. |
|
9 * |
|
10 * This program is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 * GNU General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License |
|
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 */ |
|
18 #pragma once |
|
19 |
|
20 #include <cstdlib> |
|
21 #include <iostream> |
|
22 #include <string> |
|
23 #include <vector> |
|
24 #include <algorithm> |
|
25 |
|
26 #include <relpipe/writer/typedefs.h> |
|
27 |
|
28 namespace relpipe { |
|
29 namespace in { |
|
30 namespace xml { |
|
31 |
|
32 class XMLCommand { |
|
33 public: |
|
34 |
|
35 void process(std::istream& input, std::ostream& output) { |
|
36 using namespace relpipe::writer; |
|
37 std::shared_ptr<RelationalWriter> writer(Factory::create(output)); |
|
38 |
|
39 // TODO: remove demo |
|
40 // Various data types passed as strings |
|
41 writer->startRelation(L"xml",{ |
|
42 {L"s", TypeId::STRING}, |
|
43 {L"i", TypeId::INTEGER}, |
|
44 {L"b", TypeId::BOOLEAN} |
|
45 }, true); |
|
46 |
|
47 writer->writeAttribute(L"a"); |
|
48 writer->writeAttribute(L"1"); |
|
49 writer->writeAttribute(L"true"); |
|
50 |
|
51 } |
|
52 }; |
|
53 |
|
54 } |
|
55 } |
|
56 } |