libodsstream
Library for mass spectrometry
Loading...
Searching...
No Matches
tsvreader.h
Go to the documentation of this file.
1/**
2 * \file odsstream/tsvreader.h
3 * \date 11/11/2018
4 * \author Olivier Langella
5 * \brief parser for text files (tsv, csv)
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2018 Olivier Langella <Olivier.Langella@u-psud.fr>.
10 *
11 * This file is part of the libodsstream library.
12 *
13 * libodsstream is a library to read and write ODS documents as streams
14 * Copyright (C) 2018 Olivier Langella <Olivier.Langella@u-psud.fr>
15 *
16 * This program is free software: you can redistribute it and/or modify
17 * it under the terms of the GNU Lesser General Public License as published
18 *by the Free Software Foundation, either version 3 of the License, or (at your
19 *option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU Lesser General Public License for more details.
25 *
26 * You should have received a copy of the GNU Lesser General Public License
27 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 *
29 * Contributors:
30 * Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and
31 *implementation
32 ******************************************************************************/
33
34#pragma once
35
36#include <QFile>
37#include <QTextStream>
38#include "config.h"
39#include "reader/odscell.h"
41
42
44{
45
46 private:
47 std::size_t m_columnNumber=0;
48 std::size_t m_rowNumber=0;
49
51
52 QChar m_separator = '\t';
53
54 public:
55 /**
56 * creates an ODS reader with a reader handler
57 *
58 * @Param OdsDocHandlerInterface & the interface to implement to read ODS
59 * files
60 */
61
63 virtual ~TsvReader();
64
65
66 void parse(QFile &tsvFile);
67 void parse(QIODevice *p_inputstream);
68 void parse(QTextStream &in);
69
70 void setSeparator(TsvSeparator separator);
71
72
73 private:
74 /** @brief reads a CSV row
75 * based on
76 * https://stackoverflow.com/questions/27318631/parsing-through-a-csv-file-in-qt
77 */
78 bool readCsvRow(QTextStream &in);
79};
void parse(QFile &tsvFile)
Definition tsvreader.cpp:67
virtual ~TsvReader()
Definition tsvreader.cpp:45
QChar m_separator
Definition tsvreader.h:52
OdsDocHandlerInterface & m_handler
Definition tsvreader.h:50
bool readCsvRow(QTextStream &in)
reads a CSV row based on https://stackoverflow.com/questions/27318631/parsing-through-a-csv-file-in-q...
void setSeparator(TsvSeparator separator)
Definition tsvreader.cpp:49
std::size_t m_columnNumber
Definition tsvreader.h:47
std::size_t m_rowNumber
Definition tsvreader.h:48
TsvSeparator
Definition config.h:11
interface to use as a wildcard to writer in either TSV, ODS TSVdirectory writers any kind of writer c...