src/Configuration.h
author František Kučera <franta-hg@frantovo.cz>
Tue, 11 May 2021 18:30:50 +0200
branchv_0
changeset 24 c69670b7b4ef
child 25 98be80d2e65b
permissions -rw-r--r--
new CLI interface: --relation, --attribute, --pattern
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Relational pipes
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2021 František Kučera (Frantovo.cz, GlobalCode.info)
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
#pragma once
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
#include <vector>
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
#include <regex>
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
#include <locale>
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
#include <relpipe/common/type/typedefs.h>
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
namespace relpipe {
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
namespace tr {
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
namespace grep {
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
class RelationConfiguration {
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
public:
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
	virtual ~RelationConfiguration() {
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
	}
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
	relpipe::common::type::StringX relation; // TODO: remove and use just relationPattern, see CLIParser
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
	std::wregex relationPattern;
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
	std::wregex attributePattern;
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
	std::wregex valuePattern;
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
};
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
class Configuration {
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
public:
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
	std::vector<RelationConfiguration> relationConfigurations;
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    46
	virtual ~Configuration() {
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
	}
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
};
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
}
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
}
c69670b7b4ef new CLI interface: --relation, --attribute, --pattern
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    52
}