prettier printer!

This commit is contained in:
Mylloon 2023-10-28 12:08:13 +02:00
parent c22771f587
commit b4495026cb
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 5 additions and 6 deletions

View file

@ -35,18 +35,17 @@ const Projet &Projet::operator=(const Projet &src) {
} }
std::ostream &Projet::print(std::ostream &out) const { std::ostream &Projet::print(std::ostream &out) const {
// Liste vide
if (taches.empty()) { if (taches.empty()) {
out << "[]"; out << "[]";
return out; return out;
} }
out << '['; out << "[\n";
for (Tache *t : taches) { for (Tache *t : taches) {
out << *t << ", "; out << " " << *t << ",\n";
} }
out << ']';
// \b\b permet de retirer la dernière virgule
out << "\b\b]";
return out; return out;
} }

View file

@ -50,7 +50,7 @@ std::ostream &operator<<(std::ostream &out, const Tache::Etat &data) {
std::ostream &operator<<(std::ostream &out, const Tache &data) { std::ostream &operator<<(std::ostream &out, const Tache &data) {
out << "Tâche(#" << data.unique_id << ", \"" << data.name << "\", " 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; return out;
} }