ex05 little step

This commit is contained in:
kinou-p 2022-08-04 01:02:17 +02:00
parent 1a546db3d8
commit 9dd638cd50
18 changed files with 146126 additions and 10 deletions

View File

@ -0,0 +1,70 @@
<?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>

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

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

View File

@ -0,0 +1,4 @@
[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

@ -0,0 +1,4 @@
[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

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

View File

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

View File

@ -36,6 +36,7 @@ class AForm{
void checkGrade() const; void checkGrade() const;
void beSigned(Bureaucrat &bureaucrat); void beSigned(Bureaucrat &bureaucrat);
void execute(Bureaucrat const & executor) const;
class GradeTooLowException : public std::exception class GradeTooLowException : public std::exception
{ {
@ -64,6 +65,24 @@ class AForm{
} }
}; };
class executionGradeTooLowException : public std::exception
{
public :
virtual const char* what() const throw()
{
return ("Execution grade is too low\n");
}
};
class formIsNotSignedException : public std::exception
{
public :
virtual const char* what() const throw()
{
return ("Form isn't signed\n");
}
};
private : private :
std::string const _name; std::string const _name;

View File

@ -85,3 +85,8 @@ void Bureaucrat::signForm(AForm form)
std::cout << this->_name << " couldnt sign " << form.getName() << " form because "<< e.what(); std::cout << this->_name << " couldnt sign " << form.getName() << " form because "<< e.what();
} }
} }
void Bureaucrat::executeForm(Form const & form) const
{
}

View File

@ -35,6 +35,7 @@ class Bureaucrat{
void checkGrade() const; void checkGrade() const;
void signForm(AForm form); void signForm(AForm form);
void executeForm(Form const & form) const;
class GradeTooLowException : public std::exception class GradeTooLowException : public std::exception
{ {

View File

@ -31,3 +31,8 @@ PresidentialPardonForm &PresidentialPardonForm::operator=(const PresidentialPard
{ {
} }
void PresidentialPardonForm::execute(Bureaucrat const & executor) const
{
}

View File

@ -23,6 +23,8 @@ class PresidentialPardonForm : public AForm{
~PresidentialPardonForm(); ~PresidentialPardonForm();
PresidentialPardonForm &operator=(const PresidentialPardonForm& rhs); PresidentialPardonForm &operator=(const PresidentialPardonForm& rhs);
void execute(Bureaucrat const & executor) const;
private : private :
}; };

View File

@ -12,22 +12,27 @@
#include "RobotomyRequestForm.hpp" #include "RobotomyRequestForm.hpp"
RobotomyRequestForm() RobotomyRequestForm::RobotomyRequestForm()
{ {
} }
RobotomyRequestForm(const RobotomyRequestForm.hpp& copy) RobotomyRequestForm::RobotomyRequestForm(const RobotomyRequestForm.hpp& copy)
{ {
} }
~RobotomyRequestForm() RobotomyRequestForm::~RobotomyRequestForm()
{ {
} }
RobotomyRequestForm.hpp &operator=(const RobotomyRequestForm.hpp& rhs) RobotomyRequestForm.hpp RobotomyRequestForm::&operator=(const RobotomyRequestForm.hpp& rhs)
{
}
void RobotomyRequestForm::execute(Bureaucrat const & executor) const
{ {
} }

View File

@ -23,6 +23,9 @@ class RobotomyRequestForm : public AForm{
~RobotomyRequestForm(); ~RobotomyRequestForm();
RobotomyRequestForm &operator=(const RobotomyRequestForm& rhs); RobotomyRequestForm &operator=(const RobotomyRequestForm& rhs);
void execute(Bureaucrat const & executor) const;
private : private :
}; };

View File

@ -12,27 +12,30 @@
#include "ShrubberyCreationForm.hpp" #include "ShrubberyCreationForm.hpp"
ShrubberyCreationForm() ShrubberyCreationForm::ShrubberyCreationForm()
{ {
} }
ShrubberyCreationForm(const ShrubberyCreationForm& copy) ShrubberyCreationForm::ShrubberyCreationForm(const ShrubberyCreationForm& copy)
{ {
} }
~ShrubberyCreationForm() ShrubberyCreationForm::~ShrubberyCreationForm()
{ {
} }
ShrubberyCreationForm &operator=(const ShrubberyCreationForm& rhs) ShrubberyCreationForm &ShrubberyCreationForm::operator=(const ShrubberyCreationForm& rhs)
{ {
} }
void RobotomyRequestForm::execute(Bureaucrat const & executor) const
{
}
// _ // _
// /;-._,-.____ ,-----.__ // /;-._,-.____ ,-----.__

View File

@ -23,6 +23,9 @@ class ShrubberyCreationForm : public AForm{
~ShrubberyCreationForm(); ~ShrubberyCreationForm();
ShrubberyCreationForm &operator=(const ShrubberyCreationForm& rhs); ShrubberyCreationForm &operator=(const ShrubberyCreationForm& rhs);
void execute(Bureaucrat const & executor) const;
private : private :
}; };