little step ex05

This commit is contained in:
Alexandre POMMIER 2022-08-04 19:46:56 +02:00
parent 3cb4c810e3
commit 04eaf3c332
30 changed files with 89 additions and 146139 deletions

View File

@ -1,70 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Calque_1"
x="0px"
y="0px"
viewBox="0 0 137.6 96.599998"
enable-background="new 0 0 595.3 841.9"
xml:space="preserve"
inkscape:version="0.48.2 r9819"
width="100%"
height="100%"
sodipodi:docname="42_logo.svg"><metadata
id="metadata17"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs15" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1060"
inkscape:window-height="811"
id="namedview13"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="0.39642998"
inkscape:cx="68.450005"
inkscape:cy="48.350011"
inkscape:window-x="670"
inkscape:window-y="233"
inkscape:window-maximized="0"
inkscape:current-layer="Calque_1" />
<g
id="g3"
transform="translate(-229.2,-372.70002)">
<polygon
points="229.2,443.9 279.9,443.9 279.9,469.3 305.2,469.3 305.2,423.4 254.6,423.4 305.2,372.7 279.9,372.7 229.2,423.4 "
id="polygon5"
style="fill:#ffffff" />
<polygon
points="316.1,398.1 341.4,372.7 316.1,372.7 "
id="polygon7"
style="fill:#ffffff" />
<polygon
points="341.4,398.1 316.1,423.4 316.1,448.7 341.4,448.7 341.4,423.4 366.8,398.1 366.8,372.7 341.4,372.7 "
id="polygon9"
style="fill:#ffffff" />
<polygon
points="366.8,423.4 341.4,448.7 366.8,448.7 "
id="polygon11"
style="fill:#ffffff" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -1,4 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://projects.intra.42.fr/
HostUrl=https://profile.intra.42.fr/assets/42_logo-7dfc9110a5319a308863b96bda33cea995046d1731cebb735e41b16255106c12.svg

View File

@ -1,4 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://projects.intra.42.fr/scale_teams/4404857/edit
HostUrl=https://projects.intra.42.fr/assets/application-8f815d5a917479ab13b64e2e133df25716dbeef96951f47aa42662ad3623d97b.css

View File

@ -1,4 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://projects.intra.42.fr/scale_teams/4404857/edit
HostUrl=https://projects.intra.42.fr/assets/application-9240cae940616118d71b63444c3ece58181fb56886332c6d72b492e7bb35d065.js

File diff suppressed because one or more lines are too long

View File

@ -1,4 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://projects.intra.42.fr/
HostUrl=https://www.googletagmanager.com/gtag/js?id=G-BJ34XNRJCV

View File

