[Kst] branches/work/kst/portto4/kst/src/datasources/ascii

Peter Kümmel syntheticpp at gmx.net
Sat Oct 13 17:41:09 UTC 2012


SVN commit 1320352 by kuemmel:

split out AsciiDataReader step by step

 M  +2 -1      asciidatareader.h  
 M  +10 -3     asciisource.cpp  


--- branches/work/kst/portto4/kst/src/datasources/ascii/asciidatareader.h #1320351:1320352
@@ -90,7 +90,8 @@
 
     int readFromFile(QFile&, AsciiDataReader::FileBuffer&, int start, int numberOfBytes, int maximalBytes = -1); 
     
-    int readField(double *v, const QString &field, int s, int n, bool& re_alloc);
+    int readField(const RowIndex& _rowIndex, FileBuffer* _fileBuffer, int col, int bufstart, int bufread,
+                  double *v, const QString& field, int s, int n, bool& re_alloc);
 
 
     struct LineEndingType {
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1320351:1320352
@@ -430,6 +430,13 @@
     _fileBuffer->_bufferedN = n;
   }
 
+ return r.readField(_rowIndex, _fileBuffer, col, bufstart, bufread, v, field, s, n, re_alloc);
+}
+
+int AsciiDataReader::readField(const RowIndex& _rowIndex, FileBuffer* _fileBuffer, int col, int bufstart, int bufread,
+                               double *v, const QString& field, int s, int n, bool& re_alloc) 
+  {
+
   if (_config._columnType == AsciiSourceConfig::Fixed) {
     MeasureTime t("AsciiSource::readField: same width for all columns");
     LexicalCast lexc;
@@ -445,16 +452,16 @@
     if (_config._columnDelimiter.value().size() == 1) {
       MeasureTime t("AsciiSource::readField: 1 custom column delimiter");
       const AsciiDataReader::IsCharacter column_del(_config._columnDelimiter.value()[0].toLatin1());
-      return r.readColumns(_rowIndex, v, _fileBuffer->constData(), bufstart, bufread, col, s, n, r._lineending, column_del);
+      return readColumns(_rowIndex, v, _fileBuffer->constData(), bufstart, bufread, col, s, n, _lineending, column_del);
     } if (_config._columnDelimiter.value().size() > 1) {
       MeasureTime t(QString("AsciiSource::readField: %1 custom column delimiters").arg(_config._columnDelimiter.value().size()));
       const AsciiDataReader::IsInString column_del(_config._columnDelimiter.value());
-      return r.readColumns(_rowIndex, v, _fileBuffer->constData(), bufstart, bufread, col, s, n, r._lineending, column_del);
+      return readColumns(_rowIndex, v, _fileBuffer->constData(), bufstart, bufread, col, s, n, _lineending, column_del);
     }
   } else if (_config._columnType == AsciiSourceConfig::Whitespace) {
     MeasureTime t("AsciiSource::readField: whitespace separated columns");
     const AsciiDataReader::IsWhiteSpace column_del;
-    return r.readColumns(_rowIndex, v, _fileBuffer->constData(), bufstart, bufread, col, s, n, r._lineending, column_del);
+    return readColumns(_rowIndex, v, _fileBuffer->constData(), bufstart, bufread, col, s, n, _lineending, column_del);
   }
 
   return 0;


More information about the Kst mailing list