You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
/* ************************************************************************** */
|
|
|
|
/* */
|
|
|
|
/* ::: :::::::: */
|
|
|
|
/* Form.hpp :+: :+: :+: */
|
|
|
|
/* +:+ +:+ +:+ */
|
|
|
|
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
|
|
|
|
/* +#+#+#+#+#+ +#+ */
|
|
|
|
/* Created: 2022/06/26 15:47:12 by narnaud #+# #+# */
|
|
|
|
/* Updated: 2022/06/27 14:56:40 by narnaud ### ########.fr */
|
|
|
|
/* */
|
|
|
|
/* ************************************************************************** */
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Bureaucrat.hpp"
|
|
|
|
#include <fstream>
|
|
|
|
#include <unistd.h>
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
class Bureaucrat;
|
|
|
|
|
|
|
|
class Form {
|
|
|
|
const string _name;
|
|
|
|
const int _signGrade;
|
|
|
|
const int _exeGrade;
|
|
|
|
bool _isSigned;
|
|
|
|
|
|
|
|
public:
|
|
|
|
class GradeTooHighException : virtual public std::exception {
|
|
|
|
public:
|
|
|
|
const char *what(void) const throw();
|
|
|
|
};
|
|
|
|
class GradeTooLowException : virtual public std::exception {
|
|
|
|
public:
|
|
|
|
const char *what(void) const throw();
|
|
|
|
};
|
|
|
|
virtual ~Form(void) = 0;
|
|
|
|
const string getName(void) const;
|
|
|
|
int getSignGrade(void) const;
|
|
|
|
int getExeGrade(void) const;
|
|
|
|
int beSigned(const Bureaucrat &signer) throw(GradeTooLowException);
|
|
|
|
int execute(Bureaucrat const &executor) const throw(GradeTooLowException);
|
|
|
|
virtual void run(void) const = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Form(void);
|
|
|
|
Form(const string name, const int signGrade, const int exeGrade,
|
|
|
|
const string target) throw(GradeTooHighException, GradeTooLowException);
|
|
|
|
Form &operator=(Form const &f);
|
|
|
|
Form(Form const &f);
|
|
|
|
const string _target;
|
|
|
|
};
|
|
|
|
|
|
|
|
std::ostream &operator<<(std::ostream &out, const Form &f);
|