Utility function that reads a model from a CSV file.
65 typedef boost::tokenizer<boost::escaped_list_separator<char> >
67 CsvTokenizer tok(line);
70 for (CsvTokenizer::iterator i = tok.begin();
71 i != tok.end(); ++i, ++col) {
73 if (col >= model->columnCount())
74 model->insertColumns(model->columnCount(),
75 col + 1 - model->columnCount());
77 if (firstLineIsHeaders && csvRow == 0)
78 model->setHeaderData(col, boost::any(Wt::WString::fromUTF8(*i)));
80 int dataRow = firstLineIsHeaders ? csvRow - 1 : csvRow;
82 if (numRows != -1 && dataRow >= numRows)
85 if (dataRow >= model->rowCount())
86 model->insertRows(model->rowCount(),
87 dataRow + 1 - model->rowCount());
89 boost::any data(Wt::WString::fromUTF8(*i));
90 model->setData(dataRow, col, data);