@ -125,7 +125,7 @@ void Account::_displayTimestamp( void )
time (&rawtime);
timeinfo = localtime(&rawtime);
strftime (buffer, 20, "[%G%m%d_%H%M%S]", timeinfo);
/std::cout << buffer;
std::cout << buffer;
//const char *buffeer = "[19920104_091532]";
//std::cout << buffeer;
}

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 02:05:22 by apommier #+# #+# */
/* Updated: 2022/07/17 11:13:43 by apommier ### ########.fr */
/* Updated: 2022/08/04 16:48:25 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -15,7 +15,7 @@
Animal::Animal()
{
std::cout << "Animal Default constructor called" << std::endl;
this->type = "Animal";
this->type = "Basic Animal";
}
Animal::Animal(const Animal& copy)

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 02:11:39 by apommier #+# #+# */
/* Updated: 2022/07/17 11:47:44 by apommier ### ########.fr */
/* Updated: 2022/08/04 14:14:02 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,7 +20,7 @@ class Cat : public Animal {
Cat();
Cat(const Cat& copy);
~Cat();
virtual ~Cat();
Cat &operator=(const Cat& rhs);
void makeSound(void) const;

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 02:11:42 by apommier #+# #+# */
/* Updated: 2022/07/15 04:27:19 by apommier ### ########.fr */
/* Updated: 2022/08/04 14:13:59 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,7 +20,7 @@ class Dog : public Animal {
Dog();
Dog(const Dog& copy);
~Dog();
virtual ~Dog();
Dog &operator=(const Dog& rhs);
void makeSound(void) const;

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 10:53:59 by apommier #+# #+# */
/* Updated: 2022/07/17 11:27:27 by apommier ### ########.fr */
/* Updated: 2022/08/04 14:13:19 by apommier ### ########.fr */
/* */
/* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 10:54:02 by apommier #+# #+# */
/* Updated: 2022/07/17 11:15:05 by apommier ### ########.fr */
/* Updated: 2022/08/04 14:13:27 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,7 +20,7 @@ class WrongCat : public WrongAnimal {
WrongCat();
WrongCat(const WrongCat& copy);
~WrongCat();
virtual ~WrongCat();
WrongCat &operator=(const WrongCat& rhs);
void makeSound(void) const;

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 02:11:39 by apommier #+# #+# */
/* Updated: 2022/07/17 18:39:59 by apommier ### ########.fr */
/* Updated: 2022/08/04 14:14:21 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,7 +19,7 @@ class Cat : public Animal {
public :
Cat();
Cat(const Cat& copy);
~Cat();
virtual ~Cat();
Cat &operator=(const Cat& rhs);
Animal &operator=( const Animal &rhs);

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 02:11:42 by apommier #+# #+# */
/* Updated: 2022/07/17 19:04:03 by apommier ### ########.fr */
/* Updated: 2022/08/04 14:14:24 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,7 +20,7 @@ class Dog : public Animal {
Dog();
Dog(const Dog& copy);
~Dog();
virtual ~Dog();
Dog &operator=(const Dog& rhs);
Animal &operator=( const Animal &rhs);

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 10:54:02 by apommier #+# #+# */
/* Updated: 2022/07/17 11:15:05 by apommier ### ########.fr */
/* Updated: 2022/08/04 14:14:30 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,7 +20,7 @@ class WrongCat : public WrongAnimal {
WrongCat();
WrongCat(const WrongCat& copy);
~WrongCat();
virtual ~WrongCat();
WrongCat &operator=(const WrongCat& rhs);
void makeSound(void) const;

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 02:11:39 by apommier #+# #+# */
/* Updated: 2022/08/03 19:50:44 by apommier ### ########.fr */
/* Updated: 2022/08/04 14:14:38 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,7 +19,7 @@ class Cat : public Animal {
public :
Cat();
Cat(const Cat& copy);
~Cat();
virtual ~Cat();
Cat &operator=(const Cat& rhs);
Animal &operator=( const Animal &rhs);

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/14 02:11:42 by apommier #+# #+# */
/* Updated: 2022/07/17 19:04:03 by apommier ### ########.fr */
/* Updated: 2022/08/04 14:14:41 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,7 +20,7 @@ class Dog : public Animal {
Dog();
Dog(const Dog& copy);
~Dog();
virtual ~Dog();
Dog &operator=(const Dog& rhs);
Animal &operator=( const Animal &rhs);

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/17 10:54:02 by apommier #+# #+# */
/* Updated: 2022/07/17 11:15:05 by apommier ### ########.fr */
/* Updated: 2022/08/04 14:14:46 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,7 +20,7 @@ class WrongCat : public WrongAnimal {
WrongCat();
WrongCat(const WrongCat& copy);
~WrongCat();
virtual ~WrongCat();
WrongCat &operator=(const WrongCat& rhs);
void makeSound(void) const;

View File

@ -95,7 +95,7 @@ void AForm::execute(Bureaucrat const & executor) const
{
if (!this->_isSigned)
throw AForm::formIsNotSignedException();
else if (executor.getGrade > this->_signedGrade)
else if (executor.getGrade() > this->_signedGrade)
throw AForm::executionGradeTooLowException();
}

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 21:34:42 by apommier #+# #+# */
/* Updated: 2022/08/02 18:18:19 by apommier ### ########.fr */
/* Updated: 2022/08/04 15:28:47 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -86,7 +86,7 @@ void Bureaucrat::signForm(AForm form)
}
}
void Bureaucrat::executeForm(Form const & form) const
void Bureaucrat::executeForm(AForm const & form) const
{
form.execute(*this);
}

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 21:34:43 by apommier #+# #+# */
/* Updated: 2022/08/02 18:19:30 by apommier ### ########.fr */
/* Updated: 2022/08/04 15:26:47 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -35,7 +35,7 @@ class Bureaucrat{
void checkGrade() const;
void signForm(AForm form);
void executeForm(Form const & form) const;
void executeForm(AForm const & form) const;
class GradeTooLowException : public std::exception
{

View File

@ -6,20 +6,25 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/23 12:16:26 by apommier #+# #+# */
/* Updated: 2022/08/02 18:22:30 by apommier ### ########.fr */
/* Updated: 2022/08/04 18:52:20 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
#include "PresidentialPardonForm.hpp"
PresidentialPardonForm::PresidentialPardonForm()
PresidentialPardonForm::PresidentialPardonForm() : AForm(25, 5, "PresidentialPardonForm")
{
}
PresidentialPardonForm::PresidentialPardonForm(const PresidentialPardonForm& copy)
PresidentialPardonForm::PresidentialPardonForm(std::string target) : AForm(25, 5, "PresidentialPardonForm")
{
this->_target = target;
}
PresidentialPardonForm::PresidentialPardonForm(const PresidentialPardonForm& copy) : AForm(copy)
{
*this = copy;
}
PresidentialPardonForm::~PresidentialPardonForm()
@ -29,10 +34,12 @@ PresidentialPardonForm::~PresidentialPardonForm()
PresidentialPardonForm &PresidentialPardonForm::operator=(const PresidentialPardonForm& rhs)
{
if (&rhs != this)
this->_target = rhs._target;
return (*this);
}
void PresidentialPardonForm::execute(Bureaucrat const & executor) const
{
AForm::execute(executor);
}

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/08/02 18:21:41 by apommier #+# #+# */
/* Updated: 2022/08/02 18:21:44 by apommier ### ########.fr */
/* Updated: 2022/08/04 15:07:38 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,6 +19,7 @@ class PresidentialPardonForm : public AForm{
public :
PresidentialPardonForm();
PresidentialPardonForm(std::string target);
PresidentialPardonForm(const PresidentialPardonForm& copy);
~PresidentialPardonForm();
PresidentialPardonForm &operator=(const PresidentialPardonForm& rhs);
@ -26,6 +27,8 @@ class PresidentialPardonForm : public AForm{
void execute(Bureaucrat const & executor) const;
private :
std::string _target;
};
#endif

View File

@ -5,21 +5,26 @@
/* +:+ +:+ +:+ */
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/19 13:00:09 by apommier #+# #+# */
/* Updated: 2022/07/23 12:35:53 by apommier ### ########.fr */
/* Created: 2022/08/04 15:14:32 by apommier #+# #+# */
/* Updated: 2022/08/04 18:54:53 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
#include "RobotomyRequestForm.hpp"
RobotomyRequestForm::RobotomyRequestForm()
RobotomyRequestForm::RobotomyRequestForm() : AForm(72, 45, "RobotomyRequestForm")
{
}
RobotomyRequestForm::RobotomyRequestForm(const RobotomyRequestForm.hpp& copy)
RobotomyRequestForm::RobotomyRequestForm(std::string target) : AForm(72, 45, "RobotomyRequestForm")
{
this->_target = target;
}
RobotomyRequestForm::RobotomyRequestForm(const RobotomyRequestForm& copy) : AForm(copy)
{
*this = copy;
}
RobotomyRequestForm::~RobotomyRequestForm()
@ -27,12 +32,14 @@ RobotomyRequestForm::~RobotomyRequestForm()
}
RobotomyRequestForm.hpp RobotomyRequestForm::&operator=(const RobotomyRequestForm.hpp& rhs)
RobotomyRequestForm &RobotomyRequestForm::operator=(const RobotomyRequestForm& rhs)
{
if (&rhs != this)
this->_target = rhs._target;
return (*this);
}
void RobotomyRequestForm::execute(Bureaucrat const & executor) const
{
AForm::execute(executor);
}

View File

@ -19,14 +19,16 @@ class RobotomyRequestForm : public AForm{
public :
RobotomyRequestForm();
RobotomyRequestForm(std::string target);
RobotomyRequestForm(const RobotomyRequestForm& copy);
~RobotomyRequestForm();
RobotomyRequestForm &operator=(const RobotomyRequestForm& rhs);
void execute(Bureaucrat const & executor) const;
private :
std::string _target;
};
#endif

View File

@ -6,58 +6,47 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/19 13:00:14 by apommier #+# #+# */
/* Updated: 2022/07/23 12:35:04 by apommier ### ########.fr */
/* Updated: 2022/08/04 19:44:50 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
#include "ShrubberyCreationForm.hpp"
# include <iostream>
# include <fstream>
# include <sstream>
ShrubberyCreationForm::ShrubberyCreationForm()
ShrubberyCreationForm::ShrubberyCreationForm() : AForm(145, 137, "RobotomyRequestForm")
{
}
ShrubberyCreationForm::ShrubberyCreationForm(const ShrubberyCreationForm& copy)
ShrubberyCreationForm::ShrubberyCreationForm(std::string target) : AForm(145, 137, "RobotomyRequestForm")
{
this->_target = target;
}
ShrubberyCreationForm::ShrubberyCreationForm(const ShrubberyCreationForm& copy) : AForm(copy)
{
*this = copy;
}
ShrubberyCreationForm::~ShrubberyCreationForm()
{
}
ShrubberyCreationForm &ShrubberyCreationForm::operator=(const ShrubberyCreationForm& rhs)
{
if (&rhs != this)
this->_target = rhs._target;
return (*this);
}
void RobotomyRequestForm::execute(Bureaucrat const & executor) const
void ShrubberyCreationForm::execute(Bureaucrat const & executor) const
{
std::string name = this->_target;
std::cout << name << std::endl;
AForm::execute(executor);
std::ofstream outfile((std::string)name + "test");
outfile << " .\n . : \n . . :: :: \n . . ::: :: \n : : ::::. .. \n .. :: :: : ::. .:\n : ::: ::: . :: ::: .:.\n :: :::: . : :: ::: .::. \n ::: :: ::: : ::: .::.\n `::. ::: ::. `::::.::.\n `:::. :::. ::: :: :::::.\n `:::. ::bd:: :::::.\n `:::. :::. ::::. \n `::. `:::. :::: \n `:::. `::: :::: \n :::. :::: :::: \n ::bd:::bd:::: \n ::::::::::\n ::::::::\n :::(o): . . \n ::o:::(... \n `.. ::o:::: \n `):o:::: \n ::(o)::: \n .:::::: \n :::::::. \n :::::::::. \n ...::::::::::...";
}
// _
// /;-._,-.____ ,-----.__
// (_:#::_.:::. `-._ /:, /-._, `._,
// \ _|`"=:_::.`.); \ __/ /
// , `./ \:. `. )==-'
// ., ,-=-. ,\, +#./` \:. / /
// \/:/`-' , ,\ '` ` ` ): , /_ -o
// /:+- - + +- : :- + + -:' /(o-) \)
// ,=': \ ` `/` ' , , ,:' `'--".--"---._/`7
// ( \: \,-._` ` + '\, ," _,--._,---":.__/
// \: ` X` _| _,\/' .-'
// ":._:`\____ /:' /
// \::. :\/:' /
// `.:. /:' }
// ):_(:; \
// /:. _/ , |
// (|::. ,`
// |::. {\
// |::.\ \ `.
// |:::(\ |
// O |:::/{ } | (o
// ) ___/#\::`/ (O "==._____ O, (O /`
// ~~~w/w~"~~,\` `:/,-(~`"~~~~~~~~"~o~\~/~w|/~
// ~~~~~~~~~~~~~~~~~~~~~~~\\W~~~~~~~~~~~~\|/~~

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/19 13:00:12 by apommier #+# #+# */
/* Updated: 2022/07/23 13:43:44 by apommier ### ########.fr */
/* Updated: 2022/08/04 18:54:10 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -19,14 +19,16 @@ class ShrubberyCreationForm : public AForm{
public :
ShrubberyCreationForm();
ShrubberyCreationForm(std::string target);
ShrubberyCreationForm(const ShrubberyCreationForm& copy);
~ShrubberyCreationForm();
ShrubberyCreationForm &operator=(const ShrubberyCreationForm& rhs);
void execute(Bureaucrat const & executor) const;
private :
std::string _target;
};
#endif

View File

@ -6,7 +6,7 @@
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 21:34:45 by apommier #+# #+# */
/* Updated: 2022/08/02 18:04:36 by apommier ### ########.fr */
/* Updated: 2022/08/04 19:38:41 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
@ -24,5 +24,7 @@ int main()
std::cout << e.what();
return (-1);
}
//ShrubberyCreationForm test;
//test.execute()
return (0);
}