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.
 
 

54 lines
1.9 KiB

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Bureaucrat.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: narnaud <narnaud@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/24 13:06:55 by narnaud #+# #+# */
/* Updated: 2022/06/27 14:47:21 by narnaud ### ########.fr */
/* */
/* ************************************************************************** */
#pragma once
#include "Form.hpp"
#include <string>
#include <iostream>
#include <stdexcept>
using std::cout;
using std::endl;
using std::string;
class Form;
class Bureaucrat{
const string _name;
int _grade;
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 ();
};
Bureaucrat(void);
Bureaucrat(const string name, int grade)
throw (GradeTooHighException, GradeTooLowException);
Bureaucrat(Bureaucrat const & src);
~Bureaucrat(void);
Bureaucrat & operator= (Bureaucrat const & src);
const string getName(void) const;
int getGrade(void) const;
void incrGrade(int diff = 1) throw (GradeTooHighException);
void decrGrade(int diff = 1) throw (GradeTooLowException);
void signForm(Form &form) const;
void executeForm(const Form &form) const;
};
std::ostream &operator<< (std::ostream &out, Bureaucrat const &b);