[Kst] branches/work/kst/portto4/kst/src/datasources/ascii
Peter Kümmel
syntheticpp at gmx.net
Sun Oct 14 12:03:32 UTC 2012
SVN commit 1320485 by kuemmel:
FileBuffer: move member function to source file
M +0 -26 asciidatareader.cpp
M +26 -0 asciifilebuffer.cpp
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciidatareader.cpp #1320484:1320485
@@ -91,32 +91,6 @@
}
//-------------------------------------------------------------------------------------------
-int AsciiFileBuffer::read(QFile& file, int start, int bytesToRead, int maximalBytes)
-{
- _begin = -10;
- _bytesRead = -10;
-
- if (maximalBytes == -1) {
- if (!resize(bytesToRead + 1))
- return 0;
- } else {
- bytesToRead = qMin(bytesToRead, maximalBytes);
- if (!resize(bytesToRead + 1))
- return 0;
- }
- file.seek(start); // expensive?
- int bytesRead = file.read(data(), bytesToRead);
- if (!resize(bytesRead + 1))
- return 0;
-
- data()[bytesRead] = '\0';
- _begin = start;
- _bytesRead = bytesRead;
-
- return bytesRead;
-}
-
-//-------------------------------------------------------------------------------------------
bool AsciiDataReader::findDataRows(int& numFrames, bool read_completely, QFile& file, int _byteLength)
{
detectLineEndingType(file);
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciifilebuffer.cpp #1320484:1320485
@@ -40,3 +40,29 @@
_bytesRead = -10;
}
+//-------------------------------------------------------------------------------------------
+int AsciiFileBuffer::read(QFile& file, int start, int bytesToRead, int maximalBytes)
+{
+ _begin = -10;
+ _bytesRead = -10;
+
+ if (maximalBytes == -1) {
+ if (!resize(bytesToRead + 1))
+ return 0;
+ } else {
+ bytesToRead = qMin(bytesToRead, maximalBytes);
+ if (!resize(bytesToRead + 1))
+ return 0;
+ }
+ file.seek(start); // expensive?
+ int bytesRead = file.read(data(), bytesToRead);
+ if (!resize(bytesRead + 1))
+ return 0;
+
+ data()[bytesRead] = '\0';
+ _begin = start;
+ _bytesRead = bytesRead;
+
+ return bytesRead;
+}
+
More information about the Kst
mailing list