[Kst] branches/work/kst/portto4/kst/src/datasources/ascii
Peter Kümmel
syntheticpp at gmx.net
Fri Jan 21 14:29:31 CET 2011
SVN commit 1216119 by kuemmel:
AsciiDatasource:
first check if there is a character which is used for a line end,
and if one is found break->go to the next line.
This is the some in both cases, so the code becomes identical and
could be replaced by a function.
M +6 -8 asciisource.cpp
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1216118:1216119
@@ -446,12 +446,13 @@
for (int i = 0; i < n; ++i, ++s) {
bool incol = false;
int i_col = 0;
+
v[i] = Kst::NOPOINT;
for (int ch = _rowIndex[s] - bufstart; ch < bufread; ++ch) {
- if (columnDelimiter.contains(buffer[ch])) {
- incol = false;
- } else if (buffer[ch] == '\n' || buffer[ch] == '\r') {
+ if (buffer[ch] == '\n' || buffer[ch] == '\r') {
break;
+ } else if (columnDelimiter.contains(buffer[ch])) { //<- check for column start
+ incol = false;
} else if (delimiters.contains(buffer[ch])) {
break;
} else {
@@ -468,20 +469,17 @@
}
} else if (_config._columnType == AsciiSourceConfig::Whitespace) {
const QString delimiters = _config._delimiters.value();
- for (int i = 0; i < n; i++, s++)
- {
+ for (int i = 0; i < n; i++, s++) {
bool incol = false;
int i_col = 0;
v[i] = Kst::NOPOINT;
int ch;
for (ch = _rowIndex[s] - bufstart; ch < bufread; ++ch) {
- if (isspace((unsigned char)buffer[ch])) {
if (buffer[ch] == '\n' || buffer[ch] == '\r') {
break;
- } else {
+ } else if (isspace((unsigned char)buffer[ch])) { //<- check for column start
incol = false;
- }
} else if (delimiters.contains(buffer[ch])) {
break;
} else {
More information about the Kst
mailing list