diff -r 000000000000 -r ea26b3359fed src/Configuration.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Configuration.h Sat Jan 16 16:36:39 2021 +0100 @@ -0,0 +1,107 @@ +/** + * Relational pipes + * Copyright © 2021 František Kučera (Frantovo.cz, GlobalCode.info) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include + +#include + + +namespace relpipe { +namespace in { +namespace xmltable { + +enum class Mode { + STRING, + BOOLEAN, + // TODO: support also XML number, when we have a rational or decimal numbers in Relational pipes + RAW_XML, + LINE_NUMBER, + XPATH +}; + +class XmlElementSkeleton { +public: + relpipe::writer::string_t name; + relpipe::writer::string_t uri; + relpipe::writer::string_t prefix; + + XmlElementSkeleton() { + } + + XmlElementSkeleton(relpipe::writer::string_t name, relpipe::writer::string_t uri = L"", relpipe::writer::string_t prefix = L"") : name(name), uri(uri), prefix(prefix) { + } + + virtual ~XmlElementSkeleton() { + } +}; + +class AttributeRecipe { +public: + + virtual ~AttributeRecipe() { + } + + relpipe::writer::string_t name; + relpipe::writer::TypeId type; + relpipe::writer::string_t xpath; + Mode mode = Mode::STRING; + XmlElementSkeleton rawXmlNodeListWrapper; + XmlElementSkeleton rawXmlAttributeWrapper; + +}; + +class ParserOptionRecipe { +public: + relpipe::writer::string_t uri; + relpipe::writer::string_t value; + + ParserOptionRecipe(relpipe::writer::string_t uri, relpipe::writer::string_t value) : uri(uri), value(value) { + } +}; + +class RelationConfiguration { +public: + + virtual ~RelationConfiguration() { + } + + relpipe::writer::string_t relation; + relpipe::writer::boolean_t nameIsXPath = false; + relpipe::writer::string_t xpath; + std::vector attributes; + + // Defaults/templates for AttributeRecipe: + Mode mode = Mode::STRING; + XmlElementSkeleton rawXmlNodeListWrapper; + XmlElementSkeleton rawXmlAttributeWrapper = {L"attribute"}; +}; + +class Configuration { +public: + std::vector relationConfigurations; + std::vector namespaceMappings; + std::vector parserOptions; + bool xinclude = false; + + virtual ~Configuration() { + } +}; + +} +} +}