author | František Kučera <franta-hg@frantovo.cz> |
Sat, 12 Dec 2020 14:42:36 +0100 | |
branch | v_0 |
changeset 4 | 372b161669e4 |
parent 1 | e04e5bbc147b |
permissions | -rw-r--r-- |
0 | 1 |
/** |
2 |
* Relational pipes |
|
3 |
* Copyright © 2020 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, version 3 of the License. |
|
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 |
*/ |
|
17 |
#pragma once |
|
18 |
||
19 |
#include <vector> |
|
20 |
#include <iostream> |
|
21 |
||
22 |
#include <relpipe/common/type/typedefs.h> |
|
23 |
||
24 |
||
25 |
namespace relpipe { |
|
26 |
namespace out { |
|
27 |
namespace ini { |
|
28 |
||
29 |
enum class Style { |
|
30 |
/** Auto-detection based on attributes of the relations. */ |
|
31 |
Automatic, |
|
32 |
/** This relation will be dropped (ignored). */ |
|
33 |
Dropped, |
|
34 |
/** Reads standard relations generated by relpipe-in-ini. */ |
|
35 |
Standard, |
|
36 |
/** Relation name = section name; record = section; attribute = key/value. */ |
|
37 |
Literal, |
|
38 |
/** Like previous style, but the relation name is ignored and the section name is based on the attribute value. This style is useful for generating multiple sections with same keys. */ |
|
1
e04e5bbc147b
add --style section-first
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
39 |
SectionFirst, |
0 | 40 |
}; |
41 |
||
42 |
class WriterOptionRecipe { |
|
43 |
public: |
|
44 |
relpipe::common::type::StringX uri; |
|
45 |
relpipe::common::type::StringX value; |
|
46 |
||
47 |
WriterOptionRecipe(relpipe::common::type::StringX uri, relpipe::common::type::StringX value) : uri(uri), value(value) { |
|
48 |
} |
|
49 |
}; |
|
50 |
||
51 |
class RelationConfiguration { |
|
52 |
public: |
|
1
e04e5bbc147b
add --style section-first
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
53 |
/** regular expression */ |
0 | 54 |
relpipe::common::type::StringX relation; |
55 |
Style style = Style::Automatic; |
|
56 |
}; |
|
57 |
||
58 |
class Configuration { |
|
59 |
public: |
|
60 |
std::vector<WriterOptionRecipe> writerOptions; |
|
61 |
std::vector<RelationConfiguration> relationConfigurations; |
|
62 |
||
63 |
virtual ~Configuration() { |
|
64 |
} |
|
65 |
}; |
|
66 |
||
67 |
} |
|
68 |
} |
|
69 |
} |