add: accessor and << method to form

This commit is contained in:
Camille Chauvet 2023-09-03 11:06:53 +00:00
parent f080860868
commit 077c151636
2 changed files with 33 additions and 0 deletions

View File

@ -1,6 +1,7 @@
#include "Form.hpp"
#include <iostream>
#include <ostream>
#include <string>
Form::Form()
@ -53,3 +54,30 @@ void Form::beSigned(const Bureaucrat &bureaucrat)
this->_signed = true;
std::cout << bureaucrat.getName() << " signed " << this->_name << std::endl;
}
const std::string& Form::getName() const
{
return this->_name;
}
bool Form::getSigned() const
{
return this->_signed;
}
int Form::getGradeToBeExecute() const
{
return this->_to_execute;
}
int Form::getGradeToBeSign() const
{
return this->_to_sign;
}
std::ostream& operator<<(std::ostream& os, const Form& src)
{
os << src.getName() << " Form signed: " << src.getSigned() << ", grade to be execute " << src.getGradeToBeExecute() << ", grade to be sign: " << src.getGradeToBeSign() << std::endl;
return os;
}

View File

@ -23,6 +23,11 @@ class Form
Form& operator=(const Form& src);
const std::string& getName() const;
bool getSigned() const;
int getGradeToBeExecute() const;
int getGradeToBeSign() const;
void beSigned(const Bureaucrat& bureaucrat);
class GradeTooHighException: public std::exception