src/YAMLCommand.h
author František Kučera <franta-hg@frantovo.cz>
Tue, 01 Dec 2020 23:30:00 +0100
branchv_0
changeset 0 66a454290286
child 1 8d2d8f4077af
permissions -rw-r--r--
project skeleton
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Relational pipes
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
66a454290286 project skeleton
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
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
#pragma once
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
#include <cstdlib>
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
#include <iostream>
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
#include <memory>
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
#include <vector>
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
#include <relpipe/writer/RelationalWriter.h>
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
#include <relpipe/writer/typedefs.h>
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
namespace relpipe {
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
namespace in {
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
namespace yaml {
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
class YAMLCommand {
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
private:
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
	std::wstring_convert<codecvt_utf8<wchar_t>> convertor; // TODO: support also other encodings.
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
public:
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
	void process(std::istream& input, std::shared_ptr<relpipe::writer::RelationalWriter> writer) {
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
		std::vector<relpipe::writer::AttributeMetadata> attributesMetadata;
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
		attributesMetadata.push_back(relpipe::writer::AttributeMetadata{L"todo", relpipe::writer::TypeId::STRING});
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
		writer->startRelation(L"YAML", attributesMetadata, true);
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
	}
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
};
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
}
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
}
66a454290286 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    46
}