-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtente.h
52 lines (31 loc) · 1.14 KB
/
Utente.h
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
//
// Created by Riccardo Becciolini on 19/02/23.
//
#ifndef PROJECTLAB_UTENTE_H
#define PROJECTLAB_UTENTE_H
#include "Observer.h"
#include "ListaSpesa.h"
#include <iostream>
#include <list>
#include <algorithm>
#include <memory>
class Utente : public Observer{
public:
explicit Utente(const std::string& n): name(n){};
void attach(Subject* list) override;
void detach(Subject* list) override;
void update(const std::string& s) override;
int add(std::shared_ptr<ListaSpesa> l, std::shared_ptr<Prodotto> p);
int remove(std::shared_ptr<ListaSpesa> l, std::shared_ptr<Prodotto> p);
int modify(std::shared_ptr<ListaSpesa> l, std::shared_ptr<Prodotto> p, int q);
int buy(std::shared_ptr<ListaSpesa> l, std::shared_ptr<Prodotto> p);
int displayList(std::shared_ptr<ListaSpesa> l);
const std::string &getName() const;
void setName(const std::string& name);
const std::list<Subject *> &getSubjects() const;
const std::list<std::shared_ptr<Prodotto>> &getProducts(std::shared_ptr<ListaSpesa> l) const;
private:
std::string name;
std::list<Subject*> subjects;
};
#endif //PROJECTLAB_UTENTE_H