-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpersistentobject.cpp
52 lines (42 loc) · 1.08 KB
/
persistentobject.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
#include "persistentobject.h"
#include <QDebug>
persistentObject::persistentObject(QString className)
{
attributes = new QList<persistentAttribute*>();
table = &className; // QString pointer holds address of QString 'className'
}
persistentObject::~persistentObject()
{
}
void persistentObject::addAttribute(persistentAttribute nouvel_attribut)
{
attributes->append(&nouvel_attribut);
}
int persistentObject::save()
{
return 0;
}
QList<persistentAttribute*> persistentObject::getAttributes()
{
return *attributes;
}
QString persistentObject::getAuteur()
{
QList<persistentAttribute*> temp = *attributes;
return *static_cast<QString*>(temp[0]->data);
}
QString persistentObject::getTitre()
{
QList<persistentAttribute*> temp = *attributes;
return *static_cast<QString*>(temp[1]->data);
}
QString persistentObject::getISBN()
{
QList<persistentAttribute*> temp = *attributes;
return *static_cast<QString*>(temp[2]->data);
}
int persistentObject::getAnnee()
{
QList<persistentAttribute*> temp = *attributes;
return *static_cast<int*>(temp[3]->data);
}