CPP05
1.0
読み取り中…
検索中…
一致する文字列を見つけられません
Intern.hpp
[詳解]
1
/* ************************************************************************** */
2
/* */
3
/* ::: :::::::: */
4
/* Intern.hpp :+: :+: :+: */
5
/* +:+ +:+ +:+ */
6
/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7
/* +#+#+#+#+#+ +#+ */
8
/* Created: 2025/06/30 13:50:05 by kamitsui #+# #+# */
9
/* Updated: 2025/07/18 18:00:58 by kamitsui ### ########.fr */
10
/* */
11
/* ************************************************************************** */
12
18
#ifndef INTERN_HPP
19
#define INTERN_HPP
20
21
#include "
AForm.hpp
"
22
#include "
IFormFactory.hpp
"
23
#include "
PresidentialPardonForm.hpp
"
24
#include "
RobotomyRequestForm.hpp
"
25
#include "
ShrubberyCreationForm.hpp
"
26
#include <
string
>
27
28
// --- Default Factory for production ---
29
class
DefaultFormFactory
:
public
IFormFactory
{
30
public
:
31
virtual
AForm
*
createShrubbery
(
const
std::string
&target)
const
;
32
virtual
AForm
*
createRobotomy
(
const
std::string
&target)
const
;
33
virtual
AForm
*
createPresidential
(
const
std::string
&target)
const
;
34
};
35
36
class
Intern
{
37
private
:
38
IFormFactory
*_factory;
39
bool
_ownsFactory;
40
41
public
:
42
// Orthodox Canonical Form
43
Intern
(
IFormFactory
*factory);
44
Intern
();
45
~Intern
();
46
47
// Member function
48
AForm
*
makeForm
(
const
std::string
&formName,
const
std::string
&formTarget);
49
50
// Exception for unknown form types
51
class
UnknownFormException
:
public
std::exception
{
52
public
:
53
virtual
const
char
*
what
()
const
throw
();
54
};
55
56
private
:
57
Intern
(
const
Intern
&other);
58
Intern
&operator=(
const
Intern
&other);
59
};
60
61
#endif
IFormFactory.hpp
std::string
AForm
An abstract base class for forms.
Definition
AForm.hpp:34
DefaultFormFactory
Definition
Intern.hpp:29
DefaultFormFactory::createPresidential
virtual AForm * createPresidential(const std::string &target) const
Definition
Intern.cpp:20
DefaultFormFactory::createShrubbery
virtual AForm * createShrubbery(const std::string &target) const
Definition
Intern.cpp:16
DefaultFormFactory::createRobotomy
virtual AForm * createRobotomy(const std::string &target) const
Definition
Intern.cpp:19
IFormFactory
Definition
IFormFactory.hpp:20
Intern::UnknownFormException
Definition
Intern.hpp:51
Intern::UnknownFormException::what
virtual const char * what() const
Definition
Intern.cpp:68
Intern
Definition
Intern.hpp:36
Intern::makeForm
AForm * makeForm(const std::string &formName, const std::string &formTarget)
Definition
Intern.cpp:45
Intern::~Intern
~Intern()
Definition
Intern.cpp:37
Intern::Intern
Intern()
Definition
Intern.cpp:33
AForm.hpp
Defines the abstract base class AForm for all specific forms.
PresidentialPardonForm.hpp
Defines the PresidentialPardonForm class.
RobotomyRequestForm.hpp
Defines the RobotomyRequestForm class.
ShrubberyCreationForm.hpp
Defines the ShrubberyCreationForm class.
std::exception
string
ex03
Intern.hpp
構築:
1.9.8