src/Configuration.h
author František Kučera <franta-hg@frantovo.cz>
Tue, 11 May 2021 22:03:45 +0200
branchv_0
changeset 28 bc15f5471b6a
permissions -rw-r--r--
new CLI interface: --relation, --attribute
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Relational pipes
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2021 František Kučera (Frantovo.cz, GlobalCode.info)
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
bc15f5471b6a new CLI interface: --relation, --attribute
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
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
#pragma once
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
#include <map>
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
#include <regex>
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
#include <locale>
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
#include <relpipe/common/type/typedefs.h>
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
namespace relpipe {
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
namespace tr {
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
namespace cut {
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
class RelationConfiguration {
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
public:
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
	enum class ENTITY {
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
		RELATION,
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
		ATTRIBUTE
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
	};
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
	RelationConfiguration() {
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
		caseSensitive[ENTITY::RELATION] = true;
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
		caseSensitive[ENTITY::ATTRIBUTE] = true;
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
		invertMatch[ENTITY::RELATION] = false;
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
		invertMatch[ENTITY::ATTRIBUTE] = false;
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
	}
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
	virtual ~RelationConfiguration() {
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    46
	}
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    47
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
	relpipe::common::type::StringX relation;
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
	std::vector<relpipe::common::type::StringX> attributes;
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
	std::wregex relationPattern;
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
	std::vector<std::wregex> attributePatterns;
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    52
	std::map<ENTITY, relpipe::common::type::Boolean> caseSensitive;
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    53
	std::map<ENTITY, relpipe::common::type::Boolean> invertMatch;
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    54
};
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    55
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
class Configuration {
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    57
public:
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    58
	std::vector<RelationConfiguration> relationConfigurations;
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    59
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    60
	virtual ~Configuration() {
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    61
	}
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    62
};
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    63
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    64
}
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    65
}
bc15f5471b6a new CLI interface: --relation, --attribute
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    66
}