forked from University/epr24pr5-ojanssen2
fix: another Task one
This commit is contained in:
parent
f803d604a0
commit
36e4ff362d
2 changed files with 15 additions and 5 deletions
14
Task.cpp
14
Task.cpp
|
@ -55,8 +55,16 @@ namespace models
|
||||||
ostream& operator<<(ostream& os, const Task& t)
|
ostream& operator<<(ostream& os, const Task& t)
|
||||||
{
|
{
|
||||||
os << t.get_id() << " %" << t.get_name() << "% %" << t.get_description();
|
os << t.get_id() << " %" << t.get_name() << "% %" << t.get_description();
|
||||||
for (const int id : t.children)
|
// Fügt Childen Task mit passenden Lehrzeichen hinzu
|
||||||
os << " " << id << " ";
|
if (!t.children.empty())
|
||||||
|
os << " ";
|
||||||
|
for (size_t i = 0; i < t.children.size(); ++i) {
|
||||||
|
os << t.children[i];
|
||||||
|
if (i < t.children.size() - 1) {
|
||||||
|
os << " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
os << "\n";
|
os << "\n";
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
@ -71,6 +79,8 @@ namespace models
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string name = Util::read_string_between_percent(is);
|
string name = Util::read_string_between_percent(is);
|
||||||
|
if (name == "")
|
||||||
|
throw Error(102, "Ein Parameter eines Befehls konnte nicht gelesen werden");
|
||||||
string description = Util::read_string_between_percent(is);
|
string description = Util::read_string_between_percent(is);
|
||||||
vector<int> children = Util::read_numbers(is);
|
vector<int> children = Util::read_numbers(is);
|
||||||
t = {id, name, description, children};
|
t = {id, name, description, children};
|
||||||
|
|
6
main.cpp
6
main.cpp
|
@ -50,16 +50,16 @@ int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
sc->run(parameter);
|
sc->run(parameter);
|
||||||
if (sc->should_display_result())
|
if (sc->should_display_result())
|
||||||
cout << "100\nAlles erfolgreich\n";
|
cout << "100: Alles erfolgreich\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Error& e)
|
catch (Error& e)
|
||||||
{
|
{
|
||||||
cout << e.get_nr() << "\n" << e.what() << "\n";
|
cout << e.get_nr() << ": " << e.what() << "\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cout << "101\nBefehl ist unbekannt.\n";
|
cout << "101: Befehl ist unbekannt.\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue