Update CMake configuration and refactor code to use smart pointers for memory management
This commit is contained in:
10
server.h
10
server.h
@@ -10,20 +10,20 @@
|
||||
namespace Yc {
|
||||
namespace Lib {
|
||||
|
||||
class Server: public Base
|
||||
class Server: public Base, public std::enable_shared_from_this<Server>
|
||||
{
|
||||
public:
|
||||
Server(Yc::Lib::Config *config);
|
||||
Server(std::shared_ptr<Yc::Lib::Config> config);
|
||||
void run();
|
||||
std::vector<std::string> roomList();
|
||||
Json::Value jsonRoomList();
|
||||
bool roomAllowed(std::string roomName, std::string userName, std::string password);
|
||||
bool changeRoom(User *user, std::string newRoom, std::string password);
|
||||
bool changeRoom(std::shared_ptr<User> user, std::string newRoom, std::string password);
|
||||
private:
|
||||
int _socket;
|
||||
Yc::Lib::Config *_config;
|
||||
std::shared_ptr<Yc::Lib::Config> _config;
|
||||
bool _stop;
|
||||
std::vector<Yc::Lib::Room*> _rooms;
|
||||
std::vector<std::shared_ptr<Yc::Lib::Room>> _rooms;
|
||||
void createRooms(Json::Value roomList);
|
||||
void handleRequest();
|
||||
void inputSwitcher(int userSocket, std::string input);
|
||||
|
||||
Reference in New Issue
Block a user