cpp-partie-2/cpp05/ex02/Bureaucrat.hpp
2024-02-20 15:37:45 +01:00

66 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/16 18:26:55 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 Bureaucrat
{
public:
class GradeTooHighException : public std::exception
{
public:
const char* what() const throw() override;
};
class GradeTooLowException : public std::exception
{
public:
const char* what() const throw() override;
};
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(Form& form);
private:
const std::string name;
int grade;
};
std::ostream& operator<<(std::ostream& os, const Bureaucrat& bureaucrat);
#endif