mirror of
https://github.com/Ladebeze66/cpp-partie-2.git
synced 2025-12-15 13:46:56 +01:00
00
This commit is contained in:
parent
bc0c76ac99
commit
ed40c42452
@ -6,13 +6,18 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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)
|
||||
|
||||
@ -6,38 +6,37 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <string>
|
||||
#include <iostream>
|
||||
|
||||
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
|
||||
|
||||
@ -6,13 +6,18 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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)
|
||||
|
||||
@ -6,14 +6,14 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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 <string>
|
||||
#include <iostream>
|
||||
|
||||
@ -32,6 +32,7 @@ protected:
|
||||
|
||||
public:
|
||||
//constructueur
|
||||
AForm();
|
||||
AForm(const std::string &name, int gradeRequiredToSign, int gradeRequiredToExecute);
|
||||
// Constructeur par copie
|
||||
AForm(const AForm& other);
|
||||
|
||||
@ -1,16 +0,0 @@
|
||||
. 🅻🅰🅳🅴🅱🅴🆉🅴 . +
|
||||
. . . # .
|
||||
. . ### . .
|
||||
. . .#:. .:##°##:. .:#. . .
|
||||
. . ####°###°#### .
|
||||
. #:. .:#.###.#:. .:# . .
|
||||
#########°######### . .
|
||||
. #:. ####°###°#### .:# . .
|
||||
. . °#######°°##°##°°#######° .
|
||||
.°##°#####°#####°##° . .
|
||||
. #:. ... .:##°###°###°##:. ... .:# .
|
||||
. #######°##°#####°##°####### . .
|
||||
. . #####°°#######°°##### . .
|
||||
. 000 . .
|
||||
. . . 000 . . .
|
||||
. ..................O000O.................
|
||||
@ -6,12 +6,17 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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);
|
||||
|
||||
@ -6,12 +6,17 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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);
|
||||
|
||||
@ -6,13 +6,18 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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)
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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);
|
||||
|
||||
@ -6,12 +6,17 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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);
|
||||
|
||||
@ -6,12 +6,17 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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)
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user