You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

66 lines
1.8 KiB

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Harl.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/17 11:14:29 by narnaud #+# #+# */
/* Updated: 2022/06/17 13:29:12 by narnaud ### ########.fr */
/* */
/* ************************************************************************** */
#include "Harl.hpp"
Harl::Harl (void) {
std::cout << "Harl default constructor called " << std::endl;
}
Harl::Harl (Harl const & src) {
std::cout << "Harl copy constructor called" << std::endl;
}
Harl & Harl::operator= (Harl const & src) {
std::cout << "Harl assignment operator called" << std::endl;
return (*this);
}
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::*fcts[])(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])
(Harl::*fcts[i])();
}