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

Peter Kümmel syntheticpp at gmx.net
Sun Oct 14 12:03:41 UTC 2012


SVN commit 1320489 by kuemmel:

bufstart/bufread are now part of FileBuffer

 M  +5 -6      asciidatareader.cpp  
 M  +1 -2      asciidatareader.h  
 M  +1 -1      asciisource.cpp  


--- branches/work/kst/portto4/kst/src/datasources/ascii/asciidatareader.cpp #1320488:1320489
@@ -183,8 +183,7 @@
 }
 
 //-------------------------------------------------------------------------------------------
-int AsciiDataReader::readField(AsciiFileBuffer* _fileBuffer, int col, int bufstart, int bufread,
-                               double *v, const QString& field, int s, int n)
+int AsciiDataReader::readField(AsciiFileBuffer* buf, int col, double *v, const QString& field, int s, int n)
 {
   if (_config._columnType == AsciiSourceConfig::Fixed) {
     MeasureTime t("AsciiSource::readField: same width for all columns");
@@ -192,7 +191,7 @@
     lexc.setDecimalSeparator(_config._useDot);
     // &buffer[0] points to first row at _rowIndex[0] , so if we wanna find
     // the column in row i by adding _rowIndex[i] we have to start at:
-    const char* col_start = &_fileBuffer->constData()[0] - _rowIndex[0] + _config._columnWidth * (col - 1);
+    const char* col_start = &buf->constData()[0] - _rowIndex[0] + _config._columnWidth * (col - 1);
     for (int i = 0; i < n; ++i) {
       v[i] = lexc.toDouble(_rowIndex[i] + col_start);
     }
@@ -201,16 +200,16 @@
     if (_config._columnDelimiter.value().size() == 1) {
       MeasureTime t("AsciiSource::readField: 1 custom column delimiter");
       const IsCharacter column_del(_config._columnDelimiter.value()[0].toLatin1());
-      return readColumns(v, _fileBuffer->constData(), bufstart, bufread, col, s, n, _lineending, column_del);
+      return readColumns(v, buf->constData(), buf->begin(), buf->bytesRead(), 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 IsInString column_del(_config._columnDelimiter.value());
-      return readColumns(v, _fileBuffer->constData(), bufstart, bufread, col, s, n, _lineending, column_del);
+      return readColumns(v, buf->constData(), buf->begin(), buf->bytesRead(), col, s, n, _lineending, column_del);
     }
   } else if (_config._columnType == AsciiSourceConfig::Whitespace) {
     MeasureTime t("AsciiSource::readField: whitespace separated columns");
     const IsWhiteSpace column_del;
-    return readColumns(v, _fileBuffer->constData(), bufstart, bufread, col, s, n, _lineending, column_del);
+    return readColumns(v, buf->constData(), buf->begin(), buf->bytesRead(), col, s, n, _lineending, column_del);
   }
   return 0;
 }
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciidatareader.h #1320488:1320489
@@ -37,8 +37,7 @@
     void detectLineEndingType(QFile& file);
     
     bool findDataRows(bool read_completely, QFile& file, int _byteLength);
-    int readField(AsciiFileBuffer* _fileBuffer, int col, int bufstart, int bufread,
-                  double *v, const QString& field, int s, int n);
+    int readField(AsciiFileBuffer* buf, int col, double *v, const QString& field, int s, int n);
 
   private:
     int _numFrames;
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1320488:1320489
@@ -325,7 +325,7 @@
     }
   }
   
-  return reader.readField(_fileBuffer, col, bufstart, bufread, v, field, s, n);
+  return reader.readField(_fileBuffer, col, v, field, s, n);
 }
 
 


More information about the Kst mailing list