mirror of
https://github.com/Ladebeze66/cpp-partie-1.git
synced 2025-12-16 05:58:04 +01:00
53 lines
1.9 KiB
C++
53 lines
1.9 KiB
C++
/* ************************************************************************** */
|
||
/* */
|
||
/* ::: :::::::: */
|
||
/* Harl.cpp :+: :+: :+: */
|
||
/* +:+ +:+ +:+ */
|
||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||
/* +#+#+#+#+#+ +#+ */
|
||
/* Created: 2023/12/27 15:12:29 by fgras-ca #+# #+# */
|
||
/* Updated: 2023/12/27 16:41:15 by fgras-ca ### ########.fr */
|
||
/* */
|
||
/* ************************************************************************** */
|
||
|
||
#include "Harl.hpp"
|
||
|
||
Harl::Harl() {}
|
||
|
||
void Harl::debug(void)
|
||
{
|
||
std::cout << "[DEBUG]\nI love having extra bacon for my 7XL-double-cheese-triple-pickle-specialketchup burger.\nI really do!" << std::endl;
|
||
}
|
||
|
||
void Harl::info(void)
|
||
{
|
||
std::cout << "[INFO]\nI cannot believe adding extra bacon costs more money. You didn’t put enough bacon in my burger!\nIf you did, I wouldn’t be asking for more!" << std::endl;
|
||
}
|
||
|
||
void Harl::warning(void)
|
||
{
|
||
std::cout << "[WARNING]\nI think I deserve to have some extra bacon for free.\nI’ve been coming for years whereas you started working here since last month." << std::endl;
|
||
}
|
||
|
||
void Harl::error(void)
|
||
{
|
||
std::cout << "[ERROR]\nThis is unacceptable! I want to speak to the manager now." << std::endl;
|
||
}
|
||
|
||
void Harl::complain(std::string level)
|
||
{
|
||
void (Harl::*complaints[])(void) = {&Harl::debug, &Harl::info, &Harl::warning, &Harl::error};
|
||
std::string levels[] = {"DEBUG", "INFO", "WARNING", "ERROR"};
|
||
|
||
for (int i = 0; i < 4; i++)
|
||
{
|
||
if (level == levels[i])
|
||
{
|
||
(this->*complaints[i])();
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
Harl::~Harl() {}
|