commit before leaving school, what did i do ? i don't know

This commit is contained in:
Hugo LAMY
2022-02-28 20:37:24 +01:00
parent 4946eb3b8c
commit 130b228a2f
10 changed files with 552 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
#ifndef BUREAUCRAT_HPP
# define BUREAUCRAT_HPP
# include "color.h"
# include <iostream>
# include <string>
# include <stdexcept>
class Form;
# include "Form.hpp"
class Bureaucrat {
public:
Bureaucrat(std::string name, int grade);
Bureaucrat( Bureaucrat const & src );
~Bureaucrat();
Bureaucrat & operator=( Bureaucrat const & rhs );
std::string getName() const;
int getGrade() const;
void gradeUp();
void gradeDown();
void signForm( Form & f );
protected:
std::string const _name;
int _grade;
private:
Bureaucrat();
class GradeTooHighException : public std::exception {
const char * what() const throw();};
class GradeTooLowException : public std::exception {
const char * what() const throw();};
};
std::ostream & operator<<(std::ostream & o, Bureaucrat const & rhs);
#endif

46
d05/ex02/headers/Form.hpp Normal file
View File

@@ -0,0 +1,46 @@
#ifndef AFORM_HPP
# define AFORM_HPP
# include "color.h"
# include <iostream>
# include <string>
class Bureaucrat;
# include "Bureaucrat.hpp"
class AForm {
public:
Form( std::string name, int signedGrade, int executeGrade );
Form( Form const & src );
virtual ~Form() = 0;
Form & operator=( Form const & rhs );
std::string getName() const;
bool getSigned() const;
int getSignedGrade() const;
int getExecuteGrade() const;
virtual void beSigned( Bureaucrat const & b ) = 0;
private:
Form();
class GradeTooHighException : public std::exception {
const char * what() const throw();};
class GradeTooLowException : public std::exception {
const char * what() const throw();};
std::string const _name;
bool _signed;
int const _signedGrade;
int const _executeGrade;
};
std::ostream & operator<<(std::ostream & o, Form const & rhs);
#endif

View File

@@ -0,0 +1,34 @@
#ifndef SHRUBBERYCREATIONFORM_HPP
# define SHRUBBERYCREATIONFORM_HPP
# include "color.h"
# include <iostream>
# include <string>
# include "AForm.hpp"
class ShrubberyCreationForm : public AForm {
public:
ShrubberyCreationForm();
ShrubberyCreationForm( ShrubberyCreationForm const & src );
~ShrubberyCreationForm();
ShrubberyCreationForm & operator=( ShrubberyCreationForm const & rhs );
// std::string getFoo() const;
protected:
// std::string const _foo;
private:
// static std::string const ShrubberyCreationForm::_bar;
};
//std::ostream & operator<<(std::ostream & o, ShrubberyCreationForm const & rhs);
#endif

25
d05/ex02/headers/color.h Normal file
View File

@@ -0,0 +1,25 @@
#ifndef COLOR_H
# define COLOR_H
# define GRAY "\e[0;30m"
# define RED "\e[0;31m"
# define GREEN "\e[0;32m"
# define YELLOW "\e[0;33m"
# define BLUE "\e[0;34m"
# define PURPLE "\e[0;35m"
# define CYAN "\e[0;36m"
# define WHITE "\e[0;37m"
# define B_GRAY "\e[1;30m"
# define B_RED "\e[1;31m"
# define B_GREEN "\e[1;32m"
# define B_YELLOW "\e[1;33m"
# define B_BLUE "\e[1;34m"
# define B_PURPLE "\e[1;35m"
# define B_CYAN "\e[1;36m"
# define B_WHITE "\e[1;37m"
# define RESET "\e[0m"
#endif