diff --git a/cpp01/ex03/HumanA.cpp b/cpp01/ex03/HumanA.cpp index baa6e09..7987e8b 100644 --- a/cpp01/ex03/HumanA.cpp +++ b/cpp01/ex03/HumanA.cpp @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/06/10 21:20:34 by apommier #+# #+# */ -/* Updated: 2022/06/19 12:36:43 by apommier ### ########.fr */ +/* Updated: 2022/07/23 12:37:20 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,7 +19,6 @@ HumanA::HumanA(const std::string name, Weapon &Weapon): _Weapon(Weapon) HumanA::~HumanA(void) { - } void HumanA::attack(void) diff --git a/cpp01/ex03/Weapon.cpp b/cpp01/ex03/Weapon.cpp index 90a8901..bb75fb5 100644 --- a/cpp01/ex03/Weapon.cpp +++ b/cpp01/ex03/Weapon.cpp @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/06/10 21:13:13 by apommier #+# #+# */ -/* Updated: 2022/06/19 15:54:48 by apommier ### ########.fr */ +/* Updated: 2022/07/23 12:37:01 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,24 +23,12 @@ Weapon::Weapon(std::string type) : _type(type){ Weapon::~Weapon() { return; } -/*Weapon::Weapon(std::string name): _type(name) { - -} - -Weapon::~Weapon() { - -}*/ const std::string& Weapon::getType(void) const { return (this->_type); } -/*void Weapon::setType(const std::string type) -{ - this->_type = type; -}*/ - void Weapon::setType(std::string newType) { _type = newType; } \ No newline at end of file diff --git a/cpp01/ex03/Weapon.hpp b/cpp01/ex03/Weapon.hpp index ab616f1..f1debba 100644 --- a/cpp01/ex03/Weapon.hpp +++ b/cpp01/ex03/Weapon.hpp @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/06/10 19:43:13 by apommier #+# #+# */ -/* Updated: 2022/06/19 15:55:10 by apommier ### ########.fr */ +/* Updated: 2022/07/23 12:36:35 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -25,7 +25,6 @@ class Weapon { Weapon(std::string type); ~Weapon(); const std::string& getType( void ) const; - //void setType(const std::string type); void setType(std::string newType); private: diff --git a/cpp01/ex03/main.cpp b/cpp01/ex03/main.cpp index 0790270..96528c4 100644 --- a/cpp01/ex03/main.cpp +++ b/cpp01/ex03/main.cpp @@ -6,7 +6,7 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/06/10 20:12:10 by apommier #+# #+# */ -/* Updated: 2022/06/16 22:57:13 by apommier ### ########.fr */ +/* Updated: 2022/07/23 12:42:17 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ @@ -30,5 +30,15 @@ int main() club.setType("some other type of club"); jim.attack(); } - return 0; + { + Weapon club = Weapon("crude spiked club"); + HumanB jim("Jim"); + jim.setWeapon(club); + + HumanB john(jim); + john.attack(); + club.setType("some other type of club"); + john.attack(); + } + return (0); } \ No newline at end of file diff --git a/cpp05/ex02/Form.cpp b/cpp05/ex02/AForm.cpp similarity index 61% rename from cpp05/ex02/Form.cpp rename to cpp05/ex02/AForm.cpp index 63c8b19..4ee7671 100644 --- a/cpp05/ex02/Form.cpp +++ b/cpp05/ex02/AForm.cpp @@ -1,7 +1,7 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* Form.cpp :+: :+: :+: */ +/* AForm.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ @@ -10,9 +10,9 @@ /* */ /* ************************************************************************** */ -#include "Form.hpp" +#include "AForm.hpp" -Form::Form(int signedGrade, int executionGrade, std::string name) : _name(name) +AForm::AForm(int signedGrade, int executionGrade, std::string name) : _name(name) { this->_signedGrade = signedGrade; this->_executionGrade = executionGrade; @@ -20,17 +20,17 @@ Form::Form(int signedGrade, int executionGrade, std::string name) : _name(name) this->checkGrade(); } -Form::Form(const Form& copy) +AForm::AForm(const AForm& copy) { *this = copy; } -Form::~Form() +AForm::~AForm() { } -Form &Form::operator=(const Form& rhs) +AForm &AForm::operator=(const AForm& rhs) { if (this != &rhs) { @@ -41,54 +41,54 @@ Form &Form::operator=(const Form& rhs) return (*this); } -std::ostream &operator<<(std::ostream &out, const Form &form) +std::ostream &operator<<(std::ostream &out, const AForm &Aform) { - out << form.getName() << "form need at least " << form.getSignedGrade() << " grade to be signed and "; - out << form.getExecutionGrade() << " grade to be executed, "; - if (form.getIsSigned()) - out << form.getName() << " form is signed\n"; + out << Aform.getName() << "Aform need at least " << Aform.getSignedGrade() << " grade to be signed and "; + out << Aform.getExecutionGrade() << " grade to be executed, "; + if (Aform.getIsSigned()) + out << Aform.getName() << " Aform is signed\n"; else - out << form.getName() << " form isn't signed\n"; + out << Aform.getName() << " Aform isn't signed\n"; return (out); } -int Form::getSignedGrade() const +int AForm::getSignedGrade() const { return (this->_signedGrade); } -int Form::getExecutionGrade() const +int AForm::getExecutionGrade() const { return (this->_executionGrade); } -int Form::getIsSigned() const +int AForm::getIsSigned() const { return (this->_isSigned); } -const std::string Form::getName() const +const std::string AForm::getName() const { return (this->_name); } -void Form::beSigned(Bureaucrat &bureaucrat) +void AForm::beSigned(Bureaucrat &bureaucrat) { if (bureaucrat.getGrade() > this->_signedGrade) - throw Form::signedGradeTooLowException(); + throw AForm::signedGradeTooLowException(); else { this->_isSigned = 1; - std::cout << bureaucrat.getName() << " signed " << this->_name << " form\n"; + std::cout << bureaucrat.getName() << " signed " << this->_name << " Aform\n"; } } -void Form::checkGrade() const +void AForm::checkGrade() const { if (this->_signedGrade > 150 || this->_executionGrade > 150) - throw Form::GradeTooLowException(); + throw AForm::GradeTooLowException(); else if (this->_signedGrade < 1 || this->_executionGrade < 1) - throw Form::GradeTooHighException(); + throw AForm::GradeTooHighException(); } diff --git a/cpp05/ex02/Form.hpp b/cpp05/ex02/AForm.hpp similarity index 82% rename from cpp05/ex02/Form.hpp rename to cpp05/ex02/AForm.hpp index e834d4a..84cd188 100644 --- a/cpp05/ex02/Form.hpp +++ b/cpp05/ex02/AForm.hpp @@ -1,7 +1,7 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* Form.hpp :+: :+: :+: */ +/* AForm.hpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ @@ -10,8 +10,8 @@ /* */ /* ************************************************************************** */ -#ifndef FORM_HPP -# define FORM_HPP +#ifndef AFORM_HPP +# define AFORM_HPP # include # include @@ -20,20 +20,20 @@ class Bureaucrat; -class Form{ +class AForm{ public : - Form(int signedGrade, int executionGrade, std::string name); - Form(const Form& copy); - ~Form(); - Form &operator=(const Form& rhs); + AForm(int signedGrade, int executionGrade, std::string name); + AForm(const AForm& copy); + ~AForm(); + AForm &operator=(const AForm& rhs); const std::string getName() const; int getSignedGrade() const; int getExecutionGrade() const; int getIsSigned() const; - void checkGrade() const; + void checkGrade() const = 0; void beSigned(Bureaucrat &bureaucrat); @@ -72,6 +72,6 @@ class Form{ int _executionGrade; }; -std::ostream &operator<<(std::ostream &out, const Form &form); +std::ostream &operator<<(std::ostream &out, const AForm &Aform); #endif \ No newline at end of file diff --git a/cpp05/ex02/PresidentialPardonForm.cpp b/cpp05/ex02/PresidentialPardonForm.cpp new file mode 100644 index 0000000..11f5f6d --- /dev/null +++ b/cpp05/ex02/PresidentialPardonForm.cpp @@ -0,0 +1,33 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* PresidentialPardonForm.cpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: apommier +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2022/07/23 12:16:26 by apommier #+# #+# */ +/* Updated: 2022/07/23 12:35:33 by apommier ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "PresidentialPardonForm.cpp" + +PresidentialPardonForm() +{ + +} + +PresidentialPardonForm(const PresidentialPardonForm& copy) +{ + +} + +~PresidentialPardonForm() +{ + +} + +PresidentialPardonForm &operator=(const PresidentialPardonForm& rhs) +{ + +} \ No newline at end of file diff --git a/cpp05/ex02/PresidentialPardonForm.hpp b/cpp05/ex02/PresidentialPardonForm.hpp new file mode 100644 index 0000000..5387a0a --- /dev/null +++ b/cpp05/ex02/PresidentialPardonForm.hpp @@ -0,0 +1,29 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* PresidentialPardonForm.hpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: apommier +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2022/07/23 12:16:28 by apommier #+# #+# */ +/* Updated: 2022/07/23 13:43:32 by apommier ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef PRESIDENTIALPARDONFORM_HPP +# define PRESIDENTIALPARDONFORM_HPP + +# include "AForm.hpp" + +class PresidentialPardonForm : public AForm{ + public : + + PresidentialPardonForm(); + PresidentialPardonForm(const PresidentialPardonForm& copy); + ~PresidentialPardonForm(); + PresidentialPardonForm &operator=(const PresidentialPardonForm& rhs); + + private : +}; + +#endif \ No newline at end of file diff --git a/cpp05/ex02/RobotomyRequestForm.cpp b/cpp05/ex02/RobotomyRequestForm.cpp index 2349744..797b837 100644 --- a/cpp05/ex02/RobotomyRequestForm.cpp +++ b/cpp05/ex02/RobotomyRequestForm.cpp @@ -6,12 +6,28 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/07/19 13:00:09 by apommier #+# #+# */ -/* Updated: 2022/07/19 22:01:30 by apommier ### ########.fr */ +/* Updated: 2022/07/23 12:35:53 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ -class RobotomyRequestForm{ - public : +#include "RobotomyRequestForm.hpp" - private : -}; \ No newline at end of file +RobotomyRequestForm() +{ + +} + +RobotomyRequestForm(const RobotomyRequestForm.hpp& copy) +{ + +} + +~RobotomyRequestForm() +{ + +} + +RobotomyRequestForm.hpp &operator=(const RobotomyRequestForm.hpp& rhs) +{ + +} \ No newline at end of file diff --git a/cpp05/ex02/RobotomyRequestForm.hpp b/cpp05/ex02/RobotomyRequestForm.hpp index b162ab9..9c4ee2f 100644 --- a/cpp05/ex02/RobotomyRequestForm.hpp +++ b/cpp05/ex02/RobotomyRequestForm.hpp @@ -1,12 +1,29 @@ /* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* RobotomyRequestForm.hpp :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: apommier +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2022/07/19 13:00:11 by apommier #+# #+# */ -/* Updated: 2022/07/19 13:00:12 by apommier ### ########.fr */ -/* */ +/* */ +/* ::: :::::::: */ +/* RobotomyRequestForm.hpp :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: apommier +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2022/07/19 13:00:11 by apommier #+# #+# */ +/* Updated: 2022/07/23 12:30:09 by apommier ### ########.fr */ +/* */ /* ************************************************************************** */ +#ifndef ROBOTOMYREQUESTFORM_HPP +# define ROBOTOMYREQUESTFORM_HPP + +# include "AForm.hpp" + +class RobotomyRequestForm : public AForm{ + public : + + RobotomyRequestForm(); + RobotomyRequestForm(const RobotomyRequestForm& copy); + ~RobotomyRequestForm(); + RobotomyRequestForm &operator=(const RobotomyRequestForm& rhs); + + private : +}; + +#endif \ No newline at end of file diff --git a/cpp05/ex02/ShrubberyCreationForm.cpp b/cpp05/ex02/ShrubberyCreationForm.cpp index cf53cf0..56ab3a6 100644 --- a/cpp05/ex02/ShrubberyCreationForm.cpp +++ b/cpp05/ex02/ShrubberyCreationForm.cpp @@ -6,15 +6,33 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/07/19 13:00:14 by apommier #+# #+# */ -/* Updated: 2022/07/19 22:24:06 by apommier ### ########.fr */ +/* Updated: 2022/07/23 12:35:04 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ -class ShrubberyCreationForm{ - public : +#include "ShrubberyCreationForm.hpp" + +ShrubberyCreationForm() +{ + +} + +ShrubberyCreationForm(const ShrubberyCreationForm& copy) +{ + +} + +~ShrubberyCreationForm() +{ + +} + +ShrubberyCreationForm &operator=(const ShrubberyCreationForm& rhs) +{ + +} + - private : -}; // _ // /;-._,-.____ ,-----.__ diff --git a/cpp05/ex02/ShrubberyCreationForm.hpp b/cpp05/ex02/ShrubberyCreationForm.hpp index f4914fb..20854ab 100644 --- a/cpp05/ex02/ShrubberyCreationForm.hpp +++ b/cpp05/ex02/ShrubberyCreationForm.hpp @@ -6,7 +6,24 @@ /* By: apommier +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/07/19 13:00:12 by apommier #+# #+# */ -/* Updated: 2022/07/19 13:00:14 by apommier ### ########.fr */ +/* Updated: 2022/07/23 13:43:44 by apommier ### ########.fr */ /* */ /* ************************************************************************** */ +#ifndef SHRUBBERYCREATIONFORM_HPP +# define SHRUBBERYCREATIONFORM_HPP + +# include "AForm.hpp" + +class ShrubberyCreationForm : public AForm{ + public : + + ShrubberyCreationForm(); + ShrubberyCreationForm(const ShrubberyCreationForm& copy); + ~ShrubberyCreationForm(); + ShrubberyCreationForm &operator=(const ShrubberyCreationForm& rhs); + + private : +}; + +#endif \ No newline at end of file