CPP05/ex00/inc/Bureaucrat.hpp
whaffman bf2416c5c7 Add Bureaucrat and Form classes with color-coded output
- Implemented Bureaucrat class with constructors, destructors, and operator overloads.
- Added Form class with constructors, destructors, and methods for signing.
- Introduced color definitions in colors.h for enhanced console output.
- Integrated color-coded messages in Bureaucrat and Form methods for better visibility.
- Developed main function to demonstrate functionality and exception handling for Bureaucrat and Form.
2025-06-24 13:36:11 +02:00

45 lines
985 B
C++

#pragma once
#include <exception>
#include <iostream>
#include <string>
#define HIGHEST_GRADE 1
#define LOWEST_GRADE 150
class Bureaucrat
{
private:
const std::string _name;
int _grade;
public:
Bureaucrat() = delete;
Bureaucrat(std::string name, int grade);
Bureaucrat(Bureaucrat &other);
~Bureaucrat();
Bureaucrat &operator=(Bureaucrat &other) = delete;
Bureaucrat &operator++(); // Pre-increment
Bureaucrat operator++(int); // Post-increment
Bureaucrat &operator--(); // Pre-decrement
Bureaucrat operator--(int); // Post-decrement
int getGrade() const;
const std::string getName() const;
class GradeTooHighException : public std::exception
{
public:
const char *what() const throw();
};
class GradeTooLowException : public std::exception
{
public:
const char *what() const throw();
};
};
std::ostream &operator<<(std::ostream &os, const Bureaucrat &bureaucrat);