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

George Staikos staikos at kde.org
Fri Apr 15 04:37:55 CEST 2005


CVS commit by staikos: 

implement reset() - makes reload with ascii files very fast!


  M +23 -0     ascii.cpp   1.57
  M +2 -0      ascii.h   1.22


--- kdeextragear-2/kst/kst/datasources/ascii/ascii.cpp  #1.56:1.57
@@ -188,4 +188,27 @@ AsciiSource::~AsciiSource() {
 
 
+bool AsciiSource::reset() {
+  if (_tmpBuf) {
+    free(_tmpBuf);
+    _tmpBuf = 0L;
+    _tmpBufSize = 0;
+  }
+
+  if (_rowIndex) {
+    free(_rowIndex);
+    _rowIndex = 0L;
+    _numLinesAlloc = 0;
+  }
+
+  _haveHeader = false;
+  _fieldListComplete = false;
+  _fieldList.clear();
+
+  update(); // Yuck - same problem as in the constructor presently.
+
+  return true;
+}
+
+
 bool AsciiSource::initRowIndex() {
   if (!_rowIndex) {

--- kdeextragear-2/kst/kst/datasources/ascii/ascii.h  #1.21:1.22
@@ -56,4 +56,6 @@ class AsciiSource : public KstDataSource
     bool fieldListIsComplete() const;
 
+    bool reset();
+
     class Config;
     static QStringList fieldListFor(const QString& filename, Config *cfg);




More information about the Kst mailing list