Utility function that reads a model from a CSV file.
66 typedef boost::tokenizer<boost::escaped_list_separator<char> >
68 CsvTokenizer tok(line);
71 for (CsvTokenizer::iterator i = tok.begin();
72 i != tok.end(); ++i, ++col) {
74 if (col >= model->columnCount())
75 model->insertColumns(model->columnCount(),
76 col + 1 - model->columnCount());
78 if (firstLineIsHeaders && csvRow == 0)
79 model->setHeaderData(col, boost::any(Wt::WString::fromUTF8(*i)));
81 int dataRow = firstLineIsHeaders ? csvRow - 1 : csvRow;
83 if (numRows != -1 && dataRow >= numRows)
86 if (dataRow >= model->rowCount())
87 model->insertRows(model->rowCount(),
88 dataRow + 1 - model->rowCount());
90 boost::any data(Wt::WString::fromUTF8(*i));
91 model->setData(dataRow, col, data);