style: use my one (with logic) norm for header hope u enjoy it

This commit is contained in:
Raphael 2024-12-23 14:36:04 +01:00
parent ff72109a4e
commit 2d6b2ddb83
13 changed files with 316 additions and 315 deletions

View file

@ -6,42 +6,42 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/17 15:27:54 by rparodi #+# #+# */
/* Updated: 2024/10/17 15:48:22 by rparodi ### ########.fr */
/* Updated: 2024/12/23 12:36:02 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef COLOR_HPP
#define COLOR_HPP
#define CLR_RESET "\033[0m"
#define CLR_BLACK "\033[0;30m"
#define CLR_RED "\033[0;31m"
#define CLR_GREEN "\033[0;32m"
#define CLR_YELLOW "\033[0;33m"
#define CLR_BLUE "\033[0;34m"
#define CLR_MAGENTA "\033[0;35m"
#define CLR_CYAN "\033[0;36m"
#define CLR_WHITE "\033[0;37m"
#define CLR_GOLD "\033[38;5;220m"
#define CLR_GREY "\033[38;5;240m"
#define CLR_LIGHT_BLACK "\033[0;90m"
#define CLR_LIGHT_RED "\033[0;91m"
#define CLR_LIGHT_GREEN "\033[0;92m"
#define CLR_LIGHT_YELLOW "\033[0;93m"
#define CLR_LIGHT_BLUE "\033[0;94m"
#define CLR_LIGHT_MAGENTA "\033[0;95m"
#define CLR_LIGHT_CYAN "\033[0;96m"
#define CLR_LIGHT_WHITE "\033[0;97m"
#define CLR_BOLD_BLACK "\033[1;30m"
#define CLR_BOLD_RED "\033[1;31m"
#define CLR_BOLD_GREEN "\033[1;32m"
#define CLR_BOLD_YELLOW "\033[1;33m"
#define CLR_BOLD_BLUE "\033[1;34m"
#define CLR_BOLD_MAGENTA "\033[1;35m"
#define CLR_BOLD_CYAN "\033[1;36m"
#define CLR_BOLD_WHITE "\033[1;37m"
#define COLOR_HPP
#define CLR_RESET "\033[0m"
#define CLR_BLACK "\033[0;30m"
#define CLR_RED "\033[0;31m"
#define CLR_GREEN "\033[0;32m"
#define CLR_YELLOW "\033[0;33m"
#define CLR_BLUE "\033[0;34m"
#define CLR_MAGENTA "\033[0;35m"
#define CLR_CYAN "\033[0;36m"
#define CLR_WHITE "\033[0;37m"
#define CLR_GOLD "\033[38;5;220m"
#define CLR_GREY "\033[38;5;240m"
#define CLR_LIGHT_BLACK "\033[0;90m"
#define CLR_LIGHT_RED "\033[0;91m"
#define CLR_LIGHT_GREEN "\033[0;92m"
#define CLR_LIGHT_YELLOW "\033[0;93m"
#define CLR_LIGHT_BLUE "\033[0;94m"
#define CLR_LIGHT_MAGENTA "\033[0;95m"
#define CLR_LIGHT_CYAN "\033[0;96m"
#define CLR_LIGHT_WHITE "\033[0;97m"
#define CLR_BOLD_BLACK "\033[1;30m"
#define CLR_BOLD_RED "\033[1;31m"
#define CLR_BOLD_GREEN "\033[1;32m"
#define CLR_BOLD_YELLOW "\033[1;33m"
#define CLR_BOLD_BLUE "\033[1;34m"
#define CLR_BOLD_MAGENTA "\033[1;35m"
#define CLR_BOLD_CYAN "\033[1;36m"
#define CLR_BOLD_WHITE "\033[1;37m"
#endif

View file

@ -6,56 +6,56 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/17 14:56:49 by rparodi #+# #+# */
/* Updated: 2024/10/22 14:06:11 by rparodi ### ########.fr */
/* Updated: 2024/12/23 12:36:19 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PHONEBOOK_HPP
# define PHONEBOOK_HPP
#define PHONEBOOK_HPP
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>
#include <cstring>
#include "color.hpp"
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdlib>
#include <cstring>
#include "color.hpp"
#define MENU CLR_BLUE << "ADD" << CLR_RESET << ":\tAdding a new contact" << std::endl << CLR_BLUE << "SEARCH" << CLR_RESET << ":\tSearching a contact in the list" << std::endl << CLR_BLUE << "EXIT" << CLR_RESET << ":\texit the program" << std::endl
#define MENU CLR_BLUE << "ADD" << CLR_RESET << ":\tAdding a new contact" << std::endl << CLR_BLUE << "SEARCH" << CLR_RESET << ":\tSearching a contact in the list" << std::endl << CLR_BLUE << "EXIT" << CLR_RESET << ":\texit the program" << std::endl
std::string get_input(const char *err_msg, std::string file, int line);
std::string get_input(const char *err_msg, std::string file, int line);
class Contact
{
public:
Contact();
~Contact();
void init_new(int id);
void print_all();
void print();
bool getUsed();
void setUsed();
void clear();
private:
std::string _get_number(const char *err_msg, std::string file, int line);
bool _used;
int _id;
std::string _first_name;
std::string _last_name;
std::string _nickname;
std::string _number;
std::string _secret;
};
class Contact
{
public:
Contact();
~Contact();
void init_new(int id);
void print_all();
void print();
bool getUsed();
void setUsed();
void clear();
private:
std::string _get_number(const char *err_msg, std::string file, int line);
bool _used;
int _id;
std::string _first_name;
std::string _last_name;
std::string _nickname;
std::string _number;
std::string _secret;
};
class PhoneBook
{
public:
PhoneBook();
~PhoneBook();
void add(int id);
Contact array_contact[8];
void search();
private:
void searching_header();
};
class PhoneBook
{
public:
PhoneBook();
~PhoneBook();
void add(int id);
Contact array_contact[8];
void search();
private:
void searching_header();
};
#endif