48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
#include "Harl.hpp"
|
||
#include <iostream>
|
||
#include <string>
|
||
|
||
void Harl::complain(std::string level)
|
||
{
|
||
static const HarlMethod methods[4] = {
|
||
&Harl::debug,
|
||
&Harl::info,
|
||
&Harl::warning,
|
||
&Harl::error,
|
||
};
|
||
static const std::string strings[4] = {
|
||
"DEBUG",
|
||
"INFO",
|
||
"WARNING",
|
||
"ERROR"
|
||
};
|
||
for (size_t i = 0; i < 4; i++)
|
||
{
|
||
if (strings[i] == level)
|
||
{
|
||
(this->*methods[i])();
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
void Harl::debug() const
|
||
{
|
||
std::cout << "I love having extra bacon for my 7XL-double-cheese-triple-pickle-special-ketchup burger. I really do !" << std::endl;
|
||
}
|
||
|
||
void Harl::info() const
|
||
{
|
||
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() const
|
||
{
|
||
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() const
|
||
{
|
||
std::cout << "This is unacceptable ! I want to speak to the manager now." << std::endl;
|
||
}
|