-
Notifications
You must be signed in to change notification settings - Fork 0
/
Harl.cpp
54 lines (46 loc) · 2.12 KB
/
Harl.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Harl.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zelhajou <zelhajou@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/07 14:41:39 by zelhajou #+# #+# */
/* Updated: 2024/06/07 14:48:15 by zelhajou ### ########.fr */
/* */
/* ************************************************************************** */
#include "Harl.hpp"
Harl::Harl() {}
void Harl::debug()
{
std::cout << "[ DEBUG ]" << std::endl;
std::cout << "I love having extra bacon for my "
"7XL-double-cheese-triple-pickle-specialketchup burger."
"I really do!" << std::endl;
}
void Harl::info()
{
std::cout << "[ INFO ]" << std::endl;
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() {
std::cout << "[ WARNING ]" << std::endl;
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() {
std::cout << "[ ERROR ]" << std::endl;
std::cout << "This is unacceptable! I want to speak to the manager now." << std::endl;
}
void Harl::complain(std::string level) {
void (Harl::*complaintLevels[4])() = {&Harl::debug, &Harl::info, &Harl::warning, &Harl::error};
std::string levels[4] = {"DEBUG", "INFO", "WARNING", "ERROR"};
for (int i = 0; i < 4; i++) {
if (level == levels[i]) {
(this->*complaintLevels[i])();
break;
}
}
}