예제 #1
1
파일: Form.cpp 프로젝트: avallete/CPPool
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;
}
예제 #2
0
파일: Form.cpp 프로젝트: Hadopire/42
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");
}
예제 #3
0
파일: Bureaucrat.cpp 프로젝트: Strade288/42
void Bureaucrat::increaseGrade(void)
{
	if (mn_grade - 1 < MAX_GRADE)
		throw GradeTooHighException();
	else
		mn_grade--;
}
예제 #4
0
파일: Form.cpp 프로젝트: Strade288/42
void Form::checkGrade(int pn_grade) const
{
	if (pn_grade > MIN_GRADE)
		throw GradeTooLowException();
	if (pn_grade < MAX_GRADE)
		throw GradeTooHighException();
}
예제 #5
0
void		Bureaucrat::incGrade(void)
{
	if (m_grade - 1 < 1)
		throw GradeTooHighException();
	else
		m_grade -= 1;
}
예제 #6
0
파일: Bureaucrat.cpp 프로젝트: NegMozzie/42
void Bureaucrat::incrementGrade() {
    if (this->grade - 1 <= 0) {
        throw GradeTooHighException();
    }
    else {
        this->grade--;
    }
}
예제 #7
0
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();
}
예제 #8
0
파일: Bureaucrat.cpp 프로젝트: Strade288/42
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();
}
예제 #9
0
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();
}
예제 #10
0
파일: Bureaucrat.cpp 프로젝트: NegMozzie/42
Bureaucrat::Bureaucrat(std::string name, short grade) : name(name) {
    if (grade < 0) {
        throw GradeTooHighException();
    }
    else if (grade > 150) {
        throw GradeTooLowException();
    }
    else
        this->grade = grade;
}
예제 #11
0
파일: Form.cpp 프로젝트: NegMozzie/42
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;
    }
}
예제 #12
0
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();
}