| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* harl.class.cpp :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: bchanot <bchanot@gmail.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2025/07/15 19:49:59 by bchanot #+# #+# */
- /* Updated: 2025/07/16 13:29:14 by bchanot ### ########.fr */
- /* */
- /* ************************************************************************** */
- #include "harl.class.hpp"
- void Harl::debug(void) {
- std::cout << "[DEBUG] I love having extra bacon for my 7XL-double-cheese-triple-pickle-special-ketchup burger. I really do!" << std::endl;
- }
- void Harl::info(void) {
- std::cout << "[INFO] 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 << "[WARNING] I think I deserve to have some extra bacon for free. I’ve been coming for years, whereas you started working here just last month." << std::endl;
- }
- void Harl::error(void) {
- std::cout << "[ERROR] This is unacceptable! I want to speak to the manager now." << std::endl;
- }
- void Harl::complain(std::string level) {
- void (Harl::*fn[])(void) = {&Harl::debug, &Harl::info, &Harl::warning, &Harl::error};
- std::string complain[] = {"DEBUG", "INFO", "WARNING", "ERROR"};
- int i;
- bool print = false;
- i = 0;
- while (i < 4) {
- if (complain[i].compare(level) == 0 || print) {
- print = true;
- (this->*fn[i])();
- }
- i++;
- }
- }
|