From b4495026cba340e070032b0e9a8cda14952d73fa Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sat, 28 Oct 2023 12:08:13 +0200 Subject: [PATCH] prettier printer! --- src/Projet.cpp | 9 ++++----- src/Tache.cpp | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Projet.cpp b/src/Projet.cpp index c72016f..1daf917 100644 --- a/src/Projet.cpp +++ b/src/Projet.cpp @@ -35,18 +35,17 @@ const Projet &Projet::operator=(const Projet &src) { } std::ostream &Projet::print(std::ostream &out) const { + // Liste vide if (taches.empty()) { out << "[]"; return out; } - out << '['; + out << "[\n"; for (Tache *t : taches) { - out << *t << ", "; + out << " " << *t << ",\n"; } - - // \b\b permet de retirer la dernière virgule - out << "\b\b]"; + out << ']'; return out; } diff --git a/src/Tache.cpp b/src/Tache.cpp index 316db4f..a5ecacf 100644 --- a/src/Tache.cpp +++ b/src/Tache.cpp @@ -50,7 +50,7 @@ std::ostream &operator<<(std::ostream &out, const Tache::Etat &data) { std::ostream &operator<<(std::ostream &out, const Tache &data) { out << "Tâche(#" << data.unique_id << ", \"" << data.name << "\", " - << data.etat << ") => " << data.dependances.size() << " dépendances"; + << data.etat << ")\t=> " << data.dependances.size() << " dépendances"; return out; }