intra to gitea

This commit is contained in:
root
2025-11-15 22:11:19 +00:00
commit f54385c2da
31 changed files with 1135 additions and 0 deletions
+59
View File
@@ -0,0 +1,59 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Harl.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lfirmin <lfirmin@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/02 10:04:24 by lfirmin #+# #+# */
/* Updated: 2025/07/02 10:05:57 by lfirmin ### ########.fr */
/* */
/* ************************************************************************** */
#include "Harl.hpp"
Harl::Harl()
{
}
Harl::~Harl()
{
}
void Harl::_debug(void)
{
std::cout << "I love having extra bacon for my 7XL-double-cheese-triple-pickle-specialketchup burger. I really do!" << std::endl;
}
void Harl::_info(void)
{
std::cout << "I cannot believe adding extra bacon costs more money. You didn't put enough bacon in my burger! If you did, I wouldn't be asking for more!" << std::endl;
}
void Harl::_warning(void)
{
std::cout << "I think I deserve to have some extra bacon for free. I've been coming for years whereas you started working here since last month." << std::endl;
}
void Harl::_error(void)
{
std::cout << "This is unacceptable! I want to speak to the manager now." << std::endl;
}
void Harl::complain(std::string level)
{
int i;
std::string levels[4] = {"DEBUG", "INFO", "WARNING", "ERROR"};
void (Harl::*fptr[4])() = {&Harl::_debug, &Harl::_info, &Harl::_warning, &Harl::_error};
i = 0;
while (i < 4)
{
if (level == levels[i])
{
(this->*fptr[i])();
return;
}
i++;
}
std::cout << "No Valid Level.\n";
}
+32
View File
@@ -0,0 +1,32 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Harl.hpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lfirmin <lfirmin@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/02 10:03:59 by lfirmin #+# #+# */
/* Updated: 2025/07/02 10:04:08 by lfirmin ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef HARL_HPP
# define HARL_HPP
#include <iostream>
class Harl
{
private:
void _debug(void);
void _info(void);
void _warning(void);
void _error(void);
public:
Harl();
~Harl();
void complain(std::string level) ;
};
#endif
+30
View File
@@ -0,0 +1,30 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lfirmin <lfirmin@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/02 10:08:12 by lfirmin #+# #+# */
/* Updated: 2025/07/02 10:08:56 by lfirmin ### ########.fr */
/* */
/* ************************************************************************** */
#include "Harl.hpp"
int main (void)
{
Harl harl;
std::cout << std::endl << "====DEBUG Level====" << std::endl;
harl.complain("DEBUG");
std::cout << std::endl << "====INFO Level====" << std::endl;;
harl.complain("INFO");
std::cout << std::endl << "====WARNING Level====" << std::endl;
harl.complain("WARNING");
std::cout << std::endl << "====ERROR Level====" << std::endl;
harl.complain("ERROR");
std::cout << std::endl << "====No valid Level====" << std::endl;
harl.complain("ALARM");
return (0);
}
+48
View File
@@ -0,0 +1,48 @@
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: lfirmin <lfirmin@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2025/07/01 13:54:05 by lfirmin #+# #+# #
# Updated: 2025/07/02 10:09:25 by lfirmin ### ########.fr #
# #
# **************************************************************************** #
CXX = c++
CXXFLAGS = -Wall -Wextra -Werror -std=c++98
OBJDIR = obj
SOURCES = Main.cpp Harl.cpp
OBJECTS = $(addprefix $(OBJDIR)/, $(SOURCES:.cpp=.o))
NAME = harl
all: $(NAME)
$(OBJDIR):
@echo "📁 Creating obj directory..."
@mkdir -p $(OBJDIR)
$(OBJDIR)/%.o: %.cpp | $(OBJDIR)
@echo "🧠 Compiling $< ..."
@$(CXX) $(CXXFLAGS) -c $< -o $@
@echo "$@ ready!"
$(NAME): $(OBJECTS)
@echo "🔗 Linking $(NAME) ..."
@$(CXX) $(CXXFLAGS) $(OBJECTS) -o $(NAME)
@echo "🎉 $(NAME) is ready to hunt brains!"
clean:
@echo "🧹 Cleaning object files..."
@rm -rf $(OBJDIR)
@echo "✨ Objects cleaned!"
fclean: clean
@echo "🗑️ Removing $(NAME)..."
@rm -f $(NAME)
@echo "💀 Full clean complete!"
re: fclean all
.PHONY: all clean fclean re