CPP05 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
Form.hpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* Form.hpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/06/26 10:32:38 by kamitsui #+# #+# */
9/* Updated: 2025/06/29 06:11:53 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
18#ifndef FORM_HPP
19#define FORM_HPP
20
21#include "Bureaucrat.hpp"
22#include <iostream>
23#include <stdexcept>
24#include <string>
25
26class Bureaucrat; // Forward declaration
27
32class Form {
33
34 private:
35 const std::string _name;
36 bool _isSigned;
37 const int _gradeToSign;
38 const int _gradeToExecute;
39 Form(); // Private default constructor
40
41 public:
42 // Orthodox Canonical Form
43 Form(const std::string &name, int gradeToSign, int gradeToExecute);
44 Form(const Form &other);
45 Form &operator=(const Form &other);
46 ~Form();
47
48 // Getters
49 const std::string &getName() const;
50 bool getIsSigned() const;
51 int getGradeToSign() const;
52 int getGradeToExecute() const;
53
54 // Member function
55 void beSigned(const Bureaucrat &bureaucrat);
56
57 // Exception Classes
59 public:
60 virtual const char *what() const throw();
61 };
62
64 public:
65 virtual const char *what() const throw();
66 };
67};
68
69std::ostream &operator<<(std::ostream &os, const Form &form);
70
71#endif
std::ostream & operator<<(std::ostream &os, const Form &form)
Overloads the << operator to print Form information.
Definition Form.cpp:106
Represents a bureaucrat with a name and a grade.
virtual const char * what() const
Definition Form.cpp:91
virtual const char * what() const
Definition Form.cpp:97
Represents a form that needs to be signed and executed.
Definition Form.hpp:32
void beSigned(const Bureaucrat &bureaucrat)
Sets the form's status to signed if the bureaucrat's grade is sufficient.
Definition Form.cpp:79
bool getIsSigned() const
Definition Form.cpp:69
Form & operator=(const Form &other)
Assignment operator for Form. Only the signed status is copied as other members are const.
Definition Form.cpp:54
const std::string & getName() const
Definition Form.cpp:68
~Form()
Destroys the Form object.
Definition Form.cpp:65
int getGradeToExecute() const
Definition Form.cpp:71
int getGradeToSign() const
Definition Form.cpp:70
Defines the Bureaucrat class, updated to execute AForms.