src/CLIParser.h
author František Kučera <franta-hg@frantovo.cz>
Sat, 05 Dec 2020 20:17:27 +0100
branchv_0
changeset 26 84ff7c97bfdc
parent 25 0e8a58946c48
permissions -rw-r--r--
add --parser-option 'root-name' 'custom-root-element-name'
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Relational pipes
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
7d6ac51c0d48 configuration and CLI parser
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
4
a0689654b3c2 fix license version: GNU GPLv3
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
1
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
#pragma once
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
#include <vector>
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
#include <relpipe/writer/typedefs.h>
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
#include <relpipe/cli/CLI.h>
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
#include <relpipe/cli/RelpipeCLIException.h>
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
#include "Configuration.h"
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
namespace relpipe {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
namespace in {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
namespace xmltable {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
class CLIParser {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
private:
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
	string_t readNext(std::vector<string_t> arguments, int& i) {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
		if (i < arguments.size()) return arguments[i++];
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
		else throw relpipe::cli::RelpipeCLIException(L"Missing CLI argument" + (i > 0 ? (L" after " + arguments[i - 1]) : L""), relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
	}
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
7
ff69af3c67a3 XInclude support – option: --xinclude true
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    39
	/**
ff69af3c67a3 XInclude support – option: --xinclude true
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    40
	 * TODO: use a common method
ff69af3c67a3 XInclude support – option: --xinclude true
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    41
	 */
ff69af3c67a3 XInclude support – option: --xinclude true
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    42
	bool parseBoolean(const string_t& value) {
ff69af3c67a3 XInclude support – option: --xinclude true
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    43
		if (value == L"true") return true;
ff69af3c67a3 XInclude support – option: --xinclude true
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    44
		else if (value == L"false") return false;
ff69af3c67a3 XInclude support – option: --xinclude true
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    45
		else throw relpipe::cli::RelpipeCLIException(L"Unable to parse boolean value: " + value + L" (expecting true or false)", relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
ff69af3c67a3 XInclude support – option: --xinclude true
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    46
	}
ff69af3c67a3 XInclude support – option: --xinclude true
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    47
1
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    48
	void addRelation(Configuration& c, RelationConfiguration& currentRelation) {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
		if (currentRelation.relation.size()) {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
			c.relationConfigurations.push_back(currentRelation);
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
			currentRelation = RelationConfiguration();
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    52
		}
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    53
	}
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    54
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    55
	relpipe::writer::TypeId parseTypeId(const string_t& value) {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
		using t = relpipe::writer::TypeId;
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    57
		if (value == L"string") return t::STRING;
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    58
		else if (value == L"integer") return t::INTEGER;
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    59
		else if (value == L"boolean") return t::BOOLEAN;
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    60
		else throw relpipe::cli::RelpipeCLIException(L"Unable to parse TypeId: " + value, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    61
	}
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    62
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    63
public:
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    64
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    65
	static const string_t OPTION_NAMESPACE;
25
0e8a58946c48 add --parser-option
František Kučera <franta-hg@frantovo.cz>
parents: 8
diff changeset
    66
	static const string_t OPTION_PARSER_OPTION;
1
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    67
	static const string_t OPTION_RELATION;
2
0d3eb5129582 convert arbitrary XML to one or more relations
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    68
	static const string_t OPTION_NAME_IS_XPATH;
1
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    69
	static const string_t OPTION_RECORDS;
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    70
	static const string_t OPTION_ATTRIBUTE;
7
ff69af3c67a3 XInclude support – option: --xinclude true
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    71
	static const string_t OPTION_XINCLUDE;
8
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
    72
	static const string_t OPTION_MODE;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
    73
	static const string_t OPTION_RAW_XML_NODELIST_WRAPPER;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
    74
	static const string_t OPTION_RAW_XML_ATTRIBUTE_WRAPPER;
1
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    75
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    76
	Configuration parse(const std::vector<string_t>& arguments) {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    77
		Configuration c;
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    78
		RelationConfiguration currentRelation;
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    79
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    80
		for (int i = 0; i < arguments.size();) {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    81
			string_t option = readNext(arguments, i);
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    82
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    83
			if (option == OPTION_NAMESPACE) {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    84
				c.namespaceMappings.push_back(readNext(arguments, i));
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    85
				c.namespaceMappings.push_back(readNext(arguments, i));
25
0e8a58946c48 add --parser-option
František Kučera <franta-hg@frantovo.cz>
parents: 8
diff changeset
    86
			} else if (option == OPTION_PARSER_OPTION) {
0e8a58946c48 add --parser-option
František Kučera <franta-hg@frantovo.cz>
parents: 8
diff changeset
    87
				c.parserOptions.push_back({readNext(arguments, i), readNext(arguments, i)});
7
ff69af3c67a3 XInclude support – option: --xinclude true
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    88
			} else if (option == OPTION_XINCLUDE) {
ff69af3c67a3 XInclude support – option: --xinclude true
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
    89
				c.xinclude = parseBoolean(readNext(arguments, i));
1
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    90
			} else if (option == OPTION_RELATION) {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    91
				addRelation(c, currentRelation); // previous relation
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    92
				currentRelation.relation = readNext(arguments, i);
2
0d3eb5129582 convert arbitrary XML to one or more relations
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    93
			} else if (option == OPTION_NAME_IS_XPATH) {
0d3eb5129582 convert arbitrary XML to one or more relations
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    94
				currentRelation.nameIsXPath = true;
1
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    95
			} else if (option == OPTION_RECORDS) {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    96
				currentRelation.xpath = readNext(arguments, i);
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    97
			} else if (option == OPTION_ATTRIBUTE) {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    98
				AttributeRecipe attribute;
8
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
    99
				attribute.mode = currentRelation.mode;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   100
				attribute.rawXmlNodeListWrapper = currentRelation.rawXmlNodeListWrapper;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   101
				attribute.rawXmlAttributeWrapper = currentRelation.rawXmlAttributeWrapper;
1
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   102
				attribute.name = readNext(arguments, i);
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   103
				attribute.type = parseTypeId(readNext(arguments, i));
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   104
				attribute.xpath = readNext(arguments, i);
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   105
				currentRelation.attributes.push_back(attribute);
8
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   106
			} else if (option == OPTION_MODE) {
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   107
				string_t modeName = readNext(arguments, i);
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   108
				Mode mode;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   109
				if (modeName == L"string") mode = Mode::STRING;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   110
				else if (modeName == L"boolean") mode = Mode::BOOLEAN;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   111
				else if (modeName == L"raw-xml") mode = Mode::RAW_XML;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   112
				else if (modeName == L"line-number") mode = Mode::LINE_NUMBER;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   113
				else if (modeName == L"xpath") mode = Mode::XPATH;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   114
				else throw relpipe::cli::RelpipeCLIException(L"Unsupported mode: " + modeName, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   115
				if (currentRelation.attributes.size()) currentRelation.attributes.back().mode = mode;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   116
				else currentRelation.mode = mode;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   117
			} else if (option == OPTION_RAW_XML_NODELIST_WRAPPER) {
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   118
				XmlElementSkeleton w = {readNext(arguments, i), readNext(arguments, i), readNext(arguments, i)};
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   119
				if (currentRelation.attributes.size()) currentRelation.attributes.back().rawXmlNodeListWrapper = w;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   120
				else currentRelation.rawXmlNodeListWrapper = w;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   121
			} else if (option == OPTION_RAW_XML_ATTRIBUTE_WRAPPER) {
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   122
				XmlElementSkeleton w = {readNext(arguments, i), readNext(arguments, i), readNext(arguments, i)};
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   123
				if (currentRelation.attributes.size()) currentRelation.attributes.back().rawXmlAttributeWrapper = w;
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   124
				else currentRelation.rawXmlAttributeWrapper = w;
1
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   125
			} else throw relpipe::cli::RelpipeCLIException(L"Unsupported CLI option: " + option, relpipe::cli::CLI::EXIT_CODE_BAD_CLI_ARGUMENTS);
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   126
		}
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   127
		addRelation(c, currentRelation); // last relation
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   128
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   129
		return c;
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   130
	}
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   131
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   132
	virtual ~CLIParser() {
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   133
	}
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   134
};
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   135
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   136
const string_t CLIParser::OPTION_NAMESPACE = L"--namespace";
25
0e8a58946c48 add --parser-option
František Kučera <franta-hg@frantovo.cz>
parents: 8
diff changeset
   137
const string_t CLIParser::OPTION_PARSER_OPTION = L"--parser-option";
1
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   138
const string_t CLIParser::OPTION_RELATION = L"--relation";
2
0d3eb5129582 convert arbitrary XML to one or more relations
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
   139
const string_t CLIParser::OPTION_NAME_IS_XPATH = L"--name-is-xpath";
1
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   140
const string_t CLIParser::OPTION_RECORDS = L"--records";
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   141
const string_t CLIParser::OPTION_ATTRIBUTE = L"--attribute";
7
ff69af3c67a3 XInclude support – option: --xinclude true
František Kučera <franta-hg@frantovo.cz>
parents: 4
diff changeset
   142
const string_t CLIParser::OPTION_XINCLUDE = L"--xinclude";
8
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   143
const string_t CLIParser::OPTION_MODE = L"--mode";
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   144
const string_t CLIParser::OPTION_RAW_XML_NODELIST_WRAPPER = L"--raw-xml-nodelist-wrapper";
8730e2d0db0e suport multiple modes of reading from XML: string, boolean, raw-xml, line-number, xpath
František Kučera <franta-hg@frantovo.cz>
parents: 7
diff changeset
   145
const string_t CLIParser::OPTION_RAW_XML_ATTRIBUTE_WRAPPER = L"--raw-xml-attribute-wrapper";
1
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   146
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   147
}
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   148
}
7d6ac51c0d48 configuration and CLI parser
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
   149
}