![]() |
aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
|
Class for fast parsing of CSV file (never more than one line in application memory). More...
#include <agrum/base/database/CSVParser.h>
Public Member Functions | |
Constructors / Destructors | |
| CSVParser (std::istream &in, const std::string &filename, const std::string &delimiter=",", const char commentmarker='#', const char quoteMarker='"') | |
| default constructor | |
| virtual | ~CSVParser () |
| destructor | |
Accessors / Modifiers | |
| bool | next () |
| gets the next line of the csv stream and parses it | |
| const std::vector< std::string > & | current () const |
| returns the current parsed line | |
| std::size_t | nbLine () const |
| returns the current line number within the stream | |
| void | useNewStream (std::istream &in, const std::string &delimiter=",", const char commentmarker='#', const char quoteMarker='"') |
| reopens a new input stream to parse | |
Class for fast parsing of CSV file (never more than one line in application memory).
Typical use:
Definition at line 77 of file CSVParser.h.
| gum::learning::CSVParser::CSVParser | ( | std::istream & | in, |
| const std::string & | filename, | ||
| const std::string & | delimiter = ",", | ||
| const char | commentmarker = '#', | ||
| const char | quoteMarker = '"' ) |
default constructor
| in | an input stream containing the CSV |
| delimiter | the character that acts as the column separator in the CSV |
| commentmarker | the character that marks the beginning of a comment |
| quoteMarker | the character that is used to quote the sentences in the CSV |
|
virtual |
destructor
| const std::vector< std::string > & gum::learning::CSVParser::current | ( | ) | const |
returns the current parsed line
| NullElement | is raised if there is no data |
| std::size_t gum::learning::CSVParser::nbLine | ( | ) | const |
returns the current line number within the stream
| bool gum::learning::CSVParser::next | ( | ) |
gets the next line of the csv stream and parses it
| void gum::learning::CSVParser::useNewStream | ( | std::istream & | in, |
| const std::string & | delimiter = ",", | ||
| const char | commentmarker = '#', | ||
| const char | quoteMarker = '"' ) |
reopens a new input stream to parse