author | František Kučera <franta-hg@frantovo.cz> |
Sat, 24 Oct 2020 22:59:57 +0200 | |
branch | v_0 |
changeset 83 | 872bc774e471 |
parent 44 | dc5c210295d0 |
permissions | -rw-r--r-- |
4 | 1 |
/** |
2 |
* Relational pipes |
|
3 |
* Copyright © 2019 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 |
|
24
4353cd19a6b5
fix license version: GNU GPLv3
František Kučera <franta-hg@frantovo.cz>
parents:
12
diff
changeset
|
7 |
* the Free Software Foundation, version 3 of the License. |
4 | 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 |
||
21 |
#include <relpipe/writer/typedefs.h> |
|
22 |
||
23 |
namespace relpipe { |
|
24 |
namespace in { |
|
25 |
namespace filesystem { |
|
26 |
||
27 |
using namespace relpipe::writer; |
|
28 |
||
29 |
class RequestedField { |
|
30 |
public: |
|
31 |
static const string_t GROUP_FILE; |
|
32 |
static const string_t GROUP_XATTR; |
|
31
c64e1588f428
rename --exec to --streamlet
František Kučera <franta-hg@frantovo.cz>
parents:
29
diff
changeset
|
33 |
static const string_t GROUP_STREAMLET; |
29
6f15f18d2abf
field group --exec, replaces --script and --hash, starts reusable sub-program that returns set of attributes for all records during its runtime
František Kučera <franta-hg@frantovo.cz>
parents:
28
diff
changeset
|
34 |
integer_t id; |
4 | 35 |
string_t group; |
36 |
string_t name; |
|
37 |
std::vector<string_t> aliases; |
|
12
0a297eb46ba1
requested field's options as an ordered multi-map
František Kučera <franta-hg@frantovo.cz>
parents:
5
diff
changeset
|
38 |
/** |
0a297eb46ba1
requested field's options as an ordered multi-map
František Kučera <franta-hg@frantovo.cz>
parents:
5
diff
changeset
|
39 |
* used as an ordered multi-map |
0a297eb46ba1
requested field's options as an ordered multi-map
František Kučera <franta-hg@frantovo.cz>
parents:
5
diff
changeset
|
40 |
* option name, value, name, value,… |
0a297eb46ba1
requested field's options as an ordered multi-map
František Kučera <franta-hg@frantovo.cz>
parents:
5
diff
changeset
|
41 |
*/ |
0a297eb46ba1
requested field's options as an ordered multi-map
František Kučera <franta-hg@frantovo.cz>
parents:
5
diff
changeset
|
42 |
std::vector<string_t> options; |
4 | 43 |
|
12
0a297eb46ba1
requested field's options as an ordered multi-map
František Kučera <franta-hg@frantovo.cz>
parents:
5
diff
changeset
|
44 |
RequestedField(const string_t& group, const string_t& name, const std::vector<string_t>& aliases = {}, const std::vector<string_t>& options = {}) : group(group), name(name), aliases(aliases), options(options) { |
4 | 45 |
} |
46 |
||
5
ec661baf433a
support field aliases
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
47 |
/** |
44
dc5c210295d0
do not force the name as the alias (allow different default in the finder/streamlet)
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
48 |
* @return aliases (might be empty) |
dc5c210295d0
do not force the name as the alias (allow different default in the finder/streamlet)
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
49 |
*/ |
dc5c210295d0
do not force the name as the alias (allow different default in the finder/streamlet)
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
50 |
std::vector<string_t> getAliases() const { |
dc5c210295d0
do not force the name as the alias (allow different default in the finder/streamlet)
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
51 |
return aliases; |
dc5c210295d0
do not force the name as the alias (allow different default in the finder/streamlet)
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
52 |
} |
dc5c210295d0
do not force the name as the alias (allow different default in the finder/streamlet)
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
53 |
|
dc5c210295d0
do not force the name as the alias (allow different default in the finder/streamlet)
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
54 |
/** |
5
ec661baf433a
support field aliases
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
55 |
* @return aliases or vector with single item (name), if aliases are empty |
ec661baf433a
support field aliases
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
56 |
*/ |
44
dc5c210295d0
do not force the name as the alias (allow different default in the finder/streamlet)
František Kučera <franta-hg@frantovo.cz>
parents:
31
diff
changeset
|
57 |
std::vector<string_t> getAliasesOrName() const { |
5
ec661baf433a
support field aliases
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
58 |
if (aliases.empty()) return {name}; |
ec661baf433a
support field aliases
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
59 |
else return aliases; |
ec661baf433a
support field aliases
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
60 |
} |
ec661baf433a
support field aliases
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
61 |
|
4 | 62 |
virtual ~RequestedField() { |
63 |
} |
|
64 |
}; |
|
65 |
||
66 |
const string_t RequestedField::GROUP_FILE = L"file"; |
|
67 |
const string_t RequestedField::GROUP_XATTR = L"xattr"; |
|
31
c64e1588f428
rename --exec to --streamlet
František Kučera <franta-hg@frantovo.cz>
parents:
29
diff
changeset
|
68 |
const string_t RequestedField::GROUP_STREAMLET = L"streamlet"; |
4 | 69 |
|
70 |
} |
|
71 |
} |
|
72 |
} |