CPP05 1.0
読み取り中…
検索中…
一致する文字列を見つけられません
ControllableFailingFactory.cpp
[詳解]
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* ControllableFailingFactory.cpp :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: kamitsui <kamitsui@student.42tokyo.jp> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2025/07/18 19:21:56 by kamitsui #+# #+# */
9/* Updated: 2025/07/18 19:36:57 by kamitsui ### ########.fr */
10/* */
11/* ************************************************************************** */
12
21
22// Defines and initializes the entity of a static member variable.
23int ControllableFailingFactory::failCounter = -1;
24
25void ControllableFailingFactory::setFailAfter(int count) { failCounter = count; }
26
28 if (failCounter == 0) {
29 failCounter = -1;
30 throw std::bad_alloc();
31 }
32 if (failCounter > 0) {
33 failCounter--;
34 }
35}
36
43 return new RobotomyRequestForm(target);
44}
An abstract base class for forms.
Definition AForm.hpp:34
virtual AForm * createRobotomy(const std::string &target) const
virtual AForm * createPresidential(const std::string &target) const
virtual AForm * createShrubbery(const std::string &target) const
A concrete form that grants a presidential pardon.
A concrete form that simulates a robotomy attempt.
A concrete form that creates a file with ASCII trees.
Defines the PresidentialPardonForm class.
Defines the RobotomyRequestForm class.
Defines the ShrubberyCreationForm class.