src/Configuration.h
branchv_0
changeset 0 1bb084f84eb9
child 1 e04e5bbc147b
equal deleted inserted replaced
-1:000000000000 0:1bb084f84eb9
       
     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. */
       
    39 	LiteralWithSectionAttribute,
       
    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:
       
    53 	relpipe::common::type::StringX relation;
       
    54 	Style style = Style::Automatic;
       
    55 };
       
    56 
       
    57 class Configuration {
       
    58 public:
       
    59 	std::vector<WriterOptionRecipe> writerOptions;
       
    60 	std::vector<RelationConfiguration> relationConfigurations;
       
    61 
       
    62 	virtual ~Configuration() {
       
    63 	}
       
    64 };
       
    65 
       
    66 }
       
    67 }
       
    68 }