|
|
@ -13,38 +13,42 @@ Contact::Contact(const Personne& Proprietaire): Proprietaire{Proprietaire} {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool Contact::ajouterContact(const Personne& unContact){
|
|
|
|
bool Contact::ajouterContact(const Personne& unContact){
|
|
|
|
// if(lesContacts.empty()){
|
|
|
|
if(lesContacts.empty()){
|
|
|
|
// lesContacts.push_front(&unContact);
|
|
|
|
lesContacts.push_back(&unContact);
|
|
|
|
// return true;
|
|
|
|
cout << "Contact ajouté " << unContact <<"\n";
|
|
|
|
// }
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
if(unContact==Proprietaire)
|
|
|
|
if(unContact==Proprietaire)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
cout << "Erreur : Contact déjà existant (Proprietaire)\n";
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
// list<const Personne*>::iterator it = find(lesContacts.begin(), lesContacts.end(), unContact);
|
|
|
|
}
|
|
|
|
// if(it!=lesContacts.end())
|
|
|
|
list<const Personne*>::iterator it = find(lesContacts.begin(), lesContacts.end(), &unContact);
|
|
|
|
// cout << "trouvé : " << *it << "\n";
|
|
|
|
if(it!=lesContacts.end())
|
|
|
|
// else
|
|
|
|
cout << " Contact trouvé : " << *it << "\n";
|
|
|
|
// cout << "pas trouvé\n";
|
|
|
|
else
|
|
|
|
// this->rechercher(unContact);
|
|
|
|
cout << "Erreur : Contact pas trouvé\n";
|
|
|
|
lesContacts.push_front(&unContact);
|
|
|
|
// rechercher(unContact);
|
|
|
|
|
|
|
|
lesContacts.push_back(&unContact);
|
|
|
|
// for(int i=0;i<lesContacts.size();i++)
|
|
|
|
// for(int i=0;i<lesContacts.size();i++)
|
|
|
|
cout << "Contact ajouté " << lesContacts <<"\n";
|
|
|
|
cout << "Contact ajouté " << unContact <<"\n";
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// bool Contact::rechercher(const Personne& unContact){
|
|
|
|
bool Contact::rechercher(const Personne& unContact){
|
|
|
|
// list<const Personne*>::iterator it = find(this->lesContacts.begin(), this->lesContacts.end(),unContact);
|
|
|
|
list<const Personne*>::iterator it = find(lesContacts.begin(), lesContacts.end(),&unContact);
|
|
|
|
// if(it==this->lesContacts.end())
|
|
|
|
if(it != lesContacts.end())
|
|
|
|
// return false;
|
|
|
|
{
|
|
|
|
// else
|
|
|
|
cout << "trouvé : " << unContact << "\n";
|
|
|
|
// return true;
|
|
|
|
return true;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
// bool Wagon::ajouter(const Passager& passager){
|
|
|
|
{
|
|
|
|
// if(lesPassagers.size() >= capacite)
|
|
|
|
cout << "pas trouvé1\n";
|
|
|
|
// return false;
|
|
|
|
return false;
|
|
|
|
// lesPassagers.push_front(&passager);
|
|
|
|
}
|
|
|
|
// return true;
|
|
|
|
lesContacts.sort();
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// bool Contact::supprimerContact(const Personne& unContact){
|
|
|
|
// bool Contact::supprimerContact(const Personne& unContact){
|
|
|
|
// //remove
|
|
|
|
// //remove
|
|
|
|