43 lines
1.9 KiB
C++
43 lines
1.9 KiB
C++
|
/* ************************************************************************** */
|
|||
|
/* */
|
|||
|
/* ::: :::::::: */
|
|||
|
/* harl.cpp :+: :+: :+: */
|
|||
|
/* +:+ +:+ +:+ */
|
|||
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
|||
|
/* +#+#+#+#+#+ +#+ */
|
|||
|
/* Created: 2024/11/09 17:15:01 by adjoly #+# #+# */
|
|||
|
/* Updated: 2024/11/09 17:39:12 by adjoly ### ########.fr */
|
|||
|
/* */
|
|||
|
/* ************************************************************************** */
|
|||
|
|
|||
|
#include "harl.hpp"
|
|||
|
#include <iostream>
|
|||
|
|
|||
|
void Harl::complain(std::string level) {
|
|||
|
std::string complainLevel[4] = {"DEBUG", "INFO", "WARNING", "ERROR"};
|
|||
|
void (Harl::*func[4])(void) = {&Harl::debug, &Harl::info, &Harl::warning, &Harl::error};
|
|||
|
uint8_t i = 0;
|
|||
|
|
|||
|
while (i < 4 && level != complainLevel[i])
|
|||
|
i++;
|
|||
|
if (i < 4)
|
|||
|
(this->*func[i])();
|
|||
|
return ;
|
|||
|
}
|
|||
|
|
|||
|
void Harl::debug(void) {
|
|||
|
std::cout << "I love having extra bacon for my 7XL-double-cheese-triple-pickle-specialketchup burger. I really do!" << 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!" << 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." << std::endl;
|
|||
|
}
|
|||
|
|
|||
|
void Harl::error(void) {
|
|||
|
std::cout << "This is unacceptable! I want to speak to the manager now." << std::endl;
|
|||
|
}
|