This commit is contained in:
Ladebeze66
2024-02-22 16:34:34 +01:00
parent bce000d3ca
commit 9aa5e8f9c5
18 changed files with 160 additions and 79 deletions

View File

@@ -6,7 +6,7 @@
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/11 12:57:28 by fgras-ca #+# #+# */
/* Updated: 2024/02/16 17:30:30 by fgras-ca ### ########.fr */
/* Updated: 2024/02/22 12:45:13 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
@@ -34,13 +34,13 @@ public:
class GradeTooHighException : public std::exception
{
public:
const char* what() const throw() override;
const char* what() const throw();
};
class GradeTooLowException : public std::exception
{
public:
const char* what() const throw() override;
const char* what() const throw();
};
Bureaucrat();

View File

@@ -6,19 +6,13 @@
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/11 14:39:51 by fgras-ca #+# #+# */
/* Updated: 2024/02/16 18:19:00 by fgras-ca ### ########.fr */
/* Updated: 2024/02/22 12:48:40 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
#include "Bureaucrat.hpp"
#include "Form.hpp"
Form::Form()
: name(name), isSigned(false), gradeRequiredToSign(1), gradeRequiredToExecute(1)
{
std::cout << GREEN << "Form default constructor called!" << RESET << std::endl;
}
Form::Form(const std::string &name, int gradeRequiredToSign, int gradeRequiredToExecute)
: name(name), isSigned(false), gradeRequiredToSign(gradeRequiredToSign), gradeRequiredToExecute(gradeRequiredToExecute)
{
@@ -84,12 +78,12 @@ void Form::beSigned(const Bureaucrat& bureaucrat)
}
}
const char* Form::GradeTooHighException::what() const noexcept
const char* Form::GradeTooHighException::what() const throw()
{
return ("Grade too hight\n");
}
const char* Form::GradeTooLowException::what() const noexcept
const char* Form::GradeTooLowException::what() const throw()
{
return ("Grade too low\n");
}

View File

@@ -6,7 +6,7 @@
/* By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/11 14:37:14 by fgras-ca #+# #+# */
/* Updated: 2024/02/16 18:26:09 by fgras-ca ### ########.fr */
/* Updated: 2024/02/22 12:48:27 by fgras-ca ### ########.fr */
/* */
/* ************************************************************************** */
@@ -29,7 +29,6 @@ private:
public:
//constructueur
Form();
Form(const std::string &name, int gradeRequiredToSign, int gradeRequiredToExecute);
// Constructeur par copie
Form(const Form& other);
@@ -49,13 +48,13 @@ public:
class GradeTooHighException : public std::exception
{
public:
const char* what() const noexcept override;
const char* what() const throw();
};
class GradeTooLowException : public std::exception
{
public:
const char* what() const noexcept override;
const char* what() const throw();
};
};

View File

@@ -6,7 +6,7 @@
# By: fgras-ca <fgras-ca@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/12/27 20:57:42 by fgras-ca #+# #+# #
# Updated: 2024/02/11 14:58:41 by fgras-ca ### ########.fr #
# Updated: 2024/02/22 12:41:21 by fgras-ca ### ########.fr #
# #
# **************************************************************************** #
@@ -29,14 +29,16 @@ SRC = Bureaucrat.cpp \
Form.cpp \
main.cpp \
OBJS = ${SRC:.cpp=.o}
CC = c++
CFLAGS = -Wall -Werror -Wextra -std=c++98
RM = rm -f
OBJS = ${SRC:.cpp=.o}
all : $(NAME)
%.o: %.cpp
$(CC) $(CFLAGS) -c $< -o $@
$(NAME) : $(OBJS)
@echo "$(RED)Compilation fixed... $(DEF_COLOR)"
$(CC) $(CFLAGS) $(OBJS) -g -o $(NAME)