diff --git a/d00/ex01/Contact.class.cpp b/d00/ex01/Contact.class.cpp index 7944e30..6a64ef2 100644 --- a/d00/ex01/Contact.class.cpp +++ b/d00/ex01/Contact.class.cpp @@ -1,53 +1,39 @@ #include "Contact.class.hpp" -#include -#include Contact::Contact( void ) { - return; - } Contact::~Contact( void ) { - return; - -} - -void Contact::add_index( std::string str ) { - - this->index.assign(str); - return; - } void Contact::add_first( std::string str ) { - this->first.assign(str); return; - } - void Contact::add_last( std::string str ) { - this->last.assign(str); return; - } - void Contact::add_nick( std::string str ) { - this->nick.assign(str); return; - +} +void Contact::add_num( std::string str ) { + this->num.assign(str); + return; +} +void Contact::add_secret( std::string str ) { + this->secret.assign(str); + return; } void Contact::print_contact( void ) { - - std::cout << "INDEX : " << this->index << std::endl; std::cout << "FIRST NAME : " << this->first << std::endl; std::cout << "LAST NAME : " << this->last << std::endl; std::cout << "NICKNAME : " << this->nick << std::endl; + std::cout << "NUMBER : " << this->num << std::endl; + std::cout << "SECRET : " << this->secret << std::endl; return; - } diff --git a/d00/ex01/Contact.class.hpp b/d00/ex01/Contact.class.hpp index 4e2b9c6..871ff8a 100644 --- a/d00/ex01/Contact.class.hpp +++ b/d00/ex01/Contact.class.hpp @@ -1,22 +1,40 @@ #ifndef CONTACT_CLASS_HPP # define CONTACT_CLASS_HPP -#include +# include +# include class Contact { - public: - Contact(); - ~Contact(); - std::string index; - std::string first; - std::string last; - std::string nick; - void add_index(std::string str); - void add_first(std::string str); - void add_last (std::string str); - void add_nick (std::string str); - void print_contact(); + +public: + + Contact(); + ~Contact(); + + void add_first(std::string str); + void add_last (std::string str); + void add_nick (std::string str); + void add_num(std::string str); + void add_secret(std::string str); + + void print_contact(); + +private: + + std::string first; + std::string last; + std::string nick; + std::string num; + std::string secret; + }; #endif +/* + * create_contact (first ; last ; nick ; num ; secret) + * get_first + * get_last + * get_nick + * print_contact + */ diff --git a/d00/ex01/Makefile b/d00/ex01/Makefile index f2b051c..40e09b3 100644 --- a/d00/ex01/Makefile +++ b/d00/ex01/Makefile @@ -15,12 +15,14 @@ LIBS = INCLUDES = -I$(D_HEADERS) -D_HEADERS = . -HEADERS = PhoneBook.class.hpp \ - PhoneBook.class.cpp - D_SRCS = . SRCS = main.cpp \ + Contact.class.cpp \ + PhoneBook.class.cpp + +D_HEADERS = . +HEADERS = Contact.class.hpp \ + PhoneBook.class.hpp D_OBJS = builds OBJS = $(SRCS:%.cpp=$(D_OBJS)/%.o) diff --git a/d00/ex01/PhoneBook.class.cpp b/d00/ex01/PhoneBook.class.cpp index 13f5cc4..f1dc82f 100644 --- a/d00/ex01/PhoneBook.class.cpp +++ b/d00/ex01/PhoneBook.class.cpp @@ -1,6 +1,3 @@ -//#include -//#include -#include #include "PhoneBook.class.hpp" PhoneBook::PhoneBook( void ) { diff --git a/d00/ex01/PhoneBook.class.hpp b/d00/ex01/PhoneBook.class.hpp index 166b1c2..03b7117 100644 --- a/d00/ex01/PhoneBook.class.hpp +++ b/d00/ex01/PhoneBook.class.hpp @@ -1,6 +1,8 @@ #ifndef PHONEBOOK_CLASS_HPP # define PHONEBOOK_CLASS_HPP -#include "Contact.class.cpp" + +#include "Contact.class.hpp" +#include class PhoneBook { public: diff --git a/d00/ex01/builds/Contact.class.o b/d00/ex01/builds/Contact.class.o new file mode 100644 index 0000000..b59b470 Binary files /dev/null and b/d00/ex01/builds/Contact.class.o differ diff --git a/d00/ex01/builds/PhoneBook.class.o b/d00/ex01/builds/PhoneBook.class.o new file mode 100644 index 0000000..b7bc3a2 Binary files /dev/null and b/d00/ex01/builds/PhoneBook.class.o differ diff --git a/d00/ex01/builds/PhoneBook.o b/d00/ex01/builds/PhoneBook.o deleted file mode 100644 index 1633f08..0000000 Binary files a/d00/ex01/builds/PhoneBook.o and /dev/null differ diff --git a/d00/ex01/builds/main.o b/d00/ex01/builds/main.o index 552f348..c06f764 100644 Binary files a/d00/ex01/builds/main.o and b/d00/ex01/builds/main.o differ diff --git a/d00/ex01/main.cpp b/d00/ex01/main.cpp index ab32f1e..2565c6f 100644 --- a/d00/ex01/main.cpp +++ b/d00/ex01/main.cpp @@ -1,10 +1,34 @@ -#include "PhoneBook.class.cpp" -#include +#include "PhoneBook.class.hpp" +#include "Contact.class.hpp" + +# include +# include int main() { - PhoneBook yellow; - yellow.contact.add_first("hugo"); - yellow.contact.print_contact(); + Contact new_contact; + new_contact.add_first("hugo"); + new_contact.add_last("lamy"); + new_contact.add_nick("hugonosaure"); + new_contact.add_num("0123456789"); + new_contact.add_secret("je suis un dino"); + new_contact.print_contact(); return 0; } + +/* + * class PhoneBook : + * add_contact (->Contact.create_contact) + * search_contact + * print_phonebook (->Contact.get_index/name/last/nick) + * index_print (Contact.print_contact) + * exit + * + * class Contact : + * create_contact (first ; last ; nick ; num ; secret) + * get_first + * get_last + * get_nick + * print_contact + * + */ diff --git a/d00/ex01/phonebook b/d00/ex01/phonebook index bb3932e..92a8f51 100755 Binary files a/d00/ex01/phonebook and b/d00/ex01/phonebook differ