OpenMS
Loading...
Searching...
No Matches
CsvFile.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg $
6// $Authors: David Wojnar $
7// --------------------------------------------------------------------------
8
9#pragma once
10
13
14namespace OpenMS
15{
29 class OPENMS_DLLAPI CsvFile :
30 private TextFile
31 {
32public:
33
36
38 ~CsvFile() override;
39
50 CsvFile(const std::string& filename, char is = ',', bool ie = false, Int first_n = -1);
51
62 void load(const std::string& filename, char is = ',', bool ie = false, Int first_n = -1);
63
69 void store(const std::string& filename);
70
76 void addRow(const StringList& list);
77
83 void clear();
84
95 bool getRow(Size row, StringList& list) const;
96
102 std::vector<std::string>::size_type rowCount() const;
103
104private:
107
108 };
109
110} // namespace OpenMS
111
This class handles csv files. Currently only loading is implemented.
Definition CsvFile.h:31
bool getRow(Size row, StringList &list) const
writes all items from a row to list
void load(const std::string &filename, char is=',', bool ie=false, Int first_n=-1)
Loads data from a text file.
bool itemenclosed_
Definition CsvFile.h:106
void addRow(const StringList &list)
Add a row to the buffer.
void store(const std::string &filename)
Stores the buffer's content into a file.
CsvFile()
Default constructor.
char itemseperator_
Definition CsvFile.h:105
void clear()
Clears the buffer.
std::vector< std::string >::size_type rowCount() const
Returns the number of rows that were loaded from the file.
CsvFile(const std::string &filename, char is=',', bool ie=false, Int first_n=-1)
Constructor with filename.
~CsvFile() override
destructor
Definition TextFile.h:21
int Int
Signed integer type.
Definition Types.h:72
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
std::vector< std::string > StringList
Vector of String.
Definition ListUtils.h:44
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19