cpp/cpp05/ex01/Form.hpp
2022-07-19 12:59:21 +02:00

77 lines
2.1 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Form.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/19 11:54:09 by apommier #+# #+# */
/* Updated: 2022/07/19 12:52:43 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FORM_HPP
# define FORM_HPP
# include <ostream>
# include <string>
# include <iostream>
# include "Bureaucrat.hpp"
class Bureaucrat;
class Form{
public :
Form(int signedGrade, int executionGrade, std::string name);
Form(const Form& copy);
~Form();
Form &operator=(const Form& rhs);
const std::string getName() const;
int getSignedGrade() const;
int getExecutionGrade() const;
int getIsSigned() const;
void checkGrade() const;
void beSigned(Bureaucrat &bureaucrat);
class GradeTooLowException : public std::exception
{
public :
virtual const char* what() const throw()
{
return ("Signed or Execution grade is too low\n");
}
};
class GradeTooHighException : public std::exception
{
public :
virtual const char* what() const throw()
{
return ("Signed or Execution grade is too high\n");
}
};
class signedGradeTooLowException : public std::exception
{
public :
virtual const char* what() const throw()
{
return ("Signed grade is too low\n");
}
};
private :
std::string const _name;
bool _isSigned;
int _signedGrade;
int _executionGrade;
};
std::ostream &operator<<(std::ostream &out, const Form &form);
#endif