harlfilter not all done

This commit is contained in:
kinou-p 2022-07-22 09:55:09 +02:00
parent 1634211177
commit 2e27e82baa
2 changed files with 13 additions and 7 deletions

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/21 23:39:20 by apommier #+# #+# */
/* Updated: 2022/07/22 09:40:02 by apommier ### ########.fr */
/* Updated: 2022/07/22 09:52:45 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -34,16 +34,17 @@ void Harl::complain(std::string level)
}
}
int Harl::ChooseComplain(std::string level)
int Harl::chooseComplain(std::string level)
{
void (Harl::*complaint[])(void) = {&Harl::debug, &Harl::info, &Harl::warning, &Harl::error};
//void (Harl::*complaint[])(void) = {&Harl::debug, &Harl::info, &Harl::warning, &Harl::error};
std::string levelTab[4] = {"DEBUG", "INFO", "WARNING", "ERROR"};
for (int i = 0; i < 4 ; i++)
{
void (Harl::*selectedComplaint)( void ) = complaint[i];
//void (Harl::*selectedComplaint)( void ) = complaint[i];
if (level == levelTab[i])
return (i);
}
return (4);
}

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/21 23:40:41 by apommier #+# #+# */
/* Updated: 2022/07/22 09:44:33 by apommier ### ########.fr */
/* Updated: 2022/07/22 09:54:21 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -24,15 +24,20 @@ void harFilter(Harl harl, std::string level)
harl.complain("INFO");
harl.complain("WARNING");
harl.complain("ERROR");
break;
case 2 :
harl.complain("INFO");
harl.complain("WARNING");
harl.complain("ERROR");
break;
case 3 :
harl.complain("WARNING");
harl.complain("ERROR");
break;
case 4 :
harl.complain("ERROR");
break;
default :
std::cout << "[ Probably complaining about insignificant problems ]\n";
}
@ -42,7 +47,7 @@ int main(int ac, char **av)
{
Harl harl;
std::cout << ac << std::endl;
//std::cout << ac << std::endl;
if (ac != 2)
{
std::cerr << "Bad entry\n";