aboutsummaryrefslogtreecommitdiff
path: root/cpp05/ex03/Intern.hpp
blob: 1565118bb25787873cccf79d4c0571a6d20dc0a5 (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
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   Intern.hpp                                         :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: cacharle <me@cacharle.xyz>                 +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/11/17 13:39:59 by cacharle          #+#    #+#             */
/*   Updated: 2020/12/12 12:32:05 by cacharle         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#ifndef INTERN_HPP
# define INTERN_HPP

# include "Form.hpp"
# include "ShrubberyCreationForm.hpp"
# include "PresidentialPardonForm.hpp"
# include "RobotomyRequestForm.hpp"

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

    Form *makeForm(std::string const& name, std::string const& target);

private:
    Form *makeShrubberyCreationForm(std::string const& target);
    Form *makePresidentialPardonForm(std::string const& target);
    Form *makeRobotomyRequestForm(std::string const& target);

    typedef Form* (Intern::* makeFormFunc)(std::string const&);
    struct makeFormEntry
    {
        std::string  const name;
        makeFormFunc const func;
    };
    static makeFormEntry makeFormDispatch[];
};

#endif