ShrubberyCreationForm.cpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* ************************************************************************** */
  2. /* */
  3. /* ::: :::::::: */
  4. /* ShrubberyCreationForm.cpp :+: :+: :+: */
  5. /* +:+ +:+ +:+ */
  6. /* By: bchanot <bchanot@42.fr> +#+ +:+ +#+ */
  7. /* +#+#+#+#+#+ +#+ */
  8. /* Created: 2025/12/30 15:05:32 by bchanot #+# #+# */
  9. /* Updated: 2025/12/30 17:51:52 by bchanot ### ########.fr */
  10. /* */
  11. /* ************************************************************************** */
  12. #include "ShrubberyCreationForm.hpp"
  13. #include <fstream>
  14. /*
  15. ** ------------------------------- CONSTRUCTOR --------------------------------
  16. */
  17. ShrubberyCreationForm::ShrubberyCreationForm() : AForm("ShrubberyCreationForm", 137, 145, "DefaultTargetForm")
  18. {
  19. }
  20. ShrubberyCreationForm::ShrubberyCreationForm( const std::string & target ) : AForm("ShrubberyCreationForm", 137, 145, target)
  21. {
  22. }
  23. ShrubberyCreationForm::ShrubberyCreationForm( const ShrubberyCreationForm & src ) : AForm(src.getName(), src.getSignGrade(), src.getExecutionGrade(), src._target)
  24. {
  25. }
  26. /*
  27. ** -------------------------------- DESTRUCTOR --------------------------------
  28. */
  29. ShrubberyCreationForm::~ShrubberyCreationForm()
  30. {
  31. }
  32. /*
  33. ** --------------------------------- OVERLOAD ---------------------------------
  34. */
  35. ShrubberyCreationForm & ShrubberyCreationForm::operator=( ShrubberyCreationForm const & rhs )
  36. {
  37. (void)rhs;
  38. //if ( this != &rhs )
  39. //{
  40. //this->_value = rhs.getValue();
  41. //}
  42. return *this;
  43. }
  44. std::ostream & operator<<( std::ostream & o, ShrubberyCreationForm const & i )
  45. {
  46. (void)i;
  47. //o << "Value = " << i.getValue();
  48. return o;
  49. }
  50. /*
  51. ** --------------------------------- METHODS ----------------------------------
  52. */
  53. void ShrubberyCreationForm::action(void) const {
  54. std::string const filename = this->_target + "_shrubbery";
  55. std::ofstream ofs(filename.c_str());
  56. ofs << "Beautiful ascii tree" << std::endl;
  57. ofs.close();
  58. }
  59. /*
  60. ** --------------------------------- ACCESSOR ---------------------------------
  61. */
  62. /* ************************************************************************** */