d05 ex02 ok pour Shrubbery form

This commit is contained in:
hugogogo
2022-03-04 20:58:15 +01:00
parent 130b228a2f
commit 0a5827f3a1
14 changed files with 297 additions and 194 deletions

View File

@@ -6,13 +6,14 @@
* CONSTRUCTORS
*********************************************/
ShrubberyCreationForm::ShrubberyCreationForm( std::string foo = ShrubberyCreationForm::_bar )
: _foo(foo) {
ShrubberyCreationForm::ShrubberyCreationForm( std::string target )
: AForm("shrubbery_creation", target, 145, 137){
std::cout << COPLIEN_COLOR "ShrubberyCreationForm constructor" RESET "\n";
return;
}
ShrubberyCreationForm::ShrubberyCreationForm( ShrubberyCreationForm const & src ) {
ShrubberyCreationForm::ShrubberyCreationForm( ShrubberyCreationForm const & src )
: AForm("shrubbery_creation", this->getTarget(), 145, 137) {
std::cout << COPLIEN_COLOR "ShrubberyCreationForm copy constructor" RESET "\n";
*this = src;
return;
@@ -32,42 +33,41 @@ ShrubberyCreationForm::~ShrubberyCreationForm() {
*********************************************/
ShrubberyCreationForm & ShrubberyCreationForm::operator=( ShrubberyCreationForm const & rhs ) {
// Base::operator=(rhs);
if ( this != &rhs )
{
// _foo = rhs.getFoo();
}
AForm::operator=(rhs);
return *this;
}
//std::ostream & operator<<(std::ostream & o, ShrubberyCreationForm const & rhs)
//{
// o << rhs.getFoo();
// return (o);
//}
/*********************************************
* ACCESSORS
*********************************************/
//std::string ShrubberyCreationForm::getFoo() const {return _foo;}
/*********************************************
* PUBLIC MEMBER FUNCTIONS
*********************************************/
//void ShrubberyCreationForm::function(const std::string & foo) {}
void ShrubberyCreationForm::formAction() const {
std::ofstream ofs("Shrubbery.txt", std::ofstream::out);
/*********************************************
* NESTED CLASS
*********************************************/
if (!ofs)
{
std::cout << "opening Shrubbery.txt file failed\n";
return ;
}
//void ShrubberyCreationForm::Class::function() {}
/*********************************************
* STATICS
*********************************************/
//std::string const ShrubberyCreationForm::_bar = "bar";
ofs << " * *\n";
ofs << " * * *\n";
ofs << " * * * * *\n";
ofs << " * * * * *\n";
ofs << " * * * * * * *\n";
ofs << " * * * * * .# * *\n";
ofs << " * * * #. .# * *\n";
ofs << " * \"#. #: #\" * * *\n";
ofs << " * * * \"#. ##\" *\n";
ofs << " * \"###\n";
ofs << " \"##\n";
ofs << " ##.\n";
ofs << " .##:\n";
ofs << " :###\n";
ofs << " ;###\n";
ofs << " ,####.\n";
ofs << " /\\/\\/\\/\\/\\/.######.\\/\\/\\/\\/\\\n";
ofs.close();
}