ShrubberyCreationForm.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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/31 16:05:27 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. i.print(o);
  47. return o;
  48. }
  49. /*
  50. ** --------------------------------- METHODS ----------------------------------
  51. */
  52. void ShrubberyCreationForm::action(void) const {
  53. std::string const filename = this->_target + "_shrubbery";
  54. std::ofstream ofs(filename.c_str());
  55. ofs << "Beautiful ascii tree" << std::endl;
  56. ofs.close();
  57. }
  58. /*
  59. ** --------------------------------- ACCESSOR ---------------------------------
  60. */
  61. /* ************************************************************************** */