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
+77
View File
@@ -0,0 +1,77 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Harl.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lfirmin <lfirmin@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/02 10:04:24 by lfirmin #+# #+# */
/* Updated: 2025/07/02 10:25:30 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!\n" << 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!\n" << 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.\n" << std::endl;
}
void Harl::_error(void)
{
std::cout << "This is unacceptable! I want to speak to the manager now.\n" << std::endl;
}
void Harl::complain(std::string level)
{
int i;
std::string levels[4] = {"DEBUG", "INFO", "WARNING", "ERROR"};
i = 0;
if (!level.compare(levels[0]) || i == 1)
{
std::cout << "[ DEBUG ]" << std::endl;
Harl::_debug();
i = 1;
}
if (!level.compare(levels[1]) || i == 1)
{
std::cout << "[ INFO ]" << std::endl;
Harl::_info();
i = 1;
}
if (!level.compare(levels[2]) || i == 1)
{
std::cout << "[ WARNING ]" << std::endl;
Harl::_warning();
i = 1;
}
if (!level.compare(levels[3]) || i == 1)
{
std::cout << "[ ERROR ]" << std::endl;
Harl::_error();
i = 1;
}
else
{
std::cout << "No Valid Level.\n";
return ;
}
}
+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
+28
View File
@@ -0,0 +1,28 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Main.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lfirmin <lfirmin@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/02 10:08:12 by lfirmin #+# #+# */
/* Updated: 2025/07/02 10:13:05 by lfirmin ### ########.fr */
/* */
/* ************************************************************************** */
#include "Harl.hpp"
int main (int argc, char **argv)
{
std::string level;
Harl harl;
if (argc != 2)
{
std::cout << "Usage : ./harlfilter <level>\n";
return (0);
}
level = argv[1];
harl.complain(level);
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:25:55 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 = harlfilter
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