narnaud
3 years ago
16 changed files with 208 additions and 57 deletions
@ -0,0 +1,16 @@ |
|||||
|
CXXFLAGS = -std=c++98 -Werror -Wextra -Wall |
||||
|
|
||||
|
brain: main.o |
||||
|
c++ main.o -o brain |
||||
|
|
||||
|
all: brain |
||||
|
|
||||
|
clean: |
||||
|
rm -rf main.o |
||||
|
|
||||
|
fclean: clean |
||||
|
rm -rf brain |
||||
|
|
||||
|
re: fclean all |
||||
|
|
||||
|
.PHONY: brain all clean fclean re |
@ -0,0 +1,16 @@ |
|||||
|
CXXFLAGS = -std=c++98 -Werror -Wextra -Wall |
||||
|
|
||||
|
replaceby: main.o |
||||
|
c++ main.o -o replaceby |
||||
|
|
||||
|
all: replaceby |
||||
|
|
||||
|
clean: |
||||
|
rm -rf main.o |
||||
|
|
||||
|
fclean: clean |
||||
|
rm -rf replaceby |
||||
|
|
||||
|
re: fclean all |
||||
|
|
||||
|
.PHONY: replaceby all clean fclean re |
@ -0,0 +1,56 @@ |
|||||
|
/* ************************************************************************** */ |
||||
|
/* */ |
||||
|
/* ::: :::::::: */ |
||||
|
/* Harl.cpp :+: :+: :+: */ |
||||
|
/* +:+ +:+ +:+ */ |
||||
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */ |
||||
|
/* +#+#+#+#+#+ +#+ */ |
||||
|
/* Created: 2022/06/17 11:14:29 by narnaud #+# #+# */ |
||||
|
/* Updated: 2022/07/18 13:00:18 by narnaud ### ########.fr */ |
||||
|
/* */ |
||||
|
/* ************************************************************************** */ |
||||
|
|
||||
|
#include "Harl.hpp" |
||||
|
|
||||
|
Harl::Harl (void) {} |
||||
|
|
||||
|
Harl::~Harl (void) {} |
||||
|
|
||||
|
void Harl::_debug(void) |
||||
|
{ |
||||
|
std::cout << "Debug : ..." << std::endl; |
||||
|
} |
||||
|
|
||||
|
void Harl::_info(void) |
||||
|
{ |
||||
|
std::cout << "Info: ..." << std::endl; |
||||
|
} |
||||
|
|
||||
|
void Harl::_warning(void) |
||||
|
{ |
||||
|
std::cout << "Warning: ..." << std::endl; |
||||
|
} |
||||
|
|
||||
|
void Harl::_error(void) |
||||
|
{ |
||||
|
std::cout << "Error: ..." << std::endl; |
||||
|
} |
||||
|
|
||||
|
void Harl::_complain(string level) { |
||||
|
|
||||
|
string ids = "DIWE"; |
||||
|
int i = 0; |
||||
|
while (ids[i] && ids[i] != level[0]) |
||||
|
i++; |
||||
|
switch (i) { |
||||
|
case 0: |
||||
|
this->_debug(); |
||||
|
case 1: |
||||
|
this->_info(); |
||||
|
case 2: |
||||
|
this->_warning(); |
||||
|
case 3: |
||||
|
this->_error(); |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,32 @@ |
|||||
|
/* ************************************************************************** */ |
||||
|
/* */ |
||||
|
/* ::: :::::::: */ |
||||
|
/* Harl.hpp :+: :+: :+: */ |
||||
|
/* +:+ +:+ +:+ */ |
||||
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */ |
||||
|
/* +#+#+#+#+#+ +#+ */ |
||||
|
/* Created: 2022/06/17 11:13:50 by narnaud #+# #+# */ |
||||
|
/* Updated: 2022/06/20 09:30:38 by narnaud ### ########.fr */ |
||||
|
/* */ |
||||
|
/* ************************************************************************** */ |
||||
|
|
||||
|
#pragma once |
||||
|
|
||||
|
#include <iostream> |
||||
|
using std::string; |
||||
|
|
||||
|
class Harl { |
||||
|
|
||||
|
public: |
||||
|
|
||||
|
Harl (void); |
||||
|
~Harl (void); |
||||
|
void _complain(string level); |
||||
|
|
||||
|
private: |
||||
|
void _debug(void); |
||||
|
void _info(void); |
||||
|
void _warning(void); |
||||
|
void _error(void); |
||||
|
|
||||
|
}; |
@ -0,0 +1,20 @@ |
|||||
|
NAME = harlFilter |
||||
|
SRCS = main.cpp Harl.cpp |
||||
|
OBJS = ${SRCS:.cpp=.o} |
||||
|
|
||||
|
CXXFLAGS = -std=c++98 -Werror -Wextra -Wall |
||||
|
|
||||
|
$(NAME): $(OBJS) |
||||
|
c++ $(OBJS) -o $(NAME) |
||||
|
|
||||
|
all: $(NAME) |
||||
|
|
||||
|
clean: |
||||
|
rm -rf $(OBJS) |
||||
|
|
||||
|
fclean: clean |
||||
|
rm -rf $(NAME) |
||||
|
|
||||
|
re: fclean all |
||||
|
|
||||
|
.PHONY: all clean fclean re |
@ -0,0 +1,20 @@ |
|||||
|
/* ************************************************************************** */ |
||||
|
/* */ |
||||
|
/* ::: :::::::: */ |
||||
|
/* main.cpp :+: :+: :+: */ |
||||
|
/* +:+ +:+ +:+ */ |
||||
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */ |
||||
|
/* +#+#+#+#+#+ +#+ */ |
||||
|
/* Created: 2022/06/17 11:37:33 by narnaud #+# #+# */ |
||||
|
/* Updated: 2022/07/18 12:59:24 by narnaud ### ########.fr */ |
||||
|
/* */ |
||||
|
/* ************************************************************************** */ |
||||
|
|
||||
|
#include "Harl.hpp" |
||||
|
|
||||
|
int main(int argc, char **argv) |
||||
|
{ |
||||
|
Harl bot; |
||||
|
if (argc == 2) |
||||
|
bot._complain(argv[1]); |
||||
|
} |
Loading…
Reference in new issue