58 lines
1.1 KiB
C++
58 lines
1.1 KiB
C++
#ifndef AFORM_HPP
|
|
#define AFORM_HPP
|
|
|
|
#include <exception>
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
class Bureaucrat;
|
|
|
|
class AForm
|
|
{
|
|
private:
|
|
const std::string _name;
|
|
bool _signed;
|
|
const int _grade_ex;
|
|
const int _grade_si;
|
|
virtual void performAction() const = 0;
|
|
|
|
public:
|
|
//cons
|
|
AForm();
|
|
AForm(const std::string name, const int grade_si, const int grade_ex);
|
|
AForm(const AForm &other);
|
|
virtual ~AForm();
|
|
AForm &operator=(const AForm &other);
|
|
|
|
//mem
|
|
void beSigned(const Bureaucrat &bureaucrat);
|
|
std::string getName() const;
|
|
bool getSigned() const;
|
|
int getExecuteGrade() const;
|
|
int getSignGrade() const;
|
|
void setIsSigned(bool i_signed);
|
|
void execute(const Bureaucrat &executor) const;
|
|
|
|
//exept
|
|
class GradeTooLowException : public std::exception
|
|
{
|
|
public:
|
|
virtual const char *what() const throw();
|
|
};
|
|
|
|
class GradeTooHighException : public std::exception
|
|
{
|
|
public:
|
|
virtual const char *what() const throw();
|
|
};
|
|
|
|
class IsNotSignedException : public std::exception
|
|
{
|
|
public:
|
|
virtual const char *what() const throw();
|
|
};
|
|
};
|
|
std::ostream &operator<<(std::ostream &os, AForm const &AForm);
|
|
|
|
#endif
|