[Kst] branches/work/kst/portto4/kst/src/datasources/ascii
Peter Kümmel
syntheticpp at gmx.net
Thu Jan 20 14:02:17 CET 2011
SVN commit 1215949 by kuemmel:
AsciiDatasource: only add header when header option is used
M +7 -1 asciisource.cpp
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1215948:1215949
@@ -256,6 +256,7 @@
if (!openValidFile(file)) {
return false;
}
+ int header_row = 0;
int left = _config._dataLine;
int didRead = 0;
while (left > 0) {
@@ -265,6 +266,8 @@
}
didRead += line.size();
--left;
+ _strings[QString("Header %1").arg(header_row, 2, 10, QChar('0'))] = QString::fromAscii(line).trimmed();
+ header_row++;
}
_rowIndex[0] = didRead;
}
@@ -504,12 +507,15 @@
}
}
}
+ /*
+ // TODO enable by option: "Add unparsable lines as strings"
if (!found_value) {
if (_rowIndex.size() > s+1) {
QString unparsable = QString::fromAscii(&buffer[_rowIndex[s]], _rowIndex[s+1] - _rowIndex[s]);
- _strings[QString("Line %1").arg(i)] = unparsable.trimmed();
+ _strings[QString("Unparsable %1").arg(i)] = unparsable.trimmed();
}
}
+ */
}
} else {
return 0;
More information about the Kst
mailing list