d05 ex02 ok pour Shrubbery form

This commit is contained in:
hugogogo
2022-03-04 20:58:15 +01:00
parent 130b228a2f
commit 0a5827f3a1
14 changed files with 297 additions and 194 deletions

View File

@@ -12,35 +12,43 @@ class AForm {
public:
Form( std::string name, int signedGrade, int executeGrade );
Form( Form const & src );
virtual ~Form() = 0;
Form & operator=( Form const & rhs );
AForm( std::string name, std::string target, int signedGrade, int executeGrade );
AForm( AForm const & src );
virtual ~AForm() = 0;
AForm & operator=( AForm const & rhs );
std::string getName() const;
std::string getTarget() const;
bool getSigned() const;
int getSignedGrade() const;
int getExecuteGrade() const;
virtual void beSigned( Bureaucrat const & b ) = 0;
void beSigned( Bureaucrat const & b );
void execute(Bureaucrat const & executor) const;
virtual void formAction() const = 0;
private:
Form();
AForm();
protected:
class GradeTooHighException : public std::exception {
const char * what() const throw();};
class GradeTooLowException : public std::exception {
const char * what() const throw();};
class NotSignedException : public std::exception {
const char * what() const throw();};
std::string const _name;
std::string const _target;
bool _signed;
int const _signedGrade;
int const _executeGrade;
};
std::ostream & operator<<(std::ostream & o, Form const & rhs);
std::ostream & operator<<(std::ostream & o, AForm const & rhs);
#endif

View File

@@ -6,8 +6,8 @@
# include <string>
# include <stdexcept>
class Form;
# include "Form.hpp"
class AForm;
# include "AForm.hpp"
class Bureaucrat {
@@ -24,7 +24,8 @@ public:
void gradeUp();
void gradeDown();
void signForm( Form & f );
void signForm( AForm & f );
void executeForm( AForm const & form );
protected:

View File

@@ -4,6 +4,7 @@
# include "color.h"
# include <iostream>
# include <string>
# include <fstream>
# include "AForm.hpp"
@@ -11,24 +12,21 @@ class ShrubberyCreationForm : public AForm {
public:
ShrubberyCreationForm();
ShrubberyCreationForm( std::string target );
ShrubberyCreationForm( ShrubberyCreationForm const & src );
~ShrubberyCreationForm();
ShrubberyCreationForm & operator=( ShrubberyCreationForm const & rhs );
// std::string getFoo() const;
void formAction() const;
protected:
// std::string const _foo;
// std::string getTarget() const;
private:
// static std::string const ShrubberyCreationForm::_bar;
ShrubberyCreationForm();
// std::string const _target;
};
//std::ostream & operator<<(std::ostream & o, ShrubberyCreationForm const & rhs);
#endif