add: accessor and << method to form
This commit is contained in:
parent
f080860868
commit
077c151636
@ -1,6 +1,7 @@
|
|||||||
#include "Form.hpp"
|
#include "Form.hpp"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <ostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
Form::Form()
|
Form::Form()
|
||||||
@ -53,3 +54,30 @@ void Form::beSigned(const Bureaucrat &bureaucrat)
|
|||||||
this->_signed = true;
|
this->_signed = true;
|
||||||
std::cout << bureaucrat.getName() << " signed " << this->_name << std::endl;
|
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;
|
||||||
|
}
|
||||||
|
@ -23,6 +23,11 @@ class Form
|
|||||||
|
|
||||||
Form& operator=(const Form& src);
|
Form& operator=(const Form& src);
|
||||||
|
|
||||||
|
const std::string& getName() const;
|
||||||
|
bool getSigned() const;
|
||||||
|
int getGradeToBeExecute() const;
|
||||||
|
int getGradeToBeSign() const;
|
||||||
|
|
||||||
void beSigned(const Bureaucrat& bureaucrat);
|
void beSigned(const Bureaucrat& bureaucrat);
|
||||||
|
|
||||||
class GradeTooHighException: public std::exception
|
class GradeTooHighException: public std::exception
|
||||||
|
Loading…
Reference in New Issue
Block a user