#include "Form.hpp" #include "Bureaucrat.hpp" Form::Form() : _name("Default"), _signed(false), _grade_ex(150), _grade_si(150) { } Form::Form(const std::string name, const int grade_si, const int grade_ex) : _name(name), _signed(false), _grade_ex(grade_ex), _grade_si(grade_si) { } Form::Form(const Form &other) : _name(other._name), _signed(other._signed), _grade_ex(other._grade_ex), _grade_si(other._grade_si) { } Form::~Form() { } std::string Form::getName() const { return (_name); } bool Form::getSigned() const { return (_signed); } int Form::getExecuteGrade() const { return (_grade_ex); } int Form::getSignGrade() const { return (_grade_si); } void Form::beSigned(const Bureaucrat &bureaucrat) { if (bureaucrat.getGrade() <= _grade_si) _signed = true; else throw GradeTooLowException(); } Form &Form::operator=(const Form &other) { _signed = other._signed; return (*this); } const char *Form::GradeTooHighException::what() const throw() { return ("Grade too high!"); } const char *Form::GradeTooLowException::what() const throw() { return ("Grade too low!"); } std::ostream &operator<<(std::ostream &os, Form const &form) { os << "Name: " << form.getName() << " Signed: " << form.getSigned() << " SiGrade: " << form.getSignGrade() << " ExGrade: " << form.getExecuteGrade() << std::endl; return (os); }