aboutsummaryrefslogtreecommitdiff
path: root/cpp05/ex01/Form.hpp
blob: a2421bd16812a74ca20c781bec7ff5e05c4dfc4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   Form.hpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <charles.cabergs@gmail.com>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/14 19:19:45 by charles           #+#    #+#             */
/*   Updated: 2020/04/14 19:37:21 by charles          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#ifndef FORM_HPP
# define FORM_HPP

# include "Bureaucrat.hpp"

class Form
{
public:
    Form(Form const& other);
    void operator=(Form const& other);
    ~Form();

    Form(std::string const& name);
    std::string const& getName() const;
    bool getSigned() const;
    int getGradeSign() const;
    int getGradeExecute() const;
    void beSigned(Bureaucrat const& b);

    class GradeTooHighException : public std::exception
    {
    public:
        GradeTooHighException();
        GradeTooHighException(GradeTooHighException const& other);
        void operator=(GradeTooHighException const& other);
        ~GradeTooHighException();
        virtual char const* what() const throw();
    };

    class GradeTooLowException : public std::exception
    {
    public:
        GradeTooLowException();
        GradeTooLowException(GradeTooLowException const& other);
        void operator=(GradeTooLowException const& other);
        ~GradeTooLowException();
        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);

#endif