feat(server): starting the server class

This commit is contained in:
Raphael 2025-05-13 11:23:28 +02:00
parent b3087814e9
commit 874a6473e4
2 changed files with 67 additions and 0 deletions

42
sources/core/server.cpp Normal file
View file

@ -0,0 +1,42 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* server.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/13 11:11:07 by rparodi #+# #+# */
/* Updated: 2025/05/13 11:19:18 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "core.hpp"
#include <iostream>
/**
* @brief The default constructor of the Server class.
*/
Server::Server() : _port(0), _password("") {
if (DEBUG)
std::cerr << CLR_MAGENTA << "[DEBUG] Thanks to use the constructor with port and password !" << std::endl;
std::cout << CLR_GREY << "[INFO] Server default constructor called" << CLR_RESET << std::endl;
}
/**
* @brief The constructor of the Server class.
*
* @param port The port given by the user (argv[1])
* @param password The password given by the user (argv[2])
*
* @note Thanks to check the port / password before give them to the constructor.
*/
Server::Server(int port, const std::string &password) : _port(port), _password(password) {
std::cout << CLR_GREY << "[INFO] Server constructor called" << CLR_RESET << std::endl;
}
/**
* @brief The default destructor of the Server class.
*/
Server::~Server() {
std::cout << CLR_GREY << "[INFO] Server destructor called" << CLR_RESET << std::endl;
}