Files
ft_irc/Channel/Channel.cpp
2026-05-15 22:07:05 +02:00

63 lines
2.3 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Channel.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aortigos <aortigos@student.42malaga.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/05/08 16:41:40 by aortigos #+# #+# */
/* Updated: 2026/05/08 16:41:40 by aortigos ### ########.fr */
/* */
/* ************************************************************************** */
#include "Channel.hpp"
//////////////////
// Constructors //
//////////////////
Channel::Channel() { /* std::cout << "Channel default constructor called" << std::endl; */}
Channel::~Channel() { /* std::cout << "Channel destructor called" << std::endl; */}
Channel::Channel(const Channel &other)
{
*this = other;
// std::cout << "Channel copy constructor called" << std::endl;
}
Channel& Channel::operator=(const Channel &other)
{
if (this != &other)
{
name_ = other.name_;
members_ = other.members_;
operators_ = other.operators_;
}
// std::cout << "Channel copy assignment operator called" << std::endl;
return (*this);
}
// Constructor with name
Channel::Channel(std::string &name) : name_(name) { /* std::cout << "Channel with name constructor called" << std::endl; */ }
// Getters
std::string Channel::getName() const { return (this->name_); }
// Members
void Channel::addMember(int fd) { this->members_.insert(fd); }
void Channel::removeMember(int fd) { this->members_.erase(fd); }
bool Channel::hasMember(int fd) const { return (this->members_.count(fd) > 0); }
// Operators
void Channel::addOperator(int fd) { this->operators_.insert(fd); }
void Channel::removeOperator(int fd) { this->operators_.erase(fd); }
bool Channel::hasOperator(int fd) const { return (this->operators_.count(fd) > 0); }
void Channel::broadcast()
{
return ;
}