diff --git a/cpp05/ex01/Form.cpp b/cpp05/ex01/Form.cpp index 7b143df..d0aa021 100644 --- a/cpp05/ex01/Form.cpp +++ b/cpp05/ex01/Form.cpp @@ -6,13 +6,18 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/11 14:39:51 by fgras-ca #+# #+# */ -/* Updated: 2024/02/22 12:48:40 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 14:47:49 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ #include "Bureaucrat.hpp" #include "Form.hpp" +Form::Form() : name("default"), isSigned(false), gradeRequiredToSign(150), gradeRequiredToExecute(150) +{ + std::cout << GREEN << "Form default constructor called!" << RESET << std::endl; +} + Form::Form(const std::string &name, int gradeRequiredToSign, int gradeRequiredToExecute) : name(name), isSigned(false), gradeRequiredToSign(gradeRequiredToSign), gradeRequiredToExecute(gradeRequiredToExecute) { @@ -24,6 +29,7 @@ Form::Form(const std::string &name, int gradeRequiredToSign, int gradeRequiredTo { throw GradeTooLowException(); } + std::cout << GREEN << "Form" << this->name << "constructor called with grade to sign: " << this->gradeRequiredToSign << " and grade to execute: " << this->gradeRequiredToExecute << RESET << std::endl; } Form::Form(const Form& other) diff --git a/cpp05/ex01/Form.hpp b/cpp05/ex01/Form.hpp index 4f35505..aacfb56 100644 --- a/cpp05/ex01/Form.hpp +++ b/cpp05/ex01/Form.hpp @@ -6,38 +6,37 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/11 14:37:14 by fgras-ca #+# #+# */ -/* Updated: 2024/02/26 15:57:56 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 15:07:38 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef FORM_HPP #define FORM_HPP -#include "Bureaucrat.hpp" // Assurez-vous que cette classe est bien définie +#include "Bureaucrat.hpp" #include #include class Bureaucrat; -class AForm +class Form { private: const std::string name; - const bool isSigned; const int gradeRequiredToSign; const int gradeRequiredToExecute; public: //constructueur - AForm(const::std::string& name); - AForm(const std::string &name, int gradeRequiredToSign, int gradeRequiredToExecute); + Form(); + Form(const std::string &name, int gradeRequiredToSign, int gradeRequiredToExecute); // Constructeur par copie - AForm(const AForm& other); + Form(const Form& other); // Opérateur d'affectation - AForm& operator=(const AForm& other); + Form& operator=(const Form& other); // Destructeur - ~AForm(); + ~Form(); std::string getName() const; @@ -50,23 +49,17 @@ public: class GradeTooHighException : public std::exception { public: - const char* what() const noexcept override - { - return ("Grade too high"); - } + const char* what() const throw(); }; class GradeTooLowException : public std::exception { public: - const char* what() const noexcept override - { - return ("Grade too low"); - } + const char* what() const throw(); }; }; // Surcharge de l'opérateur d'insertion -std::ostream& operator<<(std::ostream& os, const AForm& form); +std::ostream& operator<<(std::ostream& os, const Form& form); #endif diff --git a/cpp05/ex02/AForm.cpp b/cpp05/ex02/AForm.cpp index 8575f4b..c16e8f4 100644 --- a/cpp05/ex02/AForm.cpp +++ b/cpp05/ex02/AForm.cpp @@ -6,13 +6,18 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/11 14:39:51 by fgras-ca #+# #+# */ -/* Updated: 2024/03/02 20:36:08 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 14:52:36 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ #include "Bureaucrat.hpp" #include "AForm.hpp" +AForm::AForm() : name("default"), isSigned(false), gradeRequiredToSign(150), gradeRequiredToExecute(150) +{ + std::cout << GREEN << "AForm default constructor called!" << RESET << std::endl; +} + AForm::AForm(const std::string &name, int gradeRequiredToSign, int gradeRequiredToExecute) : name(name), isSigned(false), gradeRequiredToSign(gradeRequiredToSign), gradeRequiredToExecute(gradeRequiredToExecute) { @@ -24,6 +29,7 @@ AForm::AForm(const std::string &name, int gradeRequiredToSign, int gradeRequired { throw GradeTooLowException(); } + std::cout << GREEN << "AForm" << this->name << "constructor called with grade to sign: " << this->gradeRequiredToSign << " and grade to execute: " << this->gradeRequiredToExecute << RESET << std::endl; } AForm::AForm(const AForm& other) diff --git a/cpp05/ex02/AForm.hpp b/cpp05/ex02/AForm.hpp index a66f1b4..54a7907 100644 --- a/cpp05/ex02/AForm.hpp +++ b/cpp05/ex02/AForm.hpp @@ -6,14 +6,14 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/11 14:37:14 by fgras-ca #+# #+# */ -/* Updated: 2024/02/22 13:49:48 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 15:07:31 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef AFORM_HPP #define AFORM_HPP -#include "Bureaucrat.hpp" // Assurez-vous que cette classe est bien définie +#include "Bureaucrat.hpp" #include #include @@ -32,6 +32,7 @@ protected: public: //constructueur + AForm(); AForm(const std::string &name, int gradeRequiredToSign, int gradeRequiredToExecute); // Constructeur par copie AForm(const AForm& other); diff --git a/cpp05/ex02/Home_shrubbery b/cpp05/ex02/Home_shrubbery deleted file mode 100644 index 52c21bb..0000000 --- a/cpp05/ex02/Home_shrubbery +++ /dev/null @@ -1,16 +0,0 @@ - . 🅻🅰🅳🅴🅱🅴🆉🅴 . + - . . . # . - . . ### . . - . . .#:. .:##°##:. .:#. . . - . . ####°###°#### . - . #:. .:#.###.#:. .:# . . - #########°######### . . - . #:. ####°###°#### .:# . . - . . °#######°°##°##°°#######° . - .°##°#####°#####°##° . . -. #:. ... .:##°###°###°##:. ... .:# . - . #######°##°#####°##°####### . . -. . #####°°#######°°##### . . - . 000 . . - . . . 000 . . . -. ..................O000O................. diff --git a/cpp05/ex02/PresidentialPardonForm.cpp b/cpp05/ex02/PresidentialPardonForm.cpp index d515e01..876a3bb 100644 --- a/cpp05/ex02/PresidentialPardonForm.cpp +++ b/cpp05/ex02/PresidentialPardonForm.cpp @@ -6,12 +6,17 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/21 11:31:13 by fgras-ca #+# #+# */ -/* Updated: 2024/02/25 13:29:09 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 14:58:00 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ #include "PresidentialPardonForm.hpp" +PresidentialPardonForm::PresidentialPardonForm() +{ + std::cout << GREEN << "PresidentialPardonForm default constructor called!" << RESET << std::endl; +} + PresidentialPardonForm::PresidentialPardonForm(const std::string& target) : AForm("PresidentialPardonForm", 25, 5), target(target) { diff --git a/cpp05/ex02/PresidentialPardonForm.hpp b/cpp05/ex02/PresidentialPardonForm.hpp index f671e7c..b8755f1 100644 --- a/cpp05/ex02/PresidentialPardonForm.hpp +++ b/cpp05/ex02/PresidentialPardonForm.hpp @@ -6,7 +6,7 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/20 16:56:48 by fgras-ca #+# #+# */ -/* Updated: 2024/02/22 15:39:59 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 14:56:39 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ @@ -28,6 +28,7 @@ private: std::string target; public: + PresidentialPardonForm(); PresidentialPardonForm(const std::string& target); PresidentialPardonForm(const PresidentialPardonForm& other); PresidentialPardonForm& operator=(const PresidentialPardonForm& other); diff --git a/cpp05/ex02/RobotomyRequestForm.cpp b/cpp05/ex02/RobotomyRequestForm.cpp index 701b503..56b9a4f 100644 --- a/cpp05/ex02/RobotomyRequestForm.cpp +++ b/cpp05/ex02/RobotomyRequestForm.cpp @@ -6,7 +6,7 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/21 11:25:21 by fgras-ca #+# #+# */ -/* Updated: 2024/02/25 13:15:16 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 15:08:54 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,6 +22,11 @@ void RobotomyRequestForm::initializeRandomSeed() } } +RobotomyRequestForm::RobotomyRequestForm() +{ + std::cout << GREEN << "RobotomyRequestForm default constructor called!" << RESET << std::endl; +} + RobotomyRequestForm::RobotomyRequestForm(const std::string& target) : AForm("RobotomyRequestForm", 72, 45), target(target) { diff --git a/cpp05/ex02/RobotomyRequestForm.hpp b/cpp05/ex02/RobotomyRequestForm.hpp index 2b44821..82a092f 100644 --- a/cpp05/ex02/RobotomyRequestForm.hpp +++ b/cpp05/ex02/RobotomyRequestForm.hpp @@ -6,7 +6,7 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/20 16:55:26 by fgras-ca #+# #+# */ -/* Updated: 2024/02/22 16:10:22 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 15:01:24 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ @@ -30,6 +30,7 @@ private: std::string target; public: + RobotomyRequestForm(); RobotomyRequestForm(const std::string& target); RobotomyRequestForm(const RobotomyRequestForm& other); RobotomyRequestForm& operator=(const RobotomyRequestForm& other); diff --git a/cpp05/ex02/ShrubberyCreationForm.cpp b/cpp05/ex02/ShrubberyCreationForm.cpp index 7e8af2e..8ad5a8b 100644 --- a/cpp05/ex02/ShrubberyCreationForm.cpp +++ b/cpp05/ex02/ShrubberyCreationForm.cpp @@ -6,12 +6,17 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/20 16:54:52 by fgras-ca #+# #+# */ -/* Updated: 2024/02/22 16:33:23 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 15:09:53 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ #include "ShrubberyCreationForm.hpp" +ShrubberyCreationForm::ShrubberyCreationForm() +{ + std::cout << GREEN << "ShrubberyCreationForm default constructor called!" << RESET << std::endl; +} + ShrubberyCreationForm::ShrubberyCreationForm(const std::string& target) : AForm("ShrubberyCreationForm", 145, 137), target(target) { diff --git a/cpp05/ex02/ShrubberyCreationForm.hpp b/cpp05/ex02/ShrubberyCreationForm.hpp index f98b31d..3d0fbc7 100644 --- a/cpp05/ex02/ShrubberyCreationForm.hpp +++ b/cpp05/ex02/ShrubberyCreationForm.hpp @@ -6,7 +6,7 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/20 16:41:49 by fgras-ca #+# #+# */ -/* Updated: 2024/02/22 15:35:33 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 15:09:14 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ @@ -28,6 +28,7 @@ private: std::string target; public: + ShrubberyCreationForm(); ShrubberyCreationForm(const std::string& target); ShrubberyCreationForm(const ShrubberyCreationForm& other); ShrubberyCreationForm& operator=(const ShrubberyCreationForm& other); diff --git a/cpp05/ex03/AForm.cpp b/cpp05/ex03/AForm.cpp index 0b9a6b3..5b1cadc 100644 --- a/cpp05/ex03/AForm.cpp +++ b/cpp05/ex03/AForm.cpp @@ -6,13 +6,18 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/11 14:39:51 by fgras-ca #+# #+# */ -/* Updated: 2024/02/22 14:36:36 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 15:11:19 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ #include "Bureaucrat.hpp" #include "AForm.hpp" +AForm::AForm() : name("default"), isSigned(false), gradeRequiredToSign(150), gradeRequiredToExecute(150) +{ + std::cout << GREEN << "AForm default constructor called!" << RESET << std::endl; +} + AForm::AForm(const std::string &name, int gradeRequiredToSign, int gradeRequiredToExecute) : name(name), isSigned(false), gradeRequiredToSign(gradeRequiredToSign), gradeRequiredToExecute(gradeRequiredToExecute) { @@ -24,6 +29,7 @@ AForm::AForm(const std::string &name, int gradeRequiredToSign, int gradeRequired { throw GradeTooLowException(); } + std::cout << GREEN << "AForm" << this->name << "constructor called with grade to sign: " << this->gradeRequiredToSign << " and grade to execute: " << this->gradeRequiredToExecute << RESET << std::endl; } AForm::AForm(const AForm& other) diff --git a/cpp05/ex03/AForm.hpp b/cpp05/ex03/AForm.hpp index a66f1b4..5d786b8 100644 --- a/cpp05/ex03/AForm.hpp +++ b/cpp05/ex03/AForm.hpp @@ -6,7 +6,7 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/11 14:37:14 by fgras-ca #+# #+# */ -/* Updated: 2024/02/22 13:49:48 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 14:54:08 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ @@ -32,6 +32,7 @@ protected: public: //constructueur + AForm(); AForm(const std::string &name, int gradeRequiredToSign, int gradeRequiredToExecute); // Constructeur par copie AForm(const AForm& other); diff --git a/cpp05/ex03/PresidentialPardonForm.cpp b/cpp05/ex03/PresidentialPardonForm.cpp index d515e01..3cf09c5 100644 --- a/cpp05/ex03/PresidentialPardonForm.cpp +++ b/cpp05/ex03/PresidentialPardonForm.cpp @@ -6,12 +6,17 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/21 11:31:13 by fgras-ca #+# #+# */ -/* Updated: 2024/02/25 13:29:09 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 15:15:01 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ #include "PresidentialPardonForm.hpp" +PresidentialPardonForm::PresidentialPardonForm() +{ + std::cout << GREEN << "PresidentialPardonForm default constructor called!" << RESET << std::endl; +} + PresidentialPardonForm::PresidentialPardonForm(const std::string& target) : AForm("PresidentialPardonForm", 25, 5), target(target) { diff --git a/cpp05/ex03/PresidentialPardonForm.hpp b/cpp05/ex03/PresidentialPardonForm.hpp index f671e7c..f508cc2 100644 --- a/cpp05/ex03/PresidentialPardonForm.hpp +++ b/cpp05/ex03/PresidentialPardonForm.hpp @@ -6,7 +6,7 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/20 16:56:48 by fgras-ca #+# #+# */ -/* Updated: 2024/02/22 15:39:59 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 15:07:10 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ @@ -28,6 +28,7 @@ private: std::string target; public: + PresidentialPardonForm(); PresidentialPardonForm(const std::string& target); PresidentialPardonForm(const PresidentialPardonForm& other); PresidentialPardonForm& operator=(const PresidentialPardonForm& other); diff --git a/cpp05/ex03/RobotomyRequestForm.cpp b/cpp05/ex03/RobotomyRequestForm.cpp index 701b503..8b262f7 100644 --- a/cpp05/ex03/RobotomyRequestForm.cpp +++ b/cpp05/ex03/RobotomyRequestForm.cpp @@ -6,7 +6,7 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/21 11:25:21 by fgras-ca #+# #+# */ -/* Updated: 2024/02/25 13:15:16 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 15:03:42 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,6 +22,11 @@ void RobotomyRequestForm::initializeRandomSeed() } } +RobotomyRequestForm::RobotomyRequestForm() +{ + std::cout << GREEN << "RobotomyRequestForm default constructor called!" << RESET << std::endl; +} + RobotomyRequestForm::RobotomyRequestForm(const std::string& target) : AForm("RobotomyRequestForm", 72, 45), target(target) { diff --git a/cpp05/ex03/RobotomyRequestForm.hpp b/cpp05/ex03/RobotomyRequestForm.hpp index 2b44821..f7d0279 100644 --- a/cpp05/ex03/RobotomyRequestForm.hpp +++ b/cpp05/ex03/RobotomyRequestForm.hpp @@ -6,7 +6,7 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/20 16:55:26 by fgras-ca #+# #+# */ -/* Updated: 2024/02/22 16:10:22 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 15:06:32 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ @@ -30,6 +30,7 @@ private: std::string target; public: + RobotomyRequestForm(); RobotomyRequestForm(const std::string& target); RobotomyRequestForm(const RobotomyRequestForm& other); RobotomyRequestForm& operator=(const RobotomyRequestForm& other); diff --git a/cpp05/ex03/ShrubberyCreationForm.cpp b/cpp05/ex03/ShrubberyCreationForm.cpp index 7e8af2e..0a02cb9 100644 --- a/cpp05/ex03/ShrubberyCreationForm.cpp +++ b/cpp05/ex03/ShrubberyCreationForm.cpp @@ -6,12 +6,17 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/20 16:54:52 by fgras-ca #+# #+# */ -/* Updated: 2024/02/22 16:33:23 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 15:05:29 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ #include "ShrubberyCreationForm.hpp" +ShrubberyCreationForm::ShrubberyCreationForm() +{ + std::cout << GREEN << "ShrubberyCreationForm default constructor called!" << RESET << std::endl; +} + ShrubberyCreationForm::ShrubberyCreationForm(const std::string& target) : AForm("ShrubberyCreationForm", 145, 137), target(target) { diff --git a/cpp05/ex03/ShrubberyCreationForm.hpp b/cpp05/ex03/ShrubberyCreationForm.hpp index f98b31d..275ae86 100644 --- a/cpp05/ex03/ShrubberyCreationForm.hpp +++ b/cpp05/ex03/ShrubberyCreationForm.hpp @@ -6,7 +6,7 @@ /* By: fgras-ca +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/20 16:41:49 by fgras-ca #+# #+# */ -/* Updated: 2024/02/22 15:35:33 by fgras-ca ### ########.fr */ +/* Updated: 2024/03/11 15:04:32 by fgras-ca ### ########.fr */ /* */ /* ************************************************************************** */ @@ -28,6 +28,7 @@ private: std::string target; public: + ShrubberyCreationForm(); ShrubberyCreationForm(const std::string& target); ShrubberyCreationForm(const ShrubberyCreationForm& other); ShrubberyCreationForm& operator=(const ShrubberyCreationForm& other);