-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChat.h
55 lines (35 loc) · 1.13 KB
/
Chat.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
53
54
55
//
// Created by Christian Di buó on 04/02/22.
//
#ifndef CHAT_LABORATORIO_CHAT_H
#define CHAT_LABORATORIO_CHAT_H
#include <iostream>
#include <vector>
#include <list>
#include "User.h"
#include "Message.h"
#include "Subject.h"
class User;
class Chat :public Subject{
public:
explicit Chat (const User &firstUser,const User &secondUser);
virtual ~Chat();
void addNewMessage(const Message& newmessage);
const std::string& readMessage(int i);
void setFirstuserName(const std::string &firstuserName);
void setSeconduserName(const std::string &seconduserName);
const std::string& getFirstuserName() const;
const std::string& getSeconduserName() const;
const Message& lastMessage() const;
void registration(std::shared_ptr<Observer> o) override;
void remove(std::shared_ptr<Observer> o) override;
void notify() override;
int getnumberReadMessage() const;
int getnumberUnreadMessage() const;
private:
std::string firstuserName;
std::string seconduserName;
std::vector<Message> messages;
std::list<std::shared_ptr<Observer>> observers;
};
#endif //CHAT_LABORATORIO_CHAT_H