src/XMLDocumentConstructor.h
author František Kučera <franta-hg@frantovo.cz>
Sun, 25 Oct 2020 21:48:11 +0100
branchv_0
changeset 14 5be268bc4c69
child 16 3b197bf7a231
permissions -rw-r--r--
separate the „std::istream to DOM“ phase
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Relational pipes
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
5be268bc4c69 separate the „std::istream to DOM“ phase
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
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
#pragma once
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
namespace relpipe {
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
namespace in {
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
namespace xmltable {
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
#include <libxml++-2.6/libxml++/libxml++.h>
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
class XMLDocumentConstructor {
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
private:
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
	std::istream* input = nullptr;
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
	xmlpp::DomParser* parser = nullptr;
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
public:
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
	XMLDocumentConstructor(std::istream* input, xmlpp::DomParser* parser) : input(input), parser(parser) {
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
	}
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
	void process() {
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
		parser->parse_stream(*input);
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
	}
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
};
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
}
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
}
5be268bc4c69 separate the „std::istream to DOM“ phase
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
}