author | František Kučera <franta-hg@frantovo.cz> |
Sat, 26 Oct 2019 23:01:03 +0200 | |
branch | v_0 |
changeset 25 | 3f47b43e528d |
parent 24 | 4353cd19a6b5 |
child 27 | 532953173cd5 |
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; |
|
33 |
string_t group; |
|
34 |
string_t name; |
|
35 |
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
|
36 |
/** |
0a297eb46ba1
requested field's options as an ordered multi-map
František Kučera <franta-hg@frantovo.cz>
parents:
5
diff
changeset
|
37 |
* 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
|
38 |
* 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
|
39 |
*/ |
0a297eb46ba1
requested field's options as an ordered multi-map
František Kučera <franta-hg@frantovo.cz>
parents:
5
diff
changeset
|
40 |
std::vector<string_t> options; |
4 | 41 |
|
12
0a297eb46ba1
requested field's options as an ordered multi-map
František Kučera <franta-hg@frantovo.cz>
parents:
5
diff
changeset
|
42 |
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 | 43 |
} |
44 |
||
5
ec661baf433a
support field aliases
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
45 |
/** |
ec661baf433a
support field aliases
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
46 |
* @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
|
47 |
*/ |
ec661baf433a
support field aliases
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
48 |
std::vector<string_t> getAliases() const { |
ec661baf433a
support field aliases
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
49 |
if (aliases.empty()) return {name}; |
ec661baf433a
support field aliases
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
50 |
else return aliases; |
ec661baf433a
support field aliases
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
51 |
} |
ec661baf433a
support field aliases
František Kučera <franta-hg@frantovo.cz>
parents:
4
diff
changeset
|
52 |
|
4 | 53 |
virtual ~RequestedField() { |
54 |
} |
|
55 |
}; |
|
56 |
||
57 |
const string_t RequestedField::GROUP_FILE = L"file"; |
|
58 |
const string_t RequestedField::GROUP_XATTR = L"xattr"; |
|
59 |
||
60 |
} |
|
61 |
} |
|
62 |
} |