diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-11-17 19:02:35 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-11-17 19:02:35 +0100 |
| commit | 452e6bfa7bb4bca75dc4659bf9d707101b411977 (patch) | |
| tree | f4ee27a96437d6d17a89bbbbc135ae45f9f3faae /cpp05/ex03/Bureaucrat.hpp | |
| parent | a92013c92bfcd50b0e2561280c9eaa604843ade0 (diff) | |
| download | piscine_cpp-452e6bfa7bb4bca75dc4659bf9d707101b411977.tar.gz piscine_cpp-452e6bfa7bb4bca75dc4659bf9d707101b411977.tar.bz2 piscine_cpp-452e6bfa7bb4bca75dc4659bf9d707101b411977.zip | |
Added cpp05/ex02 main, Added cpp05/ex03
Diffstat (limited to 'cpp05/ex03/Bureaucrat.hpp')
| -rw-r--r-- | cpp05/ex03/Bureaucrat.hpp | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/cpp05/ex03/Bureaucrat.hpp b/cpp05/ex03/Bureaucrat.hpp new file mode 100644 index 0000000..8e44af0 --- /dev/null +++ b/cpp05/ex03/Bureaucrat.hpp @@ -0,0 +1,71 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* Bureaucrat.hpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/04/14 18:04:32 by charles #+# #+# */ +/* Updated: 2020/11/17 13:36:56 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef BUREAUCRAT_HPP +# define BUREAUCRAT_HPP + +# include <iostream> +# include <exception> +# include "Form.hpp" + +class Form; + +class Bureaucrat +{ +public: + Bureaucrat(Bureaucrat const& other); + Bureaucrat& operator=(Bureaucrat const& other); + ~Bureaucrat(); + + Bureaucrat(std::string const& name, int grade); + + std::string const& getName() const; + int getGrade() const; + void incrementGrade(); + void decrementGrade(); + + void signForm(Form& form); + + void executeForm(Form& form); + +private: + Bureaucrat(); + void checkGrade(); + + std::string m_name; + int m_grade; + + 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(); + }; + +}; + +std::ostream& operator<<(std::ostream& out, Bureaucrat const& b); + +#endif |
