[Kst] branches/work/kst/portto4/kst/src/datasources/ascii
Peter Kümmel
syntheticpp at gmx.net
Fri Jan 21 15:30:15 CET 2011
SVN commit 1216137 by kuemmel:
return when nothing more will happen
M +8 -9 asciisource.cpp
M +1 -1 asciisource.h
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1216136:1216137
@@ -443,24 +443,22 @@
// Read appropriate column and convert to double
v[i] = lexc.toDouble(&buffer[0] + _rowIndex[i] - _rowIndex[0] + _config._columnWidth * (col - 1));
}
+ return n;
} else if (_config._columnType == AsciiSourceConfig::Custom) {
- if (_config._columnDelimiter.value().isEmpty()) {
- return 0;
- }
+ if (!_config._columnDelimiter.value().isEmpty()) {
columnDelimiter = _config._columnDelimiter.value().toAscii().constData()[0];
- readColumns(v, buffer, bufstart, bufread, col, s, n, &isColumnDelimiter);
+ return readColumns(v, buffer, bufstart, bufread, col, s, n, &isColumnDelimiter);
+ }
} else if (_config._columnType == AsciiSourceConfig::Whitespace) {
- readColumns(v, buffer, bufstart, bufread, col, s, n, &isWhiteSpace);
- } else {
- return 0;
+ return readColumns(v, buffer, bufstart, bufread, col, s, n, &isWhiteSpace);
}
- return n;
+ return 0;
}
//-------------------------------------------------------------------------------------------
-void AsciiSource::readColumns(double* v, const char* buffer, int bufstart, int bufread, int col, int s, int n, bool (*isColumnDelemiterFunction)(char))
+int AsciiSource::readColumns(double* v, const char* buffer, int bufstart, int bufread, int col, int s, int n, bool (*isColumnDelemiterFunction)(char))
{
LexicalCast lexc;
lexc.setDecimalSeparator(_config._useDot, _config._localSeparator);
@@ -490,6 +488,7 @@
}
}
}
+ return n;
}
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.h #1216136:1216137
@@ -102,7 +102,7 @@
template<class T>
int readFromFile(QFile&, T& buffer, int start, int numberOfBytes, int maximalBytes = -1);
- void readColumns(double* v, const char* buffer, int bufstart, int bufread, int col, int s, int n, bool (*isColumnDelemiterFunction)(char));
+ int readColumns(double* v, const char* buffer, int bufstart, int bufread, int col, int s, int n, bool (*isColumnDelemiterFunction)(char));
void toDouble(const LexicalCast& lexc, const char* buffer, int bufread, int ch, double* v, int row);
// TODO remove
More information about the Kst
mailing list