mirror of
https://github.com/Ladebeze66/cpp-partie-2.git
synced 2025-12-16 14:07:54 +01:00
69 lines
1.9 KiB
C++
69 lines
1.9 KiB
C++
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* Bureaucrat.hpp :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/02/11 12:57:28 by fgras-ca #+# #+# */
|
|
/* Updated: 2024/02/25 16:18:19 by fgras-ca ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef BUREAUCRAT_HPP
|
|
#define BUREAUCRAT_HPP
|
|
|
|
#include <string>
|
|
#include <exception>
|
|
#include <iostream>
|
|
#include "AForm.hpp"
|
|
|
|
#define RESET "\033[0m"
|
|
#define BLACK "\033[30m"
|
|
#define RED "\033[31m"
|
|
#define GREEN "\033[32m"
|
|
#define YELLOW "\033[33m"
|
|
#define BLUE "\033[34m"
|
|
#define MAGENTA "\033[35m"
|
|
#define CYAN "\033[36m"
|
|
#define WHITE "\033[37m"
|
|
|
|
class AForm;
|
|
|
|
class Bureaucrat
|
|
{
|
|
public:
|
|
class GradeTooHighException : public std::exception
|
|
{
|
|
public:
|
|
virtual const char* what() const throw();
|
|
};
|
|
|
|
class GradeTooLowException : public std::exception
|
|
{
|
|
public:
|
|
virtual const char* what() const throw();
|
|
};
|
|
|
|
Bureaucrat();
|
|
Bureaucrat(const std::string& name, int grade);
|
|
Bureaucrat(const Bureaucrat& other);
|
|
Bureaucrat& operator=(const Bureaucrat& other);
|
|
~Bureaucrat();
|
|
|
|
std::string getName() const;
|
|
int getGrade() const;
|
|
void incrementGrade();
|
|
void decrementGrade();
|
|
void signForm(AForm& form);
|
|
virtual void executeForm(AForm const &form);
|
|
|
|
private:
|
|
const std::string name;
|
|
int grade;
|
|
};
|
|
|
|
std::ostream& operator<<(std::ostream& os, const Bureaucrat& bureaucrat);
|
|
|
|
#endif
|