Refactor chat room implementation
- Renamed Room class to ChatRoom and updated all references accordingly. - Removed the old room.cpp and room.h files. - Updated CMakeLists.txt to include chat_room.cpp instead of room.cpp. - Modified ChatUser class to use shared_ptr<ChatRoom> instead of shared_ptr<Room>. - Updated Server class to create instances of ChatRoom instead of Room. - Removed User class and its associated files, integrating its functionality into ChatUser. - Ensured all relevant includes and dependencies are updated to reflect the new class structure.
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include "room.h"
|
||||
#include "chat_room.h"
|
||||
#include <iostream>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
@@ -15,7 +15,7 @@
|
||||
namespace Yc {
|
||||
namespace Lib {
|
||||
|
||||
ChatUser::ChatUser(std::shared_ptr<Room> parent, std::string name, std::string color, int socket) :
|
||||
ChatUser::ChatUser(std::shared_ptr<ChatRoom> parent, std::string name, std::string color, int socket) :
|
||||
_parent(std::move(parent)),
|
||||
_name(std::move(name)),
|
||||
_color(std::move(color)),
|
||||
@@ -96,7 +96,7 @@ std::string ChatUser::color() const {
|
||||
return _color;
|
||||
}
|
||||
|
||||
void ChatUser::setParent(std::shared_ptr<Room> parent) {
|
||||
void ChatUser::setParent(std::shared_ptr<ChatRoom> parent) {
|
||||
_parent = std::move(parent);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user