「✨」 feat: finished ex02
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,4 +6,6 @@ compile_commands.json
|
|||||||
*.d
|
*.d
|
||||||
|
|
||||||
|
|
||||||
|
Form
|
||||||
|
AForm
|
||||||
Bureaucrat
|
Bureaucrat
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/09 17:38:19 by adjoly #+# #+# */
|
/* Created: 2025/03/09 17:38:19 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/01 11:06:48 by adjoly ### ########.fr */
|
/* Updated: 2025/04/03 14:33:17 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ AForm::AForm(std::string name, uint8_t minForSign, uint8_t minForExec)
|
|||||||
|
|
||||||
AForm::AForm(const AForm &f)
|
AForm::AForm(const AForm &f)
|
||||||
: _name(f.getName()), _signed(f.getSigned()),
|
: _name(f.getName()), _signed(f.getSigned()),
|
||||||
_minForExec(f.getMinForExec()), _minForSign(f.getMinForSign()) {
|
_minForSign(f.getMinForSign()), _minForExec(f.getMinForExec()) {
|
||||||
_log("➕", "AForm", "", "copy constructor called");
|
_log("➕", "AForm", "", "copy constructor called");
|
||||||
_gradeCheck();
|
_gradeCheck();
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ uint8_t AForm::getMinForSign(void) const { return _minForSign; }
|
|||||||
uint8_t AForm::getMinForExec(void) const { return _minForExec; }
|
uint8_t AForm::getMinForExec(void) const { return _minForExec; }
|
||||||
|
|
||||||
void AForm::beSigned(Bureaucrat b) {
|
void AForm::beSigned(Bureaucrat b) {
|
||||||
if (_minForSign > b.getGrade()) {
|
if (_minForSign < b.getGrade()) {
|
||||||
throw GradeTooLowException();
|
throw GradeTooLowException();
|
||||||
}
|
}
|
||||||
_signed = true;
|
_signed = true;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/08 20:10:59 by adjoly #+# #+# */
|
/* Created: 2025/03/08 20:10:59 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/01 11:03:13 by adjoly ### ########.fr */
|
/* Updated: 2025/04/03 13:50:38 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -61,4 +61,4 @@ class AForm {
|
|||||||
void _gradeCheck(void) const;
|
void _gradeCheck(void) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &, Form &);
|
std::ostream &operator<<(std::ostream &, AForm &);
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/12/23 13:59:45 by adjoly #+# #+# */
|
/* Created: 2024/12/23 13:59:45 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/01 10:49:43 by adjoly ### ########.fr */
|
/* Updated: 2025/04/03 14:21:09 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "Bureaucrat.hpp"
|
#include "Bureaucrat.hpp"
|
||||||
#include "Form.hpp"
|
#include "AForm.hpp"
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
void _log(std::string emoji, std::string what, std::string who,
|
void _log(std::string emoji, std::string what, std::string who,
|
||||||
@ -56,6 +56,10 @@ Bureaucrat &Bureaucrat::operator=(Bureaucrat const &cpy) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Bureaucrat::executeForm(const AForm &form) const {
|
||||||
|
form.execute(*this);
|
||||||
|
}
|
||||||
|
|
||||||
Bureaucrat &Bureaucrat::operator++(void) {
|
Bureaucrat &Bureaucrat::operator++(void) {
|
||||||
_grade--;
|
_grade--;
|
||||||
if (_grade < MAXGRADE)
|
if (_grade < MAXGRADE)
|
||||||
@ -101,7 +105,7 @@ const char *Bureaucrat::GradeTooLowException::what() const throw() {
|
|||||||
return ("Grade is too low");
|
return ("Grade is too low");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bureaucrat::signForm(Form &f) {
|
void Bureaucrat::signForm(AForm &f) {
|
||||||
try {
|
try {
|
||||||
f.beSigned(*this);
|
f.beSigned(*this);
|
||||||
std::cout << _name << " signed " << f.getName() << std::endl;
|
std::cout << _name << " signed " << f.getName() << std::endl;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/12/23 13:59:43 by adjoly #+# #+# */
|
/* Created: 2024/12/23 13:59:43 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/01 10:50:00 by adjoly ### ########.fr */
|
/* Updated: 2025/04/03 13:50:01 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -21,7 +21,7 @@
|
|||||||
void _log(std::string emoji, std::string what, std::string who,
|
void _log(std::string emoji, std::string what, std::string who,
|
||||||
std::string str);
|
std::string str);
|
||||||
|
|
||||||
class Form;
|
class AForm;
|
||||||
|
|
||||||
typedef unsigned char uint8_t;
|
typedef unsigned char uint8_t;
|
||||||
|
|
||||||
@ -38,6 +38,8 @@ class Bureaucrat {
|
|||||||
const std::string &getName(void) const;
|
const std::string &getName(void) const;
|
||||||
uint8_t getGrade(void) const;
|
uint8_t getGrade(void) const;
|
||||||
|
|
||||||
|
void executeForm(const AForm &) const;
|
||||||
|
|
||||||
class GradeTooHighException : public std::exception {
|
class GradeTooHighException : public std::exception {
|
||||||
public:
|
public:
|
||||||
virtual const char *what() const throw();
|
virtual const char *what() const throw();
|
||||||
@ -58,7 +60,7 @@ class Bureaucrat {
|
|||||||
Bureaucrat operator++(int);
|
Bureaucrat operator++(int);
|
||||||
Bureaucrat operator--(int);
|
Bureaucrat operator--(int);
|
||||||
|
|
||||||
void signForm(Form &);
|
void signForm(AForm &);
|
||||||
private:
|
private:
|
||||||
const std::string _name;
|
const std::string _name;
|
||||||
uint8_t _grade;
|
uint8_t _grade;
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
# By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ #
|
# By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2024/10/25 16:09:27 by adjoly #+# #+# #
|
# Created: 2024/10/25 16:09:27 by adjoly #+# #+# #
|
||||||
# Updated: 2025/03/30 15:14:32 by adjoly ### ########.fr #
|
# Updated: 2025/04/03 14:23:56 by adjoly ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
SHELL = bash
|
SHELL = bash
|
||||||
|
|
||||||
NAME = Form
|
NAME = AForm
|
||||||
|
|
||||||
CC = c++
|
CC = c++
|
||||||
|
|
||||||
|
48
ex02/PresidentialPardonForm.cpp
Normal file
48
ex02/PresidentialPardonForm.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* PresidentialPardonForm.cpp :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2025/04/03 09:45:26 by adjoly #+# #+# */
|
||||||
|
/* Updated: 2025/04/03 14:13:21 by adjoly ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "PresidentialPardonForm.hpp"
|
||||||
|
#include "AForm.hpp"
|
||||||
|
|
||||||
|
PresidentialPardonForm::PresidentialPardonForm(void)
|
||||||
|
: AForm("PresidentialPardonForm", 25, 5) {
|
||||||
|
_log("➕", "PresidentialPardonForm", "", "default constructor called");
|
||||||
|
}
|
||||||
|
|
||||||
|
PresidentialPardonForm::PresidentialPardonForm(
|
||||||
|
const PresidentialPardonForm &cpy) : AForm(cpy) {
|
||||||
|
_log("➕", "PresidentialPardonForm", "", "copy constructor called");
|
||||||
|
if (this != &cpy)
|
||||||
|
*this = cpy;
|
||||||
|
}
|
||||||
|
|
||||||
|
PresidentialPardonForm::PresidentialPardonForm(std::string &target)
|
||||||
|
: AForm(target, 25, 5) {
|
||||||
|
_log("➕", "PresidentialPardonForm", "", "target constructor called");
|
||||||
|
}
|
||||||
|
|
||||||
|
PresidentialPardonForm::~PresidentialPardonForm(void) {
|
||||||
|
_log("➖", "PresidentialPardonForm", "", "destructor called");
|
||||||
|
}
|
||||||
|
|
||||||
|
PresidentialPardonForm &
|
||||||
|
PresidentialPardonForm::operator=(const PresidentialPardonForm &cpy) {
|
||||||
|
_log("➕", "PresidentialPardonForm", "",
|
||||||
|
"copy assignement constructor called");
|
||||||
|
(void)cpy;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PresidentialPardonForm::_exec(const Bureaucrat &b) const {
|
||||||
|
std::cout << b.getName() << " has been pardoned by Zaphod Beeblebrox 🙀"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
28
ex02/PresidentialPardonForm.hpp
Normal file
28
ex02/PresidentialPardonForm.hpp
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* PresidentialPardonForm.hpp :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2025/04/03 09:44:16 by adjoly #+# #+# */
|
||||||
|
/* Updated: 2025/04/03 14:04:03 by adjoly ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Bureaucrat.hpp"
|
||||||
|
#include "AForm.hpp"
|
||||||
|
|
||||||
|
class PresidentialPardonForm : public AForm {
|
||||||
|
public:
|
||||||
|
PresidentialPardonForm(void);
|
||||||
|
PresidentialPardonForm(const PresidentialPardonForm &);
|
||||||
|
PresidentialPardonForm(std::string &);
|
||||||
|
~PresidentialPardonForm(void);
|
||||||
|
|
||||||
|
PresidentialPardonForm &operator=(const PresidentialPardonForm &);
|
||||||
|
private:
|
||||||
|
void _exec(const Bureaucrat &) const;
|
||||||
|
};
|
53
ex02/RobotomyRequestForm.cpp
Normal file
53
ex02/RobotomyRequestForm.cpp
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* RobotomyRequestForm.cpp :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2025/04/03 09:19:30 by adjoly #+# #+# */
|
||||||
|
/* Updated: 2025/04/03 14:17:12 by adjoly ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "RobotomyRequestForm.hpp"
|
||||||
|
#include "Bureaucrat.hpp"
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
RobotomyRequestForm::RobotomyRequestForm(void)
|
||||||
|
: AForm("RobotomyRequestForm", 72, 45) {
|
||||||
|
_log("➕", "RobotomyRequestForm", "", "default constructor called");
|
||||||
|
}
|
||||||
|
|
||||||
|
RobotomyRequestForm::RobotomyRequestForm(const RobotomyRequestForm &cpy) : AForm(cpy) {
|
||||||
|
_log("➕", "RobotomyRequestForm", "", "copy constructor called");
|
||||||
|
if (this != &cpy)
|
||||||
|
*this = cpy;
|
||||||
|
}
|
||||||
|
|
||||||
|
RobotomyRequestForm::RobotomyRequestForm(std::string &target)
|
||||||
|
: AForm(target, 72, 45) {
|
||||||
|
_log("➕", "RobotomyRequestForm", "", "target constructor called");
|
||||||
|
}
|
||||||
|
|
||||||
|
RobotomyRequestForm::~RobotomyRequestForm(void) {
|
||||||
|
_log("➖", "RobotomyRequestForm", "", "destructor called");
|
||||||
|
}
|
||||||
|
|
||||||
|
RobotomyRequestForm &RobotomyRequestForm::operator=(const RobotomyRequestForm &cpy) {
|
||||||
|
_log("➕", "RobotomyRequestForm", "", "copy assignement constructor called");
|
||||||
|
(void)cpy;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RobotomyRequestForm::_exec(const Bureaucrat &b) const {
|
||||||
|
std::cout << "Drilingg noisseeeeeeee !!!" << std::endl;
|
||||||
|
|
||||||
|
std::srand(time(0));
|
||||||
|
|
||||||
|
if (std::rand() % 2) {
|
||||||
|
std::cout << b.getName() << " has been robotomized successfully ! :D" << std::endl;
|
||||||
|
} else {
|
||||||
|
std::cout << b.getName() << " robotomization failed 😿" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
27
ex02/RobotomyRequestForm.hpp
Normal file
27
ex02/RobotomyRequestForm.hpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* RobotomyRequestForm.hpp :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2025/04/02 16:13:39 by adjoly #+# #+# */
|
||||||
|
/* Updated: 2025/04/03 10:02:14 by adjoly ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "AForm.hpp"
|
||||||
|
|
||||||
|
class RobotomyRequestForm : public AForm {
|
||||||
|
public:
|
||||||
|
RobotomyRequestForm(void);
|
||||||
|
RobotomyRequestForm(const RobotomyRequestForm &);
|
||||||
|
RobotomyRequestForm(std::string &);
|
||||||
|
~RobotomyRequestForm(void);
|
||||||
|
|
||||||
|
RobotomyRequestForm &operator=(const RobotomyRequestForm &);
|
||||||
|
private:
|
||||||
|
void _exec(const Bureaucrat &) const;
|
||||||
|
};
|
@ -6,22 +6,62 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/01 09:25:06 by adjoly #+# #+# */
|
/* Created: 2025/04/01 09:25:06 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/01 10:53:21 by adjoly ### ########.fr */
|
/* Updated: 2025/04/03 14:33:50 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "ShrubberyCreationForm.hpp"
|
#include "ShrubberyCreationForm.hpp"
|
||||||
#include "AForm.hpp"
|
#include "AForm.hpp"
|
||||||
|
#include <fstream>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
ShrubberyCreationForm::ShrubberyCreationForm(void)
|
ShrubberyCreationForm::ShrubberyCreationForm(void)
|
||||||
: AForm("ShrubberyCreationForm", 145, 137) {
|
: AForm("ShrubberyCreationForm", 145, 137) {
|
||||||
_log("➕", "ShrubberyCreationForm", "", "default constructor called");
|
_log("➕", "ShrubberyCreationForm", "", "default constructor called");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ShrubberyCreationForm::ShrubberyCreationForm(const ShrubberyCreationForm &cpy) : AForm(cpy) {
|
||||||
|
_log("➕", "ShrubberyCreationForm", "", "copy constructor called");
|
||||||
|
if (this != &cpy)
|
||||||
|
*this = cpy;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShrubberyCreationForm::ShrubberyCreationForm(std::string &target)
|
||||||
|
: AForm(target, 72, 45) {
|
||||||
|
_log("➕", "ShrubberyCreationForm", "", "target constructor called");
|
||||||
|
}
|
||||||
|
|
||||||
ShrubberyCreationForm::~ShrubberyCreationForm(void) {
|
ShrubberyCreationForm::~ShrubberyCreationForm(void) {
|
||||||
_log("➖", "ShrubberyCreationForm", "", "destructor called");
|
_log("➖", "ShrubberyCreationForm", "", "destructor called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShrubberyCreationForm::_exec(const Bureaucrat &b) const {
|
ShrubberyCreationForm &ShrubberyCreationForm::operator=(const ShrubberyCreationForm &cpy) {
|
||||||
|
_log("➕", "ShrubberyCreationForm", "", "copy assignement constructor called");
|
||||||
|
(void)cpy;
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShrubberyCreationForm::_exec(const Bureaucrat &b) const {
|
||||||
|
std::ofstream file;
|
||||||
|
|
||||||
|
file.open(std::string(b.getName() + "_shruberry").c_str());
|
||||||
|
if (!file.is_open())
|
||||||
|
throw std::runtime_error("Could not write to " + b.getName() +
|
||||||
|
"_shruberry");
|
||||||
|
|
||||||
|
file << " _-_\n"
|
||||||
|
" /~~ ~~\\\n"
|
||||||
|
" /~~ ~~\\\n"
|
||||||
|
"{ }\n"
|
||||||
|
" \\ _- -_ /\n"
|
||||||
|
" ~ \\ // ~\n"
|
||||||
|
"_- - | | _- _\n"
|
||||||
|
" _ - | | -_\n"
|
||||||
|
" // \\\n";
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
std::cout << "ASCII tree created in : " + b.getName() + "_shruberry"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
@ -6,18 +6,24 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/01 09:19:24 by adjoly #+# #+# */
|
/* Created: 2025/04/01 09:19:24 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/04/01 10:18:36 by adjoly ### ########.fr */
|
/* Updated: 2025/04/03 13:34:46 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "AForm.hpp"
|
#include "AForm.hpp"
|
||||||
|
#include <cerrno>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class ShrubberyCreationForm : public AForm {
|
class ShrubberyCreationForm : public AForm {
|
||||||
public:
|
public:
|
||||||
ShrubberyCreationForm(void);
|
ShrubberyCreationForm(void);
|
||||||
|
ShrubberyCreationForm(const ShrubberyCreationForm &);
|
||||||
|
ShrubberyCreationForm(std::string &);
|
||||||
~ShrubberyCreationForm(void);
|
~ShrubberyCreationForm(void);
|
||||||
|
|
||||||
|
ShrubberyCreationForm &operator=(const ShrubberyCreationForm &);
|
||||||
private:
|
private:
|
||||||
void _exec(const Bureaucrat &) const;
|
void _exec(const Bureaucrat &) const;
|
||||||
};
|
};
|
||||||
|
@ -6,17 +6,17 @@
|
|||||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/12/23 14:01:11 by adjoly #+# #+# */
|
/* Created: 2024/12/23 14:01:11 by adjoly #+# #+# */
|
||||||
/* Updated: 2025/03/30 15:13:07 by adjoly ### ########.fr */
|
/* Updated: 2025/04/03 14:32:57 by adjoly ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "Bureaucrat.hpp"
|
#include "Bureaucrat.hpp"
|
||||||
#include "Form.hpp"
|
#include "AForm.hpp"
|
||||||
|
#include "ShrubberyCreationForm.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
Bureaucrat knl("Kanel", 10);
|
Bureaucrat knl("Kanel", 10);
|
||||||
Bureaucrat su("Suki", 1);
|
|
||||||
|
|
||||||
knl--;
|
knl--;
|
||||||
std::cout << knl << std::endl;
|
std::cout << knl << std::endl;
|
||||||
@ -43,9 +43,15 @@ int main(void) {
|
|||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
std::cerr << "Error : " << e.what() << std::endl;
|
std::cerr << "Error : " << e.what() << std::endl;
|
||||||
}
|
}
|
||||||
Form f("le contrattt", 5, 5);
|
|
||||||
|
ShrubberyCreationForm s;
|
||||||
|
|
||||||
su.signForm(f);
|
try {
|
||||||
|
s.beSigned(knl);
|
||||||
|
knl.executeForm(s);
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
std::cerr << "Error : " << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
std::cout << knl << std::endl;
|
std::cout << knl << std::endl;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user