65 lines
2.0 KiB
C++
65 lines
2.0 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* AForm.hpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2025/03/08 20:10:59 by adjoly #+# #+# */
|
|
/* Updated: 2025/04/03 13:50:38 by adjoly ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
void _log(std::string emoji, std::string what, std::string who,
|
|
std::string str);
|
|
|
|
typedef unsigned char uint8_t;
|
|
|
|
#include "Bureaucrat.hpp"
|
|
|
|
class AForm {
|
|
public:
|
|
AForm(void);
|
|
AForm(std::string name, uint8_t minForSign, uint8_t minForExec);
|
|
AForm(const AForm &);
|
|
virtual ~AForm(void);
|
|
|
|
AForm &operator=(const AForm &);
|
|
|
|
class GradeTooHighException : public std::exception {
|
|
public:
|
|
virtual const char *what() const throw();
|
|
};
|
|
class GradeTooLowException : public std::exception {
|
|
public:
|
|
virtual const char *what() const throw();
|
|
};
|
|
class NotSigned : public std::exception {
|
|
public:
|
|
virtual const char *what() const throw();
|
|
};
|
|
|
|
std::string getName(void) const;
|
|
bool getSigned(void) const;
|
|
uint8_t getMinForSign(void) const;
|
|
uint8_t getMinForExec(void) const;
|
|
|
|
void beSigned(Bureaucrat);
|
|
void execute(const Bureaucrat &) const;
|
|
|
|
private:
|
|
std::string _name;
|
|
bool _signed;
|
|
const uint8_t _minForSign;
|
|
const uint8_t _minForExec;
|
|
|
|
virtual void _exec(const Bureaucrat &) const = 0;
|
|
void _gradeCheck(void) const;
|
|
};
|
|
|
|
std::ostream &operator<<(std::ostream &, AForm &);
|