update: finishing for good the ex05 of the module 01

This commit is contained in:
Raphael 2024-11-06 18:16:09 +01:00
parent 4e8dc67e65
commit 618ebf8777
4 changed files with 220 additions and 0 deletions

47
cpp01/ex05/Harl.cpp Normal file
View file

@ -0,0 +1,47 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Harl.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/06 17:41:03 by rparodi #+# #+# */
/* Updated: 2024/11/06 18:11:34 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#include "Harl.hpp"
Harl::Harl(){}
Harl::~Harl(){}
void Harl::debug()
{
std::cout << DEBUG_MSG << std::endl;
}
void Harl::error()
{
std::cout << ERROR_MSG << std::endl;
}
void Harl::info()
{
std::cout << INFO_MSG << std::endl;
}
void Harl::warning()
{
std::cout << WARN_MSG << std::endl;
}
void Harl::complain(std::string level)
{
std::string categorie[] = {"debug", "error", "info", "warning"};
void (Harl::*choice[4])(void) = { &Harl::debug, &Harl::error, &Harl::info, &Harl::warning };
for (size_t i = 0; i < 4; i++)
if (level == categorie[i])
(this->*choice[i])();
}