Files
cpp05/ex02/AForm.hpp
2025-08-02 13:51:40 +02:00

66 lines
2.0 KiB
C++

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* AForm.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/06/27 13:36:33 by mmoussou #+# #+# */
/* Updated: 2025/08/02 13:13:41 by mmoussou ### ########.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 &);
~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 execute(const Bureaucrat &) const;
void beSigned(Bureaucrat);
private:
std::string _name;
bool _signed;
const uint8_t _minForSign;
const uint8_t _minForExec;
void _gradeCheck(void) const;
virtual void _exec(const Bureaucrat &) const = 0;
};
std::ostream &operator<<(std::ostream &, AForm &);