- Added move constructors and move assignment operators to Bureaucrat and Form classes. - Updated constructors and destructors to include logging for move operations. - Enhanced Bureaucrat class with an executeForm method to handle form execution. - Refactored color definitions in colors.h for better organization and clarity. - Removed redundant macro definitions and improved code readability. - Updated main functions to utilize new executeForm method for better exception handling. - Ensured proper handling of copy and move semantics across all relevant classes.
35 lines
962 B
C++
35 lines
962 B
C++
#pragma once
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
#include "AForm.hpp"
|
|
|
|
class PresidentialPardonForm : public AForm
|
|
{
|
|
private:
|
|
const std::string _target;
|
|
|
|
public:
|
|
// Constructors
|
|
PresidentialPardonForm() = delete;
|
|
PresidentialPardonForm(std::string target);
|
|
|
|
// Copy constructor and copy assignment operator
|
|
PresidentialPardonForm(const PresidentialPardonForm &other);
|
|
PresidentialPardonForm &operator=(const PresidentialPardonForm &other) =
|
|
delete;
|
|
|
|
// Move constructor and move assignment operator
|
|
PresidentialPardonForm(PresidentialPardonForm &&other) noexcept;
|
|
PresidentialPardonForm &operator=(PresidentialPardonForm &&other) noexcept =
|
|
delete;
|
|
|
|
// Destructor
|
|
~PresidentialPardonForm();
|
|
|
|
void execute(const Bureaucrat &executor) const override;
|
|
const std::string getTarget() const;
|
|
};
|
|
|
|
std::ostream &operator<<(std::ostream &os, const PresidentialPardonForm &form); |