30 #include <wreport/var.h> 68 std::vector<std::string>
cols;
78 void open(
const std::string& pathname);
90 int as_int(
unsigned col)
const;
121 static std::string unescape(
const std::string& csvstr);
149 void add_value_empty();
152 void add_value_raw(
const char* str);
155 void add_value_raw(
const std::string& str);
158 void add_value(
int val);
161 void add_value_withmissing(
int val);
164 void add_value(
unsigned val);
167 void add_value(uint64_t val);
179 void add_value(
const char* val);
182 void add_value(
const std::string& val);
185 virtual void flush_row() = 0;
wreport::Varcode as_varcode(unsigned col) const
Return the given column, as a Varcode.
std::string line
Last line read.
Definition: csv.h:65
void csv_output_quoted_string(std::ostream &out, const std::string &str)
Output a string value, quoted if needed according to CSV rules.
bool close_on_exit
If true, the input stream will be deleted upon destruction.
Definition: csv.h:63
Copyright (C) 2008–2010 ARPA-SIM urpsim@smr.arpa.emr.it
Definition: cmdline.h:17
bool next()
Read the next CSV line, returning false if EOF is reached.
void open(const std::string &pathname)
Open the given file and sets close_on_exit to true.
int as_int_withmissing(unsigned col) const
Return the given column, as an integer.
bool csv_read_next(FILE *in, std::vector< std::string > &cols)
Parse a CSV line.
void close()
Sets in to 0.
std::vector< std::string > cols
Parsed CSV columns for the last line read.
Definition: csv.h:68
int as_int(unsigned col) const
Return the given column, as an integer.
bool move_to_data(unsigned number_col=0)
Find the first line where the given column exists and starts with a number.