This repository has been archived by the owner on Nov 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinkedinclient.cpp
105 lines (78 loc) · 2.07 KB
/
linkedinclient.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
#include "linkedinclient.h"
#include<iostream>
using std::cout;
using std::endl;
LinkedinClient::LinkedinClient(string u):pdb(new DB()){
pdb->load();
user=pdb->find(u);
if(user==0){
delete pdb;
throw access_denied;
}
}
LinkedinClient::~LinkedinClient(){
if(pdb) delete pdb;
if(user) delete user;
}
void LinkedinClient::changeProfilo(string n,string c,string d,string m){
Profilo* pf=const_cast<Profilo*>(user->getProfilo());
bool modifica=false;
if( n !="\n"){
modifica=true;
pf->setNome(n);
}
if(c !="\n"){
modifica=true;
pf->setCognome(c);
}
if(d !="\n"){
modifica=true;
pf->setData(d);
}
if(m !="\n"){
modifica=true;
pf->setMail(m);
}
if(modifica){
throw change_profilo_ok;
}
}
void LinkedinClient::insertContatto(string nick){
Utente* j=pdb->find(nick);
if(j!=0){
(user->getRete())->add_Contatto(j,nick);
}
}
void LinkedinClient::removeContatto(string us){
(user->getRete())->remove_Contatto(us);
}
map<string,vector<list<string> > > LinkedinClient::search(string nome,string cognome)const{
return user->userSearch(*pdb,nome,cognome);
}
void LinkedinClient::save()const{
pdb->save();
}
Utente* LinkedinClient::getUser()const{
return user;
}
void LinkedinClient::insertLanguage(string l){
user->getProfilo()->getInfo()->addLingue(l);
}
void LinkedinClient::removeLanguage(string lingua){
user->getProfilo()->getInfo()->eraseLingue(lingua);
}
void LinkedinClient::insertStudy(string titolo_studio){
user->getProfilo()->getInfo()->addStudi(titolo_studio);
}
void LinkedinClient::removeStudy(string titolo_studio){
user->getProfilo()->getInfo()->eraseStudi(titolo_studio);
}
void LinkedinClient::changeEsp(int pos,string text){
user->getProfilo()->getInfo()->replaceEsp(pos,text);
}
void LinkedinClient::insertEsp(string desc){
user->getProfilo()->getInfo()->addEsp(desc);
}
void LinkedinClient::removeEsp(string desc){
user->getProfilo()->getInfo()->eraseEsp(desc);
}