CPP05 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
Bureaucrat.hpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* Bureaucrat.hpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/06/30 12:24:05 by kamitsui #+# #+# */
9/* Updated: 2025/07/02 18:47:16 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
18#ifndef BUREAUCRAT_HPP
19#define BUREAUCRAT_HPP
20
21#include "AForm.hpp"
22#include <iostream>
23#include <stdexcept>
24#include <string>
25
26class AForm;
27
32class Bureaucrat {
33
34 private:
35 const std::string _name;
36 int _grade;
37 Bureaucrat();
38
39 public:
40 // Orthodox Canonical Form
41 Bureaucrat(const std::string &name, int grade);
42 Bureaucrat(const Bureaucrat &other);
45
46 // Getters
47 const std::string &getName() const;
48 int getGrade() const;
49
50 // Member functions
53 void signForm(AForm &form);
54 void executeForm(AForm const &form);
55
56 // Exception Classes
58 public:
59 virtual const char *what() const throw();
60 };
61
62 class GradeTooLowException : public std::exception {
63 public:
64 virtual const char *what() const throw();
65 };
66};
67
68std::ostream &operator<<(std::ostream &os, const Bureaucrat &bureaucrat);
69
70#endif
An abstract base class for forms.
Definition AForm.hpp:34
virtual const char * what() const
virtual const char * what() const
Represents a bureaucrat with a name and a grade.
void incrementGrade()
void decrementGrade()
Bureaucrat(const std::string &name, int grade)
void signForm(Form &form)
Attempts to sign a form. Calls the form's beSigned method and prints the result.
int getGrade() const
void executeForm(AForm const &form)
Attempts to execute a form. Calls the form's execute method and prints the result.
Bureaucrat & operator=(const Bureaucrat &other)
const std::string & getName() const
Bureaucrat(const Bureaucrat &other)
Defines the abstract base class AForm for all specific forms.