#include <iostream>
Go to the source code of this file.
Definition at line 12 of file CsvUtil.C.
15 std::ifstream f(csvFile.c_str());
void readFromCsv |
( |
std::istream & |
f, |
|
|
Wt::WAbstractItemModel * |
model, |
|
|
int |
numRows = -1 , |
|
|
bool |
firstLineIsHeaders = true |
|
) |
| |
Definition at line 25 of file CsvUtil.C.
35 typedef boost::tokenizer<boost::escaped_list_separator<char> >
37 CsvTokenizer tok(line);
40 for (CsvTokenizer::iterator i = tok.begin();
41 i != tok.end(); ++i, ++col) {
47 if (firstLineIsHeaders && csvRow == 0)
50 int dataRow = firstLineIsHeaders ? csvRow - 1 : csvRow;
52 if (numRows != -1 && dataRow >= numRows)
64 int i = std::strtol(s.c_str(), &end, 10);
68 double d = std::strtod(s.c_str(), &end);
75 model->
setData(dataRow, col, data);