feat: adding the finished ex03
This commit is contained in:
parent
b9c98dffda
commit
9771c8de4a
15 changed files with 965 additions and 0 deletions
68
cpp05/ex03/Form.hpp
Normal file
68
cpp05/ex03/Form.hpp
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* Form.hpp :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/03/17 14:20:06 by rparodi #+# #+# */
|
||||
/* Updated: 2025/03/19 19:57:45 by rparodi ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef AFORM_HPP
|
||||
#define AFORM_HPP
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include "Form.hpp"
|
||||
|
||||
class Bureaucrat;
|
||||
|
||||
class Form {
|
||||
public:
|
||||
Form();
|
||||
Form(std::string const name, int execute, int sign);
|
||||
Form(Form const ©);
|
||||
Form& operator=(Form const &assign);
|
||||
~Form();
|
||||
class GradeTooHighException : public std::exception {
|
||||
virtual const char *what() const throw() {
|
||||
return ("Error:\n> Grade is too high (have to be lower than 1)");
|
||||
}
|
||||
};
|
||||
class GradeTooLowException : public std::exception {
|
||||
virtual const char *what() const throw() {
|
||||
return ("Error:\n> Grade is too low (have to be higher than 150)");
|
||||
}
|
||||
};
|
||||
class FormForSupperior: public std::exception {
|
||||
virtual const char *what() const throw() {
|
||||
return ("the bureaucrat grade is too low !");
|
||||
}
|
||||
};
|
||||
class FormAlreadySigned: public std::exception {
|
||||
virtual const char *what() const throw() {
|
||||
return ("form is already signed !");
|
||||
}
|
||||
};
|
||||
|
||||
void beSigned(Bureaucrat const &bureaucrat) const;
|
||||
virtual void execute(Bureaucrat const &executor) const;
|
||||
int getExecute() const;
|
||||
int getSign() const;
|
||||
std::string getName() const;
|
||||
bool isSigned() const;
|
||||
void setSign(int new_sign);
|
||||
void setExecute(int new_exec);
|
||||
private:
|
||||
std::string _name;
|
||||
mutable bool _signed;
|
||||
int _to_execute;
|
||||
int _to_sign;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& output, Form const &Form);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue