src/CSVCommand.h
author František Kučera <franta-hg@frantovo.cz>
Wed, 23 Sep 2020 16:58:48 +0200
branchv_0
changeset 16 15ee963675af
parent 15 157bb1d5e08a
permissions -rw-r--r--
change CLI interface: options: --relation --attribute
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Relational pipes
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2018 František Kučera (Frantovo.cz, GlobalCode.info)
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
eca0b23802e8 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
eca0b23802e8 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
10
1ae185cac1f3 fix license version: GNU GPLv3
František Kučera <franta-hg@frantovo.cz>
parents: 3
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
0
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
eca0b23802e8 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,
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
eca0b23802e8 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
eca0b23802e8 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/>.
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
14
012d491e219a separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    17
#pragma once
012d491e219a separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    18
012d491e219a separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    19
#include <iostream>
012d491e219a separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    20
#include <sstream>
1
5eb4d149c6e2 first working version
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    21
#include <vector>
15
157bb1d5e08a work with writer instead of ostream
František Kučera <franta-hg@frantovo.cz>
parents: 14
diff changeset
    22
#include <memory>
0
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
#include <relpipe/writer/TypeId.h>
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
16
15ee963675af change CLI interface: options: --relation --attribute
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    26
#include "Configuration.h"
15ee963675af change CLI interface: options: --relation --attribute
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    27
14
012d491e219a separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    28
namespace relpipe {
012d491e219a separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    29
namespace in {
012d491e219a separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    30
namespace csv {
1
5eb4d149c6e2 first working version
František Kučera <franta-hg@frantovo.cz>
parents: 0
diff changeset
    31
14
012d491e219a separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    32
class CSVCommand {
012d491e219a separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    33
private:
012d491e219a separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    34
	bool readValue(std::istream& input, std::stringstream& currentValue, bool& lastInRecord);
012d491e219a separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    35
public:
16
15ee963675af change CLI interface: options: --relation --attribute
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    36
	void process(std::istream& input, std::shared_ptr<writer::RelationalWriter> writer, Configuration& configuration);
3
d7907be4cc40 allow also custom relation name, attribute names and types (optional)
František Kučera <franta-hg@frantovo.cz>
parents: 2
diff changeset
    37
14
012d491e219a separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    38
};
0
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
14
012d491e219a separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    40
}
0
eca0b23802e8 project skeleton
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
}
14
012d491e219a separate code into CSVCommand.h and CSVCommand.h
František Kučera <franta-hg@frantovo.cz>
parents: 10
diff changeset
    42
}