-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskList.cpp
More file actions
executable file
·30 lines (27 loc) · 900 Bytes
/
Copy pathTaskList.cpp
File metadata and controls
executable file
·30 lines (27 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "TaskLish.h"
// implements the operator() function which returns the result of a "less than"
// comparison ( *obj1 < *obj2 )
bool TaskComparator::operator()(const Task* firstTask, const Task* secondTask) const {
if (firstTask->getDeadline() < secondTask->getDeadline()) {
return true;
}
else if (firstTask->getDeadline() == secondTask->getDeadline()) {
return firstTask->getDescription() < secondTask->getDescription();
}
else {
return false;
}
}
void TaskList::print(bool detailed) const {
unsigned int i = 1;
for (auto it = tasks.begin(), it_end = tasks.end(); it != it_end; ++it, i++) {
cout << i << ". ";
(*it)->print(detailed);
}
}
void TaskList::dump(ostream& out) const {
for (auto it = tasks.begin(), it_end = tasks.end(); it != it_end; ++it) {
(*it)->dump(out);
out << "\n";
}
}