diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-11-17 13:52:48 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-11-17 13:52:48 +0100 |
| commit | 331c3596660fed6c8b04fdfd0a89435ccffaaf20 (patch) | |
| tree | 4196c94d9084a3d0ed45f3ec798d713639cbfc8a /cpp05/ex02/ShrubberyCreationForm.cpp | |
| parent | 4eecb32ffcf48c42672782fbcd53781a22e95ebf (diff) | |
| download | piscine_cpp-331c3596660fed6c8b04fdfd0a89435ccffaaf20.tar.gz piscine_cpp-331c3596660fed6c8b04fdfd0a89435ccffaaf20.tar.bz2 piscine_cpp-331c3596660fed6c8b04fdfd0a89435ccffaaf20.zip | |
Fixing cpp05/ex00-02
Diffstat (limited to 'cpp05/ex02/ShrubberyCreationForm.cpp')
| -rw-r--r-- | cpp05/ex02/ShrubberyCreationForm.cpp | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/cpp05/ex02/ShrubberyCreationForm.cpp b/cpp05/ex02/ShrubberyCreationForm.cpp index e138824..aa9d5a4 100644 --- a/cpp05/ex02/ShrubberyCreationForm.cpp +++ b/cpp05/ex02/ShrubberyCreationForm.cpp @@ -6,26 +6,46 @@ /* By: cacharle <me@cacharle.xyz> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/10/19 13:45:45 by cacharle #+# #+# */ -/* Updated: 2020/10/19 13:55:53 by cacharle ### ########.fr */ +/* Updated: 2020/11/17 13:23:52 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include "ShrubberyCreationForm.hpp" +ShrubberyCreationForm::ShrubberyCreationForm(std::string const& target) + : Form("shrubbery creation", 145, 137), m_target(target) {} + ShrubberyCreationForm::ShrubberyCreationForm(const ShrubberyCreationForm& other) - : m_target(other.m_target) -{} + : Form(other) { *this = other; } ShrubberyCreationForm& ShrubberyCreationForm::operator=(const ShrubberyCreationForm& other) { - Form::operator=(*this, other); + Form::operator=(other); m_target = other.m_target; return *this; } ShrubberyCreationForm::~ShrubberyCreationForm() {} -ShrubberyCreationForm::ShrubberyCreationForm(std::string const& target) - m_target(target) {} +void ShrubberyCreationForm::executeUnsafe() const +{ + std::ofstream file(m_target + "_shrubbery"); + if (!file.is_open()) + { + std::cerr << "Error: " << m_target + "_shrubbery" << ": " << std::strerror(errno) << std::endl; + return; + } + file << + " ## " + " #### " + " ###### " + " ########## " + " ############## " + " ######ntm####### " + " ################### " + " ##################### " + " |___| "; + file.close(); +} -ShrubberyCreationForm::ShrubberyCreationForm() : m_target("") {} +ShrubberyCreationForm::ShrubberyCreationForm() : Form("", 0, 0) {} |
