#include #include ShrubberyCreationForm::ShrubberyCreationForm() : AForm("ShrubberyCreationForm", 145, 137), target("home") { std::cout << "ShrubberyCreationForm default constructor called" << std::endl; } ShrubberyCreationForm::ShrubberyCreationForm(const ShrubberyCreationForm& other) : AForm(other), target(other.target) { std::cout << "ShrubberyCreationForm copy constructor called" << std::endl; } ShrubberyCreationForm::ShrubberyCreationForm(const std::string& target) : AForm("ShrubberyCreationForm", 145, 137), target(target) { std::cout << "ShrubberyCreationForm (target) constructor called" << std::endl; } void ShrubberyCreationForm::executeAction() const { std::ofstream file((target + "_shrubbery").c_str()); if (!file.is_open()) throw FileCreationException(); file << " _-_ " << std::endl << " /~~ ~~\\ " << std::endl << " /~~ ~~\\ " << std::endl << "{ } " << std::endl << " \\ _- -_ / " << std::endl << " ~ \\\\ // ~ " << std::endl << "_- - | | _- _ " << std::endl << " _ - | | -_ " << std::endl << " // \\\\ " << std::endl << std::endl << " &&& && & && " << std::endl << " && &\\/&\\|& ()|/ @, &&" << std::endl << " &\\/(/&/&||/& /_/)_&/_&" << std::endl << " &() &\\/&|()|/&\\/ '%\" &" << std::endl << " &_\\_&&_\\ |& |&&/&__%_/_&" << std::endl << "& && & &| &| /& & % ()& " << std::endl << " ()&_---()&\\&\\|&&-&&--%---()~" << std::endl << " && \\||| " << std::endl << " ||| " << std::endl << " ||| " << std::endl << " ||| " << std::endl << " , -=-~ .-^- _ " << std::endl; file.close(); } const std::string& ShrubberyCreationForm::getTarget() const { return target; } ShrubberyCreationForm& ShrubberyCreationForm::operator=(const ShrubberyCreationForm& other) { std::cout << "ShrubberyCreationForm assignment operator called" << std::endl; if (this != &other) { AForm::operator=(other); target = other.target; } return *this; } ShrubberyCreationForm::~ShrubberyCreationForm() { std::cout << "ShrubberyCreationForm destructor called" << std::endl; } const char* ShrubberyCreationForm::FileCreationException::what() const throw() { return "Shrubbery file could not be created"; }