cpp/cpp05/ex02/Bureaucrat.hpp
Alexandre POMMIER 04eaf3c332 little step ex05
2022-08-04 19:46:56 +02:00

66 lines
1.9 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Bureaucrat.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/07/18 21:34:43 by apommier #+# #+# */
/* Updated: 2022/08/04 15:26:47 by apommier ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef BUREAUCRAT_HPP
# define BUREAUCRAT_HPP
# include <ostream>
# include <string>
# include <iostream>
# include "AForm.hpp"
class AForm;
class Bureaucrat{
public:
Bureaucrat(int grade, std::string name);
Bureaucrat(const Bureaucrat& copy);
~Bureaucrat();
Bureaucrat &operator=(const Bureaucrat& rhs);
const std::string getName() const;
int getGrade() const;
void upGrade();
void downGrade();
void checkGrade() const;
void signForm(AForm form);
void executeForm(AForm const & form) const;
class GradeTooLowException : public std::exception
{
public :
virtual const char* what() const throw()
{
return ("Bureaucrat grade is too low\n");
}
};
class GradeTooHighException : public std::exception
{
public :
virtual const char* what() const throw()
{
return ("Bureaucrat grade is too high\n");
}
};
private:
std::string const _name;
int _grade;
};
std::ostream &operator<<(std::ostream &out, const Bureaucrat &bureaucrat);
#endif