/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Harl.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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() {}