/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Harl.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: narnaud +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/06/17 11:14:29 by narnaud #+# #+# */ /* Updated: 2022/06/20 09:30:23 by narnaud ### ########.fr */ /* */ /* ************************************************************************** */ #include "Harl.hpp" Harl::Harl (void) { std::cout << "Harl default constructor called " << std::endl; } Harl::~Harl (void) { std::cout << "Harl default destructor called" << std::endl; } void Harl::_debug(void) { std::cout << "Debug : ..." << std::endl; } void Harl::_info(void) { std::cout << "Info: ..." << std::endl; } void Harl::_warning(void) { std::cout << "Warning: ..." << std::endl; } void Harl::_error(void) { std::cout << "Error: ..." << std::endl; } void Harl::_complain(string level) { void (Harl::*fct[4])(void) = { &Harl::_debug, &Harl::_info, &Harl::_warning, &Harl::_error}; string ids = "DIWE"; int i = 0; while (ids[i] && ids[i] != level[0]) i++; if (ids[i]) (this->*fct[i])(); }