diff --git a/d00/ex01/Contact.class.cpp b/d00/ex01/Contact.class.cpp index 6a64ef2..c1ffbe1 100644 --- a/d00/ex01/Contact.class.cpp +++ b/d00/ex01/Contact.class.cpp @@ -1,6 +1,11 @@ #include "Contact.class.hpp" Contact::Contact( void ) { + this->add_first("NOT DEFINED"); + this->add_last("NOT DEFINED"); + this->add_nick("NOT DEFINED"); + this->add_num("NOT DEFINED"); + this->add_secret("NOT DEFINED"); return; } @@ -8,32 +13,17 @@ Contact::~Contact( void ) { 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; -} +// ADD +void Contact::add_first( std::string str ) {this->first.assign(str);} +void Contact::add_last( std::string str ) {this->last.assign(str);} +void Contact::add_nick( std::string str ) {this->nick.assign(str);} +void Contact::add_num( std::string str ) {this->num.assign(str);} +void Contact::add_secret( std::string str ) {this->secret.assign(str);} + +// GET +std::string Contact::get_first( void ) {return first;} +std::string Contact::get_last( void ) {return last;} +std::string Contact::get_nick( void ) {return nick;} +std::string Contact::get_num( void ) {return num;} +std::string Contact::get_secret( void ) {return secret;} -void Contact::print_contact( void ) { - 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 871ff8a..e27aabd 100644 --- a/d00/ex01/Contact.class.hpp +++ b/d00/ex01/Contact.class.hpp @@ -17,6 +17,12 @@ public: void add_num(std::string str); void add_secret(std::string str); + std::string get_first(); + std::string get_last (); + std::string get_nick (); + std::string get_num(); + std::string get_secret(); + void print_contact(); private: diff --git a/d00/ex01/PhoneBook.class.cpp b/d00/ex01/PhoneBook.class.cpp index f1dc82f..82bbba2 100644 --- a/d00/ex01/PhoneBook.class.cpp +++ b/d00/ex01/PhoneBook.class.cpp @@ -1,13 +1,26 @@ #include "PhoneBook.class.hpp" +#include "Contact.class.hpp" PhoneBook::PhoneBook( void ) { - return; - } PhoneBook::~PhoneBook( void ) { - return; - } + + /* + Contact new_contact; + + new_contact.add_first(name); + new_contact.add_last("lamy"); + new_contact.add_nick("hugonosaure"); + new_contact.add_num("0123456789"); + new_contact.add_secret("je suis un dino"); + + std::cout << "FIRST NAME : " << new_contact.get_first() << std::endl; + std::cout << "LAST NAME : " << new_contact.get_last() << std::endl; + std::cout << "NICKNAME : " << new_contact.get_nick() << std::endl; + std::cout << "NUMBER : " << new_contact.get_num() << std::endl; + std::cout << "SECRET : " << new_contact.get_secret() << std::endl; + */ diff --git a/d00/ex01/builds/Contact.class.o b/d00/ex01/builds/Contact.class.o index b59b470..ad9941f 100644 Binary files a/d00/ex01/builds/Contact.class.o and b/d00/ex01/builds/Contact.class.o differ diff --git a/d00/ex01/builds/main.o b/d00/ex01/builds/main.o index c06f764..e2dd9a3 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 2565c6f..d9013eb 100644 --- a/d00/ex01/main.cpp +++ b/d00/ex01/main.cpp @@ -1,34 +1,27 @@ #include "PhoneBook.class.hpp" -#include "Contact.class.hpp" # include # include int main() { - 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(); + std::string cmd; + + while (1) + { + std::getline(std::cin, cmd); + if (cmd.compare("ADD") == 0) + std::cout << "it works !" << std::endl; + } + + return 0; } /* * class PhoneBook : - * add_contact (->Contact.create_contact) - * search_contact - * print_phonebook (->Contact.get_index/name/last/nick) - * index_print (Contact.print_contact) + * add_contact + * print_phonebook + * search_by_index * 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 92a8f51..d87fd62 100755 Binary files a/d00/ex01/phonebook and b/d00/ex01/phonebook differ