1
0

🏗️」 wip(PhoneBook): Started phonebook

This commit is contained in:
2024-10-31 13:41:59 +01:00
parent d0f2837cd4
commit 1607cd1fa6
6 changed files with 99 additions and 10 deletions

3
.gitignore vendored
View File

@ -1,5 +1,6 @@
obj/ obj/
ex00/megaphone
megaphone megaphone
compile_commands.json
.cache
.direnv .direnv
flake.lock flake.lock

View File

@ -6,7 +6,7 @@
# By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ # # By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2024/10/25 16:09:27 by adjoly #+# #+# # # Created: 2024/10/25 16:09:27 by adjoly #+# #+# #
# Updated: 2024/10/26 00:41:40 by adjoly ### ########.fr # # Updated: 2024/10/30 17:08:54 by adjoly ### ########.fr #
# # # #
# **************************************************************************** # # **************************************************************************** #
@ -20,7 +20,8 @@ SRCSDIR = src/
INCLUDES = includes/ INCLUDES = includes/
SRCS = main.cpp SRCS = PhoneBook.cpp \
Contact.cpp
OBJS = $(addprefix $(OBJSDIR), $(SRCS:.cpp=.o)) OBJS = $(addprefix $(OBJSDIR), $(SRCS:.cpp=.o))

View File

@ -6,15 +6,33 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/26 00:41:12 by adjoly #+# #+# */ /* Created: 2024/10/26 00:41:12 by adjoly #+# #+# */
/* Updated: 2024/10/26 00:44:00 by adjoly ### ########.fr */ /* Updated: 2024/10/31 13:26:17 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#pragma once #pragma once
#include <string>
class Contact { class Contact {
private: private:
std::string _name;
std::string _lastName;
std::string _nickname;
std::string _phoneNbr;
std::string _darkestSecret;
public: public:
// Getter
std::string getName();
std::string getLastName();
std::string getNickname();
std::string getPhoneNbr();
std::string getSecret();
// Setter
void setName(std::string newName);
void setLastName(std::string newLastName);
void setNickname(std::string newNickName);
void setPhoneNbr(std::string newPhoneNbr);
void setSecret(std::string newSecret);
}; };

View File

@ -6,15 +6,17 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/26 00:41:10 by adjoly #+# #+# */ /* Created: 2024/10/26 00:41:10 by adjoly #+# #+# */
/* Updated: 2024/10/26 00:43:39 by adjoly ### ########.fr */ /* Updated: 2024/10/31 12:37:10 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#pragma once #pragma once
#include "Contact.hpp"
class PhoneBook { class PhoneBook {
private: private:
Contact _contact[8];
public: public:
}; };

64
ex01/src/Contact.cpp Normal file
View File

@ -0,0 +1,64 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Contact.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/30 17:05:12 by adjoly #+# #+# */
/* Updated: 2024/10/31 13:33:56 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "Contact.hpp"
#include <string>
std::string Contact::getName()
{
return (Contact::_name);
}
std::string Contact::getLastName()
{
return (Contact::_lastName);
}
std::string Contact::getNickname()
{
return (Contact::_nickname);
}
std::string Contact::getPhoneNbr()
{
return (Contact::_phoneNbr);
}
std::string Contact::getSecret()
{
return (Contact::_darkestSecret);
}
void Contact::setName(std::string newName)
{
_name = newName;
}
void Contact::setLastName(std::string newLastName)
{
_lastName = newLastName;
}
void Contact::setNickname(std::string newNickname)
{
_nickname = newNickname;
}
void Contact::setPhoneNbr(std::string newPhoneNbr)
{
_phoneNbr = newPhoneNbr;
}
void Contact::setSecret(std::string newSecret)
{
_darkestSecret = newSecret;
}

View File

@ -1,15 +1,18 @@
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* ::: :::::::: */ /* ::: :::::::: */
/* main.cpp :+: :+: :+: */ /* PhoneBook.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */ /* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/26 00:20:32 by adjoly #+# #+# */ /* Created: 2024/10/26 00:20:32 by adjoly #+# #+# */
/* Updated: 2024/10/26 00:44:17 by adjoly ### ########.fr */ /* Updated: 2024/10/31 13:27:11 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
int main(int ac, char **av) #include <PhoneBook.hpp>
int main(void)
{ {
} }