CPP05/ex02/inc/AForm.hpp

56 lines
1.4 KiB
C++

#pragma once
#include <exception>
#include <iostream>
#include <string>
#include "Bureaucrat.hpp"
class AForm
{
private:
const std::string _name;
bool _isSigned;
const int _signGrade;
const int _executeGrade;
public:
AForm() = delete;
AForm(std::string name, int signGrade, int executeGrade);
AForm(const AForm &other);
~AForm();
AForm &operator=(const AForm &other) = delete;
const std::string &getName() const;
bool getIsSigned() const;
int getSignGrade() const;
int getExecuteGrade() const;
void beSigned(const Bureaucrat &bureaucrat);
bool isExecutable(const Bureaucrat &executor) const;
virtual void execute(const Bureaucrat &executor)
const = 0; // Pure virtual function, making AForm an abstract class
class GradeTooHighException : public std::exception
{
public:
const char *what() const throw();
};
class GradeTooLowException : public std::exception
{
public:
const char *what() const throw();
};
class FormAlreadySignedException : public std::exception
{
public:
const char *what() const throw();
};
class FormNotSignedException : public std::exception
{
public:
const char *what() const throw();
};
};
std::ostream &operator<<(std::ostream &os, const AForm &form);