cpp/cpp05/ex02/AForm.hpp
Alexandre POMMIER 0b636410b3 add test
2022-08-03 13:23:09 +02:00

77 lines
2.1 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* AForm.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 AFORM_HPP
# define AFORM_HPP
# include <ostream>
# include <string>
# include <iostream>
# include "Bureaucrat.hpp"
class Bureaucrat;
class AForm{
public :
AForm(int signedGrade, int executionGrade, std::string name);
AForm(const AForm& copy);
virtual ~AForm() = 0;
AForm &operator=(const AForm& 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 AForm &Aform);
#endif