| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* Bureaucrat.hpp :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2025/12/26 17:51:13 by bchanot #+# #+# */
- /* Updated: 2025/12/30 18:23:58 by bchanot ### ########.fr */
- /* */
- /* ************************************************************************** */
- #ifndef BUREAUCRAT_HPP
- # define BUREAUCRAT_HPP
- # include <iostream>
- # include <string>
- # include <cstdint>
- class AForm;
- class Bureaucrat
- {
- public:
- Bureaucrat();
- Bureaucrat( Bureaucrat const & src );
- Bureaucrat( std::string const name, u_int8_t grade );
- ~Bureaucrat();
- Bureaucrat &operator=( Bureaucrat const & rhs );
- Bureaucrat &operator++();
- Bureaucrat &operator--();
- class GradeTooHighException : public std::exception {
- public:
- virtual const char *what() const throw() {
- return ("The grade specified is too high !");
- }
- };
-
- class GradeTooLowException : public std::exception {
- public:
- virtual const char *what() const throw() {
- return ("The grade specified is too low !");
- }
- };
- uint8_t getGrade(void) const;
- std::string getName(void) const;
- void signForm(AForm *form);
- void decrementGrade(void);
- void incrementGrade(void);
- void executeForm(AForm const & form) const;
- private:
- std::string _name;
- uint8_t _grade;
- };
- std::ostream & operator<<( std::ostream & o, Bureaucrat const & i );
- #endif /* ****************************************************** BUREAUCRAT_H */
|