qse
0.5.4
Main Page
Related Pages
Classes
Files
File List
File Members
qse
qsefilereader.cpp
Go to the documentation of this file.
1
#include <QStringList>
2
#include <QTimer>
3
4
#include "
qsescan.h
"
5
#include "
qseinputfile.h
"
6
#include "
qsefilereader.h
"
7
#include "
qsecontroller.h
"
8
9
#include <stdio.h>
10
11
QseFileReader::QseFileReader
(
const
QString& name, QObject *parent)
12
:
inherited
(parent),
13
m_Timer(NULL),
14
m_Name(name),
15
m_Data(NULL),
16
m_Abort(false),
17
m_Restart(false),
18
m_Changed(false)
19
{
20
m_Data
=
new
QseInputFile
(
m_Name
);
21
22
m_Timer
=
new
QTimer(
this
);
23
24
connect(
m_Timer
, SIGNAL(timeout()),
this
, SLOT(
timerRoutine
()));
25
26
m_Timer
-> start(500);
27
}
28
29
QseFileReader::~QseFileReader
()
30
{
31
}
32
33
void
QseFileReader::openFile
(QString fileName)
34
{
35
m_FileNames
.clear();
36
m_FileNames
.append(fileName);
37
m_Restart
=
true
;
38
}
39
40
void
QseFileReader::appendFile
(QString fileName)
41
{
42
m_FileNames
.append(fileName);
43
}
44
45
void
QseFileReader::timerRoutine
()
46
{
47
forever {
48
int
atend =
m_Data
-> atEnd();
49
int
nfiles =
m_FileNames
.size();
50
51
if
(
m_Abort
)
return
;
52
53
if
(
m_Restart
|| atend) {
54
if
(
m_Restart
) {
55
m_Data
-> clear();
56
m_Restart
=
false
;
57
m_Changed
=
true
;
58
}
59
60
if
(nfiles) {
61
QString nextFile =
m_FileNames
.takeFirst();
62
// printf("next data file\n");
63
64
m_Data
-> nextDataFile(nextFile);
65
m_Changed
=
true
;
66
}
else
{
67
if
(
m_Changed
) {
68
m_Data
->
emitOperationCompleted
();
69
m_Changed
=
false
;
70
}
71
return
;
72
}
73
}
else
if
(!atend) {
74
m_Data
-> nextInputLine();
75
m_Changed
=
true
;
76
}
77
}
78
}
79
80
QseInputFile
*
QseFileReader::inputFile
()
81
{
82
return
m_Data
;
83
}
84
QseFileReader::m_Data
QseInputFile * m_Data
Definition:
qsefilereader.h:33
QseFileReader::m_Restart
bool m_Restart
Definition:
qsefilereader.h:35
qsefilereader.h
QseFileReader::appendFile
void appendFile(QString fileName)
Definition:
qsefilereader.cpp:40
QseFileReader::~QseFileReader
~QseFileReader()
Definition:
qsefilereader.cpp:29
QseFileReader::m_FileNames
QStringList m_FileNames
Definition:
qsefilereader.h:36
QseFileReader::m_Name
QString m_Name
Definition:
qsefilereader.h:32
QseFileReader::timerRoutine
void timerRoutine()
Definition:
qsefilereader.cpp:45
QseFileReader::QseFileReader
QseFileReader(const QString &name, QObject *parent=0)
Definition:
qsefilereader.cpp:11
QseFileReader::m_Timer
QTimer * m_Timer
Definition:
qsefilereader.h:31
QseFileReader::openFile
void openFile(QString fileName)
Definition:
qsefilereader.cpp:33
QseFileReader::inputFile
QseInputFile * inputFile()
Definition:
qsefilereader.cpp:80
qseinputfile.h
QseDataSet::emitOperationCompleted
void emitOperationCompleted()
Definition:
qsedataset.cpp:38
qsescan.h
QseInputFile
Definition:
qseinputfile.h:6
qsecontroller.h
QseFileReader::inherited
QObject inherited
Definition:
qsefilereader.h:21
QseFileReader::m_Abort
bool m_Abort
Definition:
qsefilereader.h:34
QseFileReader::m_Changed
int m_Changed
Definition:
qsefilereader.h:37
Generated by
1.8.6