-
Notifications
You must be signed in to change notification settings - Fork 0
/
abbottsoftwarereader.cpp
68 lines (53 loc) · 1.2 KB
/
abbottsoftwarereader.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <QFile>
#include <QStringList>
#include "abbottsoftwarereader.h"
AbbottSoftwareReader::AbbottSoftwareReader()
{
}
AbbottSoftwareReader::~AbbottSoftwareReader()
{
}
bool AbbottSoftwareReader::read(const QString &filename)
{
m_values.clear();
QFile file(filename);
if (file.open(QIODevice::ReadOnly) == false)
{
return false;
}
file.readLine();
file.readLine();
file.readLine();
QString line = file.readLine();
while (line.isEmpty() == false)
{
QStringList parts = line.split("\t");
if (parts.size() < 4)
{
line = file.readLine();
continue;
}
QDateTime date = QDateTime::fromString(parts[1], "yyyy.MM.dd HH:mm");
if (parts[2] != "0")
{
line = file.readLine();
continue;
}
int result = 0;
if (parts[3].isEmpty())
{
result = parts[4].toInt();
}
else
{
result = parts[3].toInt();
}
m_values.insert(date, result);
line = file.readLine();
}
return true;
}
const QMap<QDateTime, int> &AbbottSoftwareReader::getValues()
{
return m_values;
}