diff --git a/cpp05/ex00/Bureaucrat.cpp b/cpp05/ex00/Bureaucrat.cpp new file mode 100644 index 0000000..507576f --- /dev/null +++ b/cpp05/ex00/Bureaucrat.cpp @@ -0,0 +1,15 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* Bureaucrat.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/03/16 14:49:52 by rparodi #+# #+# */ +/* Updated: 2025/03/16 14:51:22 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "Bureaucrat.hpp" + + diff --git a/cpp05/ex00/Bureaucrat.hpp b/cpp05/ex00/Bureaucrat.hpp new file mode 100644 index 0000000..bbb330e --- /dev/null +++ b/cpp05/ex00/Bureaucrat.hpp @@ -0,0 +1,28 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* Bureaucrat.hpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/03/16 14:48:33 by rparodi #+# #+# */ +/* Updated: 2025/03/16 14:52:32 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#pragma once + +#include + +class Bureaucrat { + public: + Bureaucrat(void); + Bureaucrat(Bureaucrat const ©); + Bureaucrat& operator=(Bureaucrat const &assign); + ~Bureaucrat(void); + std::string getName(void) const; + int getGrade(void) const; + private: + std::string const _name; + int _grade; +}; diff --git a/cpp05/ex00/Makefile b/cpp05/ex00/Makefile new file mode 100644 index 0000000..c4e5521 --- /dev/null +++ b/cpp05/ex00/Makefile @@ -0,0 +1,122 @@ +# **************************************************************************** # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: rparodi +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2023/11/12 11:05:05 by rparodi #+# #+# # +# Updated: 2024/12/21 19:50:58 by rparodi ### ########.fr # +# # +# **************************************************************************** # + +# Variables + +# Name +NAME = polymorphism + +# Commands +CXX = c++ +RM = rm -rf + +# Flags +# Mandatory flags for 42 +CXXFLAGS = -Werror -Wextra -Wall -std=c++98 -I./includes/ +# Flags to debug and have the dependences (can be removed for correction) +CXXFLAGS += -MMD -g3 + +# Sources +SRC = Bureaucrat.cpp \ + main.cpp + +# Objects +OBJDIRNAME = ./build +OBJ = $(addprefix $(OBJDIRNAME)/,$(SRC:.cpp=.o)) + +# Colors +GREEN = \033[32m +GREY = \033[0;90m +RED = \033[0;31m +GOLD = \033[38;5;220m +END = \033[0m + +# Rules + +# All (make all) +all: header $(NAME) footer + +# Bonus (make bonus) +bonus: header $(OBJ) footer + @mkdir -p $(OBJDIRNAME) + @printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n' + @$(CXX) $(CXXFLAGS) -o $(NAME) $(OBJ) + +# Clean (make clean) +clean: + @printf '$(GREY) Removing $(END)$(RED)Objects$(END)\n' + @printf '$(GREY) Removing $(END)$(RED)Objects Folder$(END)\n' + @$(RM) $(OBJDIRNAME) + +# Clean (make fclean) +fclean: clean + @printf '$(GREY) Removing $(END)$(RED)Program$(END)\n' + @$(RM) $(NAME) + @echo "" + +# Restart (make re) +re: header fclean all + +# Dependences for all +$(NAME): $(OBJ) + @mkdir -p $(OBJDIRNAME) + @printf '$(GREY) Creating $(END)$(GREEN)$(OBJDIRNAME)$(END)\n' + @$(CXX) $(CXXFLAGS) -o $(NAME) $(OBJ) + +# Creating the objects +$(OBJDIRNAME)/%.o: %.cpp + @mkdir -p $(dir $@) + @printf '$(GREY) Compiling $(END)$(GREEN)$<$(END)\n' + @$(CXX) $(CXXFLAGS) -o $@ -c $< + +# Header +header: + @clear + @printf '\n\n' + @printf '$(GOLD) ******* ****** ******* $(END)\n' + @printf '$(GOLD) ****** *** ******* $(END)\n' + @printf '$(GOLD) ******* * ******* $(END)\n' + @printf '$(GOLD) ****** ******* $(END)\n' + @printf '$(GOLD) ******* ******* $(END)\n' + @printf '$(GOLD) ******************* ******* * $(END)\n' + @printf '$(GOLD) ******************* ******* *** $(END)\n' + @printf '$(GOLD) ****** ******* ****** $(END)\n' + @printf '$(GOLD) ****** $(END)\n' + @printf '$(GOLD) ****** $(END)\n' + @printf '$(GREY) Made by rparodi$(END)\n\n' + +# Footer +footer: + @printf "\n" + @printf "$(GOLD) ,_ _,$(END)\n" + @printf "$(GOLD) | \\___//|$(END)\n" + @printf "$(GOLD) |=6 6=|$(END)\n" + @printf "$(GOLD) \\=._Y_.=/$(END)\n" + @printf "$(GOLD) ) \` ( ,$(END)\n" + @printf "$(GOLD) / \\ (('$(END)\n" + @printf "$(GOLD) | | ))$(END)\n" + @printf "$(GOLD) /| | | |\\_//$(END)\n" + @printf "$(GOLD) \\| |._.| |/-\`$(END)\n" + @printf "$(GOLD) '\"' '\"'$(END)\n" + @printf ' $(GREY)The compilation is$(END) $(GOLD)finish$(END)\n $(GREY)Have a good $(END)$(GOLD)correction !$(END)\n' + +clangd: + @echo \ + "CompileFlags:\n" \ + " Add:\n" \ + " - \"-std=c++98 -Wall -Wextra -Werror\"\n" \ + " - \"-I"$(shell pwd)"/includes\"\n" \ + " - \"-xc++\"\n" \ + > .clangd + +# Phony +.PHONY: all bonus clean fclean re clangd +-include ${OBJ:.o=.d} diff --git a/cpp05/ex00/main.cpp b/cpp05/ex00/main.cpp new file mode 100644 index 0000000..0f0c436 --- /dev/null +++ b/cpp05/ex00/main.cpp @@ -0,0 +1,17 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rparodi +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2025/03/16 14:47:26 by rparodi #+# #+# */ +/* Updated: 2025/03/16 14:48:29 by rparodi ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "Bureaucrat.hpp" + +int main(void) { + +}