cpp01/ex06/Harl.cpp

77 lines
2.2 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Harl.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lfirmin <lfirmin@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/02 10:04:24 by lfirmin #+# #+# */
/* Updated: 2025/07/02 10:25:30 by lfirmin ### ########.fr */
/* */
/* ************************************************************************** */
#include "Harl.hpp"
Harl::Harl()
{
}
Harl::~Harl()
{
}
void Harl::_debug(void)
{
std::cout << "I love having extra bacon for my 7XL-double-cheese-triple-pickle-specialketchup burger. I really do!\n" << std::endl;
}
void Harl::_info(void)
{
std::cout << "I cannot believe adding extra bacon costs more money. You didn't put enough bacon in my burger! If you did, I wouldn't be asking for more!\n" << std::endl;
}
void Harl::_warning(void)
{
std::cout << "I think I deserve to have some extra bacon for free. I've been coming for years whereas you started working here since last month.\n" << std::endl;
}
void Harl::_error(void)
{
std::cout << "This is unacceptable! I want to speak to the manager now.\n" << std::endl;
}
void Harl::complain(std::string level)
{
int i;
std::string levels[4] = {"DEBUG", "INFO", "WARNING", "ERROR"};
i = 0;
if (!level.compare(levels[0]) || i == 1)
{
std::cout << "[ DEBUG ]" << std::endl;
Harl::_debug();
i = 1;
}
if (!level.compare(levels[1]) || i == 1)
{
std::cout << "[ INFO ]" << std::endl;
Harl::_info();
i = 1;
}
if (!level.compare(levels[2]) || i == 1)
{
std::cout << "[ WARNING ]" << std::endl;
Harl::_warning();
i = 1;
}
if (!level.compare(levels[3]) || i == 1)
{
std::cout << "[ ERROR ]" << std::endl;
Harl::_error();
i = 1;
}
else
{
std::cout << "No Valid Level.\n";
return ;
}
}