Harl.cpp
 1  /* ************************************************************************** */
 2  /*                                                                            */
 3  /*                                                        :::      ::::::::   */
 4  /*   Harl.cpp                                           :+:      :+:    :+:   */
 5  /*                                                    +:+ +:+         +:+     */
 6  /*   By: gychoi <gychoi@student.42seoul.kr>         +#+  +:+       +#+        */
 7  /*                                                +#+#+#+#+#+   +#+           */
 8  /*   Created: 2023/07/28 01:14:21 by gychoi            #+#    #+#             */
 9  /*   Updated: 2023/07/28 17:04:41 by gychoi           ###   ########.fr       */
10  /*                                                                            */
11  /* ************************************************************************** */
12  
13  #include "Harl.hpp"
14  
15  void	Harl::debug(void)
16  {
17  	std::cout << "[ DEBUG ]" << std::endl;
18  	std::cout << "I love having extra bacon for my 7XL-double-cheese-triple-pickle-special-ketchup burger." << std::endl;
19  	std::cout << "I really do!" << '\n' <<std::endl;
20  }
21  
22  void	Harl::info(void)
23  {
24  	std::cout << "[ INFO ]" << std::endl;
25  	std::cout << "I cannot believe adding extra bacon costs more money." << std::endl;
26  	std::cout << "You didn’t put enough bacon in my burger! If you did, I wouldn’t be asking for more!" << '\n' << std::endl;
27  }
28  
29  void	Harl::warning(void)
30  {
31  	std::cout << "[ WARNING ]" << std::endl;
32  	std::cout << "I think I deserve to have some extra bacon for free." << std::endl;
33  	std::cout << "I’ve been coming for years whereas you started working here since last month." << '\n' << std::endl;
34  }
35  
36  void	Harl::error(void)
37  {
38  	std::cout << "[ ERROR ]" << std::endl;
39  	std::cout << "This is unacceptable! I want to speak to the manager now." << '\n' <<  std::endl;
40  }
41  
42  void	Harl::complain(std::string level)
43  {
44  	std::string	levels[LEVEL_SIZE] = {"DEBUG", "INFO", "WARNING", "ERROR"};
45  	std::size_t	i;
46  
47  	for (i = 0; i < LEVEL_SIZE; i++)
48  		if (levels[i] == level)
49  			break;
50  	switch (i)
51  	{
52  		case DEBUG:
53  			debug();
54  		case INFO:
55  			info();
56  		case WARNING:
57  			warning();
58  		case ERROR:
59  			error();
60  			break;
61  		default:
62  			std::cout << "[ Probably complaining about insignificant problems ]" << std::endl;
63  	}
64  }