[Kst] branches/work/kst/portto4/kst/src/datasources/ascii
Peter Kümmel
syntheticpp at gmx.net
Sun Oct 14 12:03:07 UTC 2012
SVN commit 1320474 by kuemmel:
r is a reader
M +11 -11 asciisource.cpp
M +8 -16 asciisource.h
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1320473:1320474
@@ -53,7 +53,7 @@
//-------------------------------------------------------------------------------------------
AsciiSource::AsciiSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement& e) :
Kst::DataSource(store, cfg, filename, type),
- r(_config),
+ reader(_config),
_fileBuffer(new AsciiFileBuffer),
is(new DataInterfaceAsciiString(*this)),
iv(new DataInterfaceAsciiVector(*this))
@@ -99,7 +99,7 @@
{
// forget about cached data
_fileBuffer->clearFileBuffer();
- r.rowIndex().clear();
+ reader.rowIndex().clear();
_valid = false;
_byteLength = 0;
@@ -138,9 +138,9 @@
bool AsciiSource::initRowIndex()
{
// capacity is at least the pre-allocated memory
- r.rowIndex().resize(r.rowIndex().capacity());
+ reader.rowIndex().resize(reader.rowIndex().capacity());
- r.rowIndex()[0] = 0;
+ reader.rowIndex()[0] = 0;
_byteLength = 0;
_numFrames = 0;
@@ -164,7 +164,7 @@
}
header_row++;
}
- r.rowIndex()[0] = didRead;
+ reader.rowIndex()[0] = didRead;
}
return true;
@@ -223,7 +223,7 @@
}
_byteLength = file.size();
- bool new_data = r.findDataRows(_numFrames, read_completely, file, _byteLength);
+ bool new_data = reader.findDataRows(_numFrames, read_completely, file, _byteLength);
return (!new_data && !force_update ? NoChange : Updated);
}
@@ -315,8 +315,8 @@
return 0;
}
- int bufstart = r.rowIndex()[s];
- int bufread = r.rowIndex()[s + n] - bufstart;
+ int bufstart = reader.rowIndex()[s];
+ int bufread = reader.rowIndex()[s + n] - bufstart;
if (bufread <= 0) {
return 0;
}
@@ -327,9 +327,9 @@
return 0;
}
- r.detectLineEndingType(file);
+ reader.detectLineEndingType(file);
- bufread = r.readFromFile(file, *_fileBuffer, bufstart, bufread);
+ bufread = reader.readFromFile(file, *_fileBuffer, bufstart, bufread);
if (bufread == 0) {
success = false;
return 0;
@@ -338,7 +338,7 @@
_fileBuffer->_bufferedN = n;
}
- return r.readField(_fileBuffer, col, bufstart, bufread, v, field, s, n);
+ return reader.readField(_fileBuffer, col, bufstart, bufread, v, field, s, n);
}
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.h #1320473:1320474
@@ -10,33 +10,28 @@
* *
***************************************************************************/
-#ifndef ASCII_H
-#define ASCII_H
+#ifndef ASCII_SOURCE_H
+#define ASCII_SOURCE_H
+#include "asciidatareader.h"
+#include "asciisourceconfig.h"
+
#include "datasource.h"
#include "dataplugin.h"
-#include "asciisourceconfig.h"
-#include "asciidatareader.h"
-
-#include <QFile>
-
-
-
+class QFile;
class DataInterfaceAsciiString;
class DataInterfaceAsciiVector;
-struct LexicalCast;
+
class AsciiSource : public Kst::DataSource
{
Q_OBJECT
public:
AsciiSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement& e = QDomElement());
-
~AsciiSource();
-
bool initRowIndex();
UpdateType internalDataSourceUpdate(bool read_completely);
@@ -59,7 +54,6 @@
int sampleForTime(const QDateTime& time, bool *ok);
-
virtual void reset();
virtual const QString& typeString() const;
@@ -74,20 +68,18 @@
Kst::ObjectList<Kst::Object> autoCurves(Kst::ObjectStore& objectStore);
private:
- AsciiDataReader r;
+ AsciiDataReader reader;
AsciiFileBuffer* _fileBuffer;
friend class ConfigWidgetAscii;
mutable AsciiSourceConfig _config;
-
int _numFrames;
int _byteLength;
bool _haveHeader;
bool _fieldListComplete;
-
QStringList _scalarList;
QMap<QString, QString> _strings;
QStringList _fieldList;
More information about the Kst
mailing list