-
Notifications
You must be signed in to change notification settings - Fork 0
/
FunctionsViruchka.cpp
67 lines (55 loc) · 973 Bytes
/
FunctionsViruchka.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 "FunctionsViruchka.h"
FunctionsViruchka::FunctionsViruchka(void)
{
}
FunctionsViruchka::~FunctionsViruchka(void)
{
}
void FunctionsViruchka::addVir(viruchka &temp)
{
vir.append(temp);
}
bool FunctionsViruchka::SaveViruchkaFile(QString filename)
{
QFile file(filename);
if(file.open(QIODevice::WriteOnly))
{
QDataStream tmp(&file);
if(vir.size())tmp<<vir.size();
for(int i=0; i<vir.size();i++)
{
tmp<<vir[i].date;
tmp<<vir[i].DLC;
tmp<<vir[i].kurs;
tmp<<vir[i].summD;
tmp<<vir[i].summR;
}
return true;
}
return false;
}
bool FunctionsViruchka::LoadViruchkaFile(QString filename)
{
QFile file(filename);
viruchka temp;
if(file.open(QIODevice::ReadOnly))
{
QDataStream tmp(&file);
int j=0;
tmp>>j;
if(j){
for(int i=0; i<j;i++)
{
tmp>>temp.date;
tmp>>temp.DLC;
tmp>>temp.kurs;
tmp>>temp.summD;
tmp>>temp.summR;
vir.append(temp);
int k=0;
}
}
return true;
}
return false;
}