Form::Form(std::string name, int sgrade, int xgrade): m_name(name), m_sgrade(sgrade), m_xgrade(xgrade), m_sign(0) { if (m_sgrade > 150 || m_sgrade < 1) m_sgrade < 1 ? throw GradeTooHighException() : throw GradeTooLowException(); if (m_xgrade > 150 || m_xgrade < 1) m_xgrade < 1 ? throw GradeTooHighException() : throw GradeTooLowException(); return; }
Form::Form( std::string name, int signGrade, int executeGrade ) : _name(name), _signed(false), _signGrade(signGrade), _executeGrade(executeGrade) { if (signGrade > 150) throw GradeTooLowException("grade required to sign the form is too low"); else if (signGrade < 1) throw GradeTooHighException("grade required to sign the form is too high"); if (executeGrade > 150) throw GradeTooLowException("grade required to execute the form is too low"); else if (executeGrade < 1) throw GradeTooHighException("grade required to execute the form is too high"); }
void Bureaucrat::increaseGrade(void) { if (mn_grade - 1 < MAX_GRADE) throw GradeTooHighException(); else mn_grade--; }
void Form::checkGrade(int pn_grade) const { if (pn_grade > MIN_GRADE) throw GradeTooLowException(); if (pn_grade < MAX_GRADE) throw GradeTooHighException(); }
void Bureaucrat::incGrade(void) { if (m_grade - 1 < 1) throw GradeTooHighException(); else m_grade -= 1; }
void Bureaucrat::incrementGrade() { if (this->grade - 1 <= 0) { throw GradeTooHighException(); } else { this->grade--; } }
Form::Form(Form const &src) : name(src.name), sign(src.sign), gradeSign(src.gradeSign), gradeExec(src.gradeExec) { if (gradeSign > 150 || gradeExec > 150) throw GradeTooLowException(); else if (gradeSign < 1 || gradeExec < 1) throw GradeTooHighException(); }
Bureaucrat::Bureaucrat(std::string const & p_name, int pn_grade) : m_name(p_name), mn_grade(pn_grade) { if (pn_grade > MIN_GRADE) throw GradeTooLowException(); if (pn_grade < MAX_GRADE) throw GradeTooHighException(); }
Form::Form(std::string name, int gradeSign, int gradeExec) throw(GradeTooLowException, GradeTooHighException) : name(name), sign(false), gradeSign(gradeSign), gradeExec(gradeExec) { if (gradeSign > 150 || gradeExec > 150) throw GradeTooLowException(); else if (gradeSign < 1 || gradeExec < 1) throw GradeTooHighException(); }
Bureaucrat::Bureaucrat(std::string name, short grade) : name(name) { if (grade < 0) { throw GradeTooHighException(); } else if (grade > 150) { throw GradeTooLowException(); } else this->grade = grade; }
Form::Form(std::string name, short gradeSign, short gradeExecute) : name(name), gradeSign(gradeSign), gradeExecute(gradeExecute) { this->validated = false; try { if (gradeSign < 0 || gradeExecute < 0) { throw GradeTooHighException(); } else if (gradeSign > 150 || gradeExecute > 150) { throw GradeTooLowException(); } } catch (std::exception &e) { std::cerr << e.what() << std::endl; } }
Bureaucrat::Bureaucrat(std::string name, int grade): m_name(name), m_grade(grade) { if (m_grade > 150 || m_grade < 1) m_grade < 1 ? throw GradeTooHighException() : throw GradeTooLowException(); }