aboutsummaryrefslogtreecommitdiff
path: root/cpp05/ex01/Form.hpp
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-11-17 13:52:48 +0100
committerCharles Cabergs <me@cacharle.xyz>2020-11-17 13:52:48 +0100
commit331c3596660fed6c8b04fdfd0a89435ccffaaf20 (patch)
tree4196c94d9084a3d0ed45f3ec798d713639cbfc8a /cpp05/ex01/Form.hpp
parent4eecb32ffcf48c42672782fbcd53781a22e95ebf (diff)
downloadpiscine_cpp-331c3596660fed6c8b04fdfd0a89435ccffaaf20.tar.gz
piscine_cpp-331c3596660fed6c8b04fdfd0a89435ccffaaf20.tar.bz2
piscine_cpp-331c3596660fed6c8b04fdfd0a89435ccffaaf20.zip
Fixing cpp05/ex00-02
Diffstat (limited to 'cpp05/ex01/Form.hpp')
-rw-r--r--cpp05/ex01/Form.hpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/cpp05/ex01/Form.hpp b/cpp05/ex01/Form.hpp
index 3be16f6..1ac76d1 100644
--- a/cpp05/ex01/Form.hpp
+++ b/cpp05/ex01/Form.hpp
@@ -6,23 +6,27 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/14 19:19:45 by charles #+# #+# */
-/* Updated: 2020/10/19 13:16:01 by cacharle ### ########.fr */
+/* Updated: 2020/11/17 11:39:54 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FORM_HPP
# define FORM_HPP
+# include <iostream>
+# include <exception>
# include "Bureaucrat.hpp"
+class Bureaucrat;
+
class Form
{
public:
Form(Form const& other);
- void operator=(Form const& other);
+ Form& operator=(Form const& other);
~Form();
- Form(std::string const& name);
+ Form(std::string const& name, int gradeSign, int gradeExecute);
std::string const& getName() const;
bool getSigned() const;
@@ -31,13 +35,22 @@ public:
void beSigned(Bureaucrat const& b);
+private:
+ Form();
+ void checkGrade();
+
+ std::string const m_name;
+ bool m_signed;
+ int const m_gradeSign;
+ int const m_gradeExecute;
+
class GradeTooHighException : public std::exception
{
public:
GradeTooHighException();
GradeTooHighException(GradeTooHighException const& other);
GradeTooHighException& operator=(GradeTooHighException const& other);
- ~GradeTooHighException();
+ ~GradeTooHighException() throw();
virtual char const* what() const throw();
};
@@ -47,17 +60,9 @@ public:
GradeTooLowException();
GradeTooLowException(GradeTooLowException const& other);
GradeTooLowException& operator=(GradeTooLowException const& other);
- ~GradeTooLowException();
+ ~GradeTooLowException() throw();
virtual char const* what() const throw();
};
-
-private:
- Form();
-
- std::string const m_name;
- bool m_signed;
- int const m_gradeSign;
- int const m_gradeExecute;
};
std::ostream& operator<<(std::ostream& out, Form const& f);