-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstudent.cpp
111 lines (90 loc) · 2.04 KB
/
student.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#include "student.h"
#include <QStringList>
Student::Student(int _id, QString _surname, QString _name, QString _patronymic, QString _note)
: QObject(), id(_id), name(_name), surname(_surname), patronymic(_patronymic), note(_note)
{
}
Student::Student(int _id, QDomNode studentNode) : QObject(), id(_id)
{
QStringList nameData = studentNode.firstChildElement("gsx:фио").text().split(" ");
surname = nameData[0];
name = nameData[1];
patronymic = nameData.size() < 3 ? "" : nameData[2];
QStringList groupData = studentNode.firstChildElement("gsx:группа").text().split("-");
group = groupData[0].toInt();
subgroup = groupData.size() < 2 ? 0 : groupData[1].toInt();
note = studentNode.firstChildElement("gsx:заметки").text();
updated = QDateTime::fromString(studentNode.firstChildElement("updated").text(), Qt::ISODate);
}
QString Student::getName() const
{
return name;
}
void Student::setName(const QString& value)
{
name = value;
emitDataUpdated();
}
QString Student::getSurname() const
{
return surname;
}
void Student::setSurname(const QString& value)
{
surname = value;
emitDataUpdated();
}
QString Student::getPatronymic() const
{
return patronymic;
}
void Student::setPatronymic(const QString& value)
{
patronymic = value;
emitDataUpdated();
}
int Student::getGroup() const
{
return group;
}
void Student::setGroup(const int& value)
{
group = value;
emitDataUpdated();
}
int Student::getSubgroup() const
{
return subgroup;
}
void Student::setSubgroup(const int& value)
{
subgroup = value;
emitDataUpdated();
}
QString Student::getNote() const
{
return note;
}
void Student::setNote(const QString& value)
{
note = value;
emitDataUpdated();
}
int Student::getId() const
{
return id;
}
void Student::setId(int value)
{
id = value;
emitDataUpdated();
}
QDateTime Student::getUpdatedDate() const
{
return updated;
}
void Student::emitDataUpdated()
{
updated = QDateTime::currentDateTimeUtc();
emit dataUpdated(this);
}