forked from iseghiri/LO21_project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Relations.hpp
98 lines (51 loc) · 2.13 KB
/
Relations.hpp
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
#ifndef relations_hpp
#define relations_hpp
#include "Note.hpp"
#endif
/*******************************************************************
*** Base Relation ***
*******************************************************************/
class BaseRelation{
protected:
string description;
Couple** couples;
unsigned int nbCouple, nbMaxCouple;
public:
BaseRelation(const std::string & d) : description(d), couples(nullptr), nbCouple(0), nbMaxCouple(0) {}
BaseRelation() : description(""), couples(nullptr), nbCouple(0), nbMaxCouple(0) {}
//Accesor
const string & getDescription () const {return description;}
addCouple(Note*, Note*);
removeCouple(Note*,Note*);
~Relation() =0;
};
/*******************************************************************
*** Relation ***
*******************************************************************/
class Relation public BaseRelation {
std::string title;
bool oriented;
public:
Relation(const string & d, const string& t) : BaseRelation(d), title(t), oriented(false) {}
const string& getTitle() const {return title;}
void setOriented(){oriented= !oriented;};
~Relation() {for (unsigned int i=0; i<nbCouple;i++) delete couples[i]; delete [] couples;}
};
/*******************************************************************
*** Decorateur ***
*******************************************************************/
class Decorateur : public BaseRelation {
BaseRelation& base;
public:
Decorateur( const std::string& d, BaseRelation& b) : BaseRelation(d), base(b) {}
~Decorateur ()=0;
};
/*******************************************************************
*** Référence ***
*******************************************************************/
class Reference : public Decorateur {
~Reference() {
for (unsigned int i=0; i<nbCouple; i++) delete couples[i];
delete [] couples;
}
};