include/relpipe/xmlwriter/XMLWriter.h
author František Kučera <franta-hg@frantovo.cz>
Sat, 05 Jan 2019 20:05:32 +0100
branchv_0
changeset 1 7d3081e51970
parent 0 9000436424bb
child 2 f21d6ae71bf0
permissions -rw-r--r--
class skeleton
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     1
/**
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     2
 * Relational pipes
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     3
 * Copyright © 2018 František Kučera (Frantovo.cz, GlobalCode.info)
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     4
 *
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     7
 * the Free Software Foundation, either version 3 of the License, or
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     8
 * (at your option) any later version.
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
     9
 *
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    13
 * GNU General Public License for more details.
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    14
 *
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    15
 * You should have received a copy of the GNU General Public License
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    17
 */
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    18
#pragma once
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    19
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    20
#include <iostream>
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    21
#include <string>
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    22
#include <vector>
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    23
#include <codecvt>
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    24
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    25
#include "RelpipeXMLWriterException.h"
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    26
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    27
using namespace std;
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    28
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    29
namespace relpipe {
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    30
namespace xmlwriter {
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    31
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    32
class XMLWriter {
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    33
private:
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    34
	std::ostream &output;
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    35
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    36
public:
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    37
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    38
	XMLWriter(std::ostream& output) : output(output) {
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    39
	}
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    40
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    41
	virtual ~XMLWriter() {
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    42
		output.flush();
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    43
	}
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    44
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    45
	void writeStartElement(const wstring& name, const vector<wstring>& attributes) {
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    46
		throw RelpipeXMLWriterException(L"not yet implemented");
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    47
	}
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    48
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    49
	void writeEndElement() {
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    50
		throw RelpipeXMLWriterException(L"not yet implemented");
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    51
	}
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    52
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    53
	void writeEmptyElement(const wstring& name, const vector<wstring>& attributes) {
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    54
		throw RelpipeXMLWriterException(L"not yet implemented");
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    55
	}
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    56
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    57
	void writeTextElement(const wstring& name, const vector<wstring>& attributes, const wstring& text) {
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    58
		throw RelpipeXMLWriterException(L"not yet implemented");
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    59
	}
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    60
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    61
	void writeCharacters(const wstring& text) {
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    62
		throw RelpipeXMLWriterException(L"not yet implemented");
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    63
	}
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    64
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    65
	void writeComment(const wstring& text) {
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    66
		throw RelpipeXMLWriterException(L"not yet implemented");
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    67
	}
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    68
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    69
};
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    70
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    71
}
7d3081e51970 class skeleton
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    72
}