final
This commit is contained in:
parent
2fef2f8dfc
commit
d71a7eb045
|
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
"files.associations": {
|
||||||
|
"array": "cpp",
|
||||||
|
"atomic": "cpp",
|
||||||
|
"bit": "cpp",
|
||||||
|
"cctype": "cpp",
|
||||||
|
"clocale": "cpp",
|
||||||
|
"cmath": "cpp",
|
||||||
|
"compare": "cpp",
|
||||||
|
"concepts": "cpp",
|
||||||
|
"cstdarg": "cpp",
|
||||||
|
"cstddef": "cpp",
|
||||||
|
"cstdint": "cpp",
|
||||||
|
"cstdio": "cpp",
|
||||||
|
"cstdlib": "cpp",
|
||||||
|
"cwchar": "cpp",
|
||||||
|
"cwctype": "cpp",
|
||||||
|
"deque": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"exception": "cpp",
|
||||||
|
"algorithm": "cpp",
|
||||||
|
"functional": "cpp",
|
||||||
|
"iterator": "cpp",
|
||||||
|
"memory": "cpp",
|
||||||
|
"memory_resource": "cpp",
|
||||||
|
"numeric": "cpp",
|
||||||
|
"random": "cpp",
|
||||||
|
"string_view": "cpp",
|
||||||
|
"system_error": "cpp",
|
||||||
|
"tuple": "cpp",
|
||||||
|
"type_traits": "cpp",
|
||||||
|
"utility": "cpp",
|
||||||
|
"fstream": "cpp",
|
||||||
|
"initializer_list": "cpp",
|
||||||
|
"iosfwd": "cpp",
|
||||||
|
"iostream": "cpp",
|
||||||
|
"istream": "cpp",
|
||||||
|
"limits": "cpp",
|
||||||
|
"new": "cpp",
|
||||||
|
"numbers": "cpp",
|
||||||
|
"ostream": "cpp",
|
||||||
|
"stdexcept": "cpp",
|
||||||
|
"streambuf": "cpp",
|
||||||
|
"typeinfo": "cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -88,13 +88,13 @@ int main(void)
|
||||||
std::cout << "\033[34m" << std::endl << "Test signatures de formulaires" << "\033[0m" << std::endl;
|
std::cout << "\033[34m" << std::endl << "Test signatures de formulaires" << "\033[0m" << std::endl;
|
||||||
|
|
||||||
Form formulaire_id("FORMULAIRE IDENTITE", 100, 90);
|
Form formulaire_id("FORMULAIRE IDENTITE", 100, 90);
|
||||||
Bureaucrat mr_lent;
|
Bureaucrat mr_bad;
|
||||||
Bureaucrat mr_identite("MR_IDENTITE", 100);
|
Bureaucrat mr_identite("MR_IDENTITE", 100);
|
||||||
std::cout << formulaire_id;
|
std::cout << formulaire_id;
|
||||||
|
std::cout << std::endl << "Mr_bad try" << std::endl;
|
||||||
mr_lent.signForm(formulaire_id);
|
mr_bad.signForm(formulaire_id);
|
||||||
std::cout << formulaire_id;
|
std::cout << formulaire_id;
|
||||||
|
std::cout << std::endl << "MR_IDENTITE try" << std::endl;
|
||||||
mr_identite.signForm(formulaire_id);
|
mr_identite.signForm(formulaire_id);
|
||||||
std::cout << formulaire_id;
|
std::cout << formulaire_id;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class AForm
|
||||||
AForm();
|
AForm();
|
||||||
AForm(const std::string name, const int grade_si, const int grade_ex);
|
AForm(const std::string name, const int grade_si, const int grade_ex);
|
||||||
AForm(const AForm &other);
|
AForm(const AForm &other);
|
||||||
~AForm();
|
virtual ~AForm();
|
||||||
AForm &operator=(const AForm &other);
|
AForm &operator=(const AForm &other);
|
||||||
|
|
||||||
//mem
|
//mem
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
_-_
|
||||||
|
/~~ ~~\
|
||||||
|
/~~ ~~\
|
||||||
|
{ }
|
||||||
|
\ _- -_ /
|
||||||
|
~ \\ // ~
|
||||||
|
_- - | | _- _
|
||||||
|
_ - | | -_
|
||||||
|
// \\
|
||||||
|
|
@ -23,7 +23,9 @@ int main(void)
|
||||||
RobotomyRequestForm Robo_form("I am a robo form");
|
RobotomyRequestForm Robo_form("I am a robo form");
|
||||||
Bureaucrat Mr_Robo("Mr_Robo", 45);
|
Bureaucrat Mr_Robo("Mr_Robo", 45);
|
||||||
|
|
||||||
|
|
||||||
Mr_Robo.executeForm(Robo_form);
|
Mr_Robo.executeForm(Robo_form);
|
||||||
|
|
||||||
Mr_Robo.signForm(Robo_form);
|
Mr_Robo.signForm(Robo_form);
|
||||||
Mr_Robo.executeForm(Robo_form);
|
Mr_Robo.executeForm(Robo_form);
|
||||||
Mr_Robo.executeForm(Robo_form);
|
Mr_Robo.executeForm(Robo_form);
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class AForm
|
||||||
AForm();
|
AForm();
|
||||||
AForm(const std::string name, const int grade_si, const int grade_ex);
|
AForm(const std::string name, const int grade_si, const int grade_ex);
|
||||||
AForm(const AForm &other);
|
AForm(const AForm &other);
|
||||||
~AForm();
|
virtual ~AForm();
|
||||||
AForm &operator=(const AForm &other);
|
AForm &operator=(const AForm &other);
|
||||||
|
|
||||||
//mem
|
//mem
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
_-_
|
||||||
|
/~~ ~~\
|
||||||
|
/~~ ~~\
|
||||||
|
{ }
|
||||||
|
\ _- -_ /
|
||||||
|
~ \\ // ~
|
||||||
|
_- - | | _- _
|
||||||
|
_ - | | -_
|
||||||
|
// \\
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
#include "PresidentialPardonForm.hpp"
|
#include "PresidentialPardonForm.hpp"
|
||||||
#include "RobotomyRequestForm.hpp"
|
#include "RobotomyRequestForm.hpp"
|
||||||
#include "ShrubberyCreationForm.hpp"
|
#include "ShrubberyCreationForm.hpp"
|
||||||
|
#include "intern.hpp"
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
|
@ -40,5 +41,15 @@ int main(void)
|
||||||
Mr_President.signForm(President_form);
|
Mr_President.signForm(President_form);
|
||||||
Mr_President.executeForm(President_form);
|
Mr_President.executeForm(President_form);
|
||||||
|
|
||||||
|
std::cout << "\033[33m" << std::endl << "Test ex03 Intern" << "\033[0m" << std::endl;
|
||||||
|
|
||||||
|
Intern intern;
|
||||||
|
AForm *roboto;
|
||||||
|
|
||||||
|
roboto = intern.makeForm("DoYouKnowMe", "Hmmmm");
|
||||||
|
roboto = intern.makeForm("RobotomyRequestForm", "World");
|
||||||
|
|
||||||
|
std::cout << roboto->getName() << std::endl;
|
||||||
|
delete roboto;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
CXX = c++
|
CXX = c++
|
||||||
CXXFLAGS = -Wall -Wextra -Werror -std=c++98
|
CXXFLAGS = -Wall -Wextra -Werror -std=c++98
|
||||||
OBJDIR = obj
|
OBJDIR = obj
|
||||||
SOURCES = Main.cpp Bureaucrat.cpp AForm.cpp PresidentialPardonForm.cpp RobotomyRequestForm.cpp ShrubberyCreationForm.cpp
|
SOURCES = Main.cpp Bureaucrat.cpp AForm.cpp PresidentialPardonForm.cpp RobotomyRequestForm.cpp ShrubberyCreationForm.cpp intern.cpp
|
||||||
OBJECTS = $(addprefix $(OBJDIR)/, $(SOURCES:.cpp=.o))
|
OBJECTS = $(addprefix $(OBJDIR)/, $(SOURCES:.cpp=.o))
|
||||||
NAME = AForm
|
NAME = intern
|
||||||
|
|
||||||
all: $(NAME)
|
all: $(NAME)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
#include "intern.hpp"
|
||||||
|
#include "AForm.hpp"
|
||||||
|
#include "PresidentialPardonForm.hpp"
|
||||||
|
#include "RobotomyRequestForm.hpp"
|
||||||
|
#include "ShrubberyCreationForm.hpp"
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
Intern::Intern()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Intern::Intern(const Intern &other)
|
||||||
|
{
|
||||||
|
(void)other;
|
||||||
|
}
|
||||||
|
|
||||||
|
Intern &Intern::operator=(const Intern &other)
|
||||||
|
{
|
||||||
|
(void)other;
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Intern::~Intern()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
AForm *Intern::makeForm(const std::string form_name, const std::string form_target)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
std::string available_forms[] = {"ShrubberyCreationForm", "RobotomyRequestForm", "PresidentialPardonForm"};
|
||||||
|
|
||||||
|
while (i < 3 && form_name != available_forms[i])
|
||||||
|
i++;
|
||||||
|
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
std::cout << "Intern creates " << form_name << std::endl;
|
||||||
|
return (new ShrubberyCreationForm(form_target));
|
||||||
|
case 1:
|
||||||
|
std::cout << "Intern creates " << form_name << std::endl;
|
||||||
|
return (new RobotomyRequestForm(form_name));
|
||||||
|
case 2:
|
||||||
|
std::cout << "Intern creates " << form_name << std::endl;
|
||||||
|
return (new PresidentialPardonForm(form_target));
|
||||||
|
default:
|
||||||
|
std::cout << "Form is not existing" << std::endl;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef INTERN_HPP
|
||||||
|
#define INTERN_HPP
|
||||||
|
|
||||||
|
#include "AForm.hpp"
|
||||||
|
#include <exception>
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class AForm;
|
||||||
|
|
||||||
|
class Intern
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Intern();
|
||||||
|
Intern(const Intern &other);
|
||||||
|
Intern &operator=(const Intern &other);
|
||||||
|
~Intern();
|
||||||
|
|
||||||
|
AForm *makeForm(const std::string form_name, const std::string form_target);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue