From 636365d65c672763149763e1c76414dcb7ffe662 Mon Sep 17 00:00:00 2001 From: starnakin Date: Tue, 18 Jul 2023 03:16:37 +0200 Subject: [PATCH] d --- ex05/Makefile | 25 ------------------------- ex05/src/Harl.cpp | 47 ----------------------------------------------- ex05/src/Harl.hpp | 16 ---------------- ex05/src/main.cpp | 19 ------------------- ex06/Makefile | 25 ------------------------- ex06/src/Harl.cpp | 47 ----------------------------------------------- ex06/src/Harl.hpp | 16 ---------------- ex06/src/main.cpp | 28 ---------------------------- 8 files changed, 223 deletions(-) delete mode 100644 ex05/Makefile delete mode 100644 ex05/src/Harl.cpp delete mode 100644 ex05/src/Harl.hpp delete mode 100644 ex05/src/main.cpp delete mode 100644 ex06/Makefile delete mode 100644 ex06/src/Harl.cpp delete mode 100644 ex06/src/Harl.hpp delete mode 100644 ex06/src/main.cpp diff --git a/ex05/Makefile b/ex05/Makefile deleted file mode 100644 index 19aa947..0000000 --- a/ex05/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -CXX = c++ -CXXFLAGS = -std=c++98 -Wall -Wextra -Werror -g -O0 -SRCDIR = src -OBJDIR = obj -BINDIR = bin -EXECUTABLE = harl - -SRCS = $(wildcard $(SRCDIR)/*.cpp) -OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS)) - -all: $(BINDIR)/$(EXECUTABLE) - -$(OBJDIR)/%.o: $(SRCDIR)/%.cpp - $(CXX) $(CXXFLAGS) -c $< -o $@ - -$(BINDIR)/$(EXECUTABLE): $(OBJS) - $(CXX) $(CXXFLAGS) $^ -o $@ - -clean: - rm -rf $(OBJDIR)/*.o - -fclean: clean - rm -fr $(BINDIR)/$(EXECUTABLE) - -re: fclean all diff --git a/ex05/src/Harl.cpp b/ex05/src/Harl.cpp deleted file mode 100644 index 934f1df..0000000 --- a/ex05/src/Harl.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "Harl.hpp" -#include -#include - -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; -} diff --git a/ex05/src/Harl.hpp b/ex05/src/Harl.hpp deleted file mode 100644 index f3f4371..0000000 --- a/ex05/src/Harl.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once -#include - -class Harl -{ - private: - void debug() const; - void info() const; - void warning() const; - void error() const; - - public: - void complain(std::string level); -}; - -typedef void (Harl::*HarlMethod)() const; diff --git a/ex05/src/main.cpp b/ex05/src/main.cpp deleted file mode 100644 index ac7f980..0000000 --- a/ex05/src/main.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "Harl.hpp" - -int main() -{ - Harl harl; - static const std::string levels[] = { - "DEBUG", - "INFO", - "WARNING", - "GOLEM", - "ERROR", - "PASLU", - "FLEMME", - "PANIC" - }; - for (int i = 0; i < 6; i++) - harl.complain(levels[i]); - return 0; -} diff --git a/ex06/Makefile b/ex06/Makefile deleted file mode 100644 index 19aa947..0000000 --- a/ex06/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -CXX = c++ -CXXFLAGS = -std=c++98 -Wall -Wextra -Werror -g -O0 -SRCDIR = src -OBJDIR = obj -BINDIR = bin -EXECUTABLE = harl - -SRCS = $(wildcard $(SRCDIR)/*.cpp) -OBJS = $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS)) - -all: $(BINDIR)/$(EXECUTABLE) - -$(OBJDIR)/%.o: $(SRCDIR)/%.cpp - $(CXX) $(CXXFLAGS) -c $< -o $@ - -$(BINDIR)/$(EXECUTABLE): $(OBJS) - $(CXX) $(CXXFLAGS) $^ -o $@ - -clean: - rm -rf $(OBJDIR)/*.o - -fclean: clean - rm -fr $(BINDIR)/$(EXECUTABLE) - -re: fclean all diff --git a/ex06/src/Harl.cpp b/ex06/src/Harl.cpp deleted file mode 100644 index 934f1df..0000000 --- a/ex06/src/Harl.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "Harl.hpp" -#include -#include - -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; -} diff --git a/ex06/src/Harl.hpp b/ex06/src/Harl.hpp deleted file mode 100644 index f3f4371..0000000 --- a/ex06/src/Harl.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once -#include - -class Harl -{ - private: - void debug() const; - void info() const; - void warning() const; - void error() const; - - public: - void complain(std::string level); -}; - -typedef void (Harl::*HarlMethod)() const; diff --git a/ex06/src/main.cpp b/ex06/src/main.cpp deleted file mode 100644 index ba796ab..0000000 --- a/ex06/src/main.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "Harl.hpp" -#include - -int main(int ac, char **av) -{ - Harl harl; - static const std::string levels[] = { - "DEBUG", - "INFO", - "WARNING", - "GOLEM", - "ERROR", - "PASLU", - "FLEMME", - "PANIC" - }; - for (int i = 0; i < 7; i++) - { - if (ac > 1 && levels[i] != av[1]) - harl.complain(levels[i]); - else - { - std::cerr << "ERROR" << std::endl; - return (1); - } - } - return (0); -}