| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- /* ************************************************************************** */
- /* */
- /* ::: :::::::: */
- /* AForm.hpp :+: :+: :+: */
- /* +:+ +:+ +:+ */
- /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
- /* +#+#+#+#+#+ +#+ */
- /* Created: 2025/12/29 16:42:01 by bchanot #+# #+# */
- /* Updated: 2025/12/30 17:01:02 by bchanot ### ########.fr */
- /* */
- /* ************************************************************************** */
- #ifndef AFORM_HPP
- # define AFORM_HPP
- # include <iostream>
- # include <string>
- # include <cstdint>
- class Bureaucrat;
- class AForm
- {
- public:
- AForm();
- AForm( AForm const & src );
- AForm( std::string const name, uint8_t const signGrade, uint8_t const executeGradea, std::string target );
- virtual ~AForm();
- AForm & operator=( AForm const & rhs );
-
- 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 !");
- }
- };
- std::string const getName(void) const;
- uint8_t getSignGrade(void) const;
- uint8_t getExecutionGrade(void) const;
- bool getSigned(void) const;
- void beSigned(const Bureaucrat &sch);
- void execute(Bureaucrat const & executor) const;
- protected:
- virtual void action(void) const = 0;
- std::string _target;
- private:
- std::string const _name;
- uint8_t const _signGrade;
- uint8_t const _executeGrade;
- bool _signed;
- };
- std::ostream & operator<<( std::ostream & o, AForm const & i );
- #endif /* ************************************************************ AFORM_H */
|