Bureaucrat.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* Bureaucrat.hpp :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2025/12/26 17:51:13 by bchanot #+# #+# */
  9. /* Updated: 2025/12/30 14:00:54 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #ifndef BUREAUCRAT_HPP
  13. # define BUREAUCRAT_HPP
  14. # include <iostream>
  15. # include <string>
  16. # include <cstdint>
  17. class Form;
  18. class Bureaucrat
  19. {
  20. public:
  21. Bureaucrat();
  22. Bureaucrat( Bureaucrat const & src );
  23. Bureaucrat( std::string const name, u_int8_t grade );
  24. ~Bureaucrat();
  25. Bureaucrat &operator=( Bureaucrat const & rhs );
  26. Bureaucrat &operator++();
  27. Bureaucrat &operator--();
  28. class GradeTooHighException : public std::exception {
  29. public:
  30. virtual const char *what() const throw() {
  31. return ("The grade specified is too high !");
  32. }
  33. };
  34. class GradeTooLowException : public std::exception {
  35. public:
  36. virtual const char *what() const throw() {
  37. return ("The grade specified is too low !");
  38. }
  39. };
  40. uint8_t getGrade(void) const;
  41. std::string getName(void) const;
  42. void signForm(Form &form);
  43. void decrementGrade(void);
  44. void incrementGrade(void);
  45. private:
  46. std::string _name;
  47. uint8_t _grade;
  48. };
  49. std::ostream & operator<<( std::ostream & o, Bureaucrat const & i );
  50. #endif /* ****************************************************** BUREAUCRAT_H */