Form.hpp 2.0 KB

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