blob: 78828daf2b7133e4c98301922ee01011ed90b1c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Form.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/14 19:19:45 by charles #+# #+# */
/* Updated: 2020/11/17 17:09:15 by charles ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FORM_HPP
# define FORM_HPP
# include <iostream>
# include <exception>
# include "Bureaucrat.hpp"
class Bureaucrat;
class Form
{
public:
Form(Form const& other);
Form& operator=(Form const& other);
~Form();
Form(std::string const& name, int gradeSign, int gradeExecute);
std::string const& getName() const;
bool getSigned() const;
int getGradeSign() const;
int getGradeExecute() const;
void beSigned(Bureaucrat const& b);
void execute(Bureaucrat const& executor) const;
protected:
virtual void executeUnsafe() const = 0;
private:
Form();
void checkGrade();
std::string const m_name;
bool m_signed;
int const m_gradeSign;
int const m_gradeExecute;
class GradeTooHighException : public std::exception
{
public:
GradeTooHighException();
GradeTooHighException(GradeTooHighException const& other);
GradeTooHighException& operator=(GradeTooHighException const& other);
~GradeTooHighException() throw();
virtual char const* what() const throw();
};
class GradeTooLowException : public std::exception
{
public:
GradeTooLowException();
GradeTooLowException(GradeTooLowException const& other);
GradeTooLowException& operator=(GradeTooLowException const& other);
~GradeTooLowException() throw();
virtual char const* what() const throw();
};
class NoSignatureException : public std::exception
{
public:
NoSignatureException();
NoSignatureException(NoSignatureException const& other);
NoSignatureException& operator=(NoSignatureException const& other);
~NoSignatureException() throw();
virtual char const* what() const throw();
};
};
std::ostream& operator<<(std::ostream& out, Form const& f);
#endif
|