🎉」 init: hello world !

This commit is contained in:
2025-08-02 13:51:40 +02:00
commit 224ed0cf99
44 changed files with 2108 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
#include "ShrubberyCreationForm.hpp"
#include <fstream>
#include <stdexcept>
#include <string>
ShrubberyCreationForm::ShrubberyCreationForm(void) : AForm("ShrubberyCreationForm", 145, 137) {
_log("", "ShrubberyCreationForm", "", "default constructor called");
}
ShrubberyCreationForm::ShrubberyCreationForm(const ShrubberyCreationForm &cpy) : AForm(cpy) {
_log("", "ShrubberyCreationForm", "", "copy constructor called");
if (this != &cpy)
*this = cpy;
}
ShrubberyCreationForm::ShrubberyCreationForm(std::string target) : AForm(target, 145, 137) {
_log("", "ShrubberyCreationForm", "", "target constructor called");
}
ShrubberyCreationForm::~ShrubberyCreationForm(void) {
_log("", "ShrubberyCreationForm", "", "destructor called");
}
ShrubberyCreationForm &ShrubberyCreationForm::operator=(const ShrubberyCreationForm &cpy) {
_log("", "ShrubberyCreationForm", "", "copy assignement constructor called");
(void) cpy;
return (*this);
}
void ShrubberyCreationForm::_exec(const Bureaucrat &b) const {
(void) b;
std::ofstream file;
file.open(std::string(this->getName() + "_shruberry").c_str());
if (!file.is_open())
throw std::runtime_error("Could not write to " + this->getName() +
"_shruberry");
file << " _-_\n"
" /~~ ~~\\\n"
" /~~ ~~\\\n"
"{ }\n"
" \\ _- -_ /\n"
" ~ \\ // ~\n"
"_- - | | _- _\n"
" _ - | | -_\n"
" // \\\n";
file.close();
std::cout << "ASCII tree created in : " + this->getName() + "_shruberry"
<< std::endl;
}