[Kst] kdeextragear-2/kst/kst/datasources/ascii

George Staikos staikos at kde.org
Mon Jan 17 10:18:18 CET 2005


CVS commit by staikos: 

datasource-internal skip is rapidly stabilizing, but this was incomplete so it
needs to be removed before merging kstrvector back into HEAD


  M +0 -76     ascii.cpp   1.33
  M +0 -2      ascii.h   1.13


--- kdeextragear-2/kst/kst/datasources/ascii/ascii.cpp  #1.32:1.33
@@ -226,80 +226,4 @@ int AsciiSource::readField(double *v, co
 
 
-int AsciiSource::readField(double *v, const QString& field, int s, int n, int skip, int *lastFrameRead) {
-  if (n < 0) {
-    n = 1; /* n < 0 means read one sample, not frame - irrelevent here */
-  }
-
-  if (field == "INDEX") {
-    for (int i = 0; i < n; i++) {
-      v[i] = double(s + i*skip);
-    }
-    if (lastFrameRead) {
-      *lastFrameRead = s + (n - 1) * skip;
-    }
-    return n;
-  }
-
-  bool ok;
-  int col = (int)field.toUInt(&ok);
-  if (!ok) {
-    return 0;
-  }
-
-  int bufstart = _rowIndex[s];
-  int bufread = _rowIndex[s + n] - bufstart;
-
-  QFile file(_filename);
-  if (!file.open(IO_ReadOnly)) {
-    _valid = false;
-    return 0;
-  }
-
-  char *tmpbuf = new char[bufread];
-
-  file.at(bufstart);
-  file.readBlock(tmpbuf, bufread);
-
-  // FIXME: I don't see why this was changed to memset() instead of just
-  //        setting the required elements to 0 inline when required, as it
-  //        did before.
-  memset(v, 0, n * sizeof(double));
-
-  for (int i = 0; i < n; i++, s++) {
-    bool done = false;
-    bool incol = false;
-    int i_col = 0;
-    for (int ch = _rowIndex[s] - bufstart; !done && ch < bufread; ch++) {
-      if (isspace(tmpbuf[ch])) {
-        if (tmpbuf[ch] == '\n' || tmpbuf[ch] == '\r' ) {
-          done = true;
-        } else {
-          incol = false;
-        }
-      } else if (tmpbuf[ch] == '#' || tmpbuf[ch] == '!' ||
-          tmpbuf[ch] == '/' || tmpbuf[ch] == ';' ||
-          tmpbuf[ch] == 'c') {
-        done = true;
-      } else {
-        if (!incol) {
-          incol = true;
-          i_col++;
-          if (i_col == col) {
-            done = true;
-            v[i] = atof(tmpbuf + ch);
-          }
-        }
-      }
-    }
-  }
-
-  delete[] tmpbuf;
-
-  file.close();
-
-  return n;
-}
-
-
 bool AsciiSource::isValidField(const QString& field) const {
   bool ok;

--- kdeextragear-2/kst/kst/datasources/ascii/ascii.h  #1.12:1.13
@@ -48,6 +48,4 @@ class AsciiSource : public KstDataSource
     virtual bool isEmpty() const;
 
-    virtual int readField(double *v, const QString& field, int s, int n, int skip, int *lastFrameRead = 0L);
-
   private:
     int *_rowIndex;




More information about the Kst mailing list