TDB2
- Added TDB2::all_tasks as a helper function to load and combine tasks from pending and completed.
This commit is contained in:
13
src/TDB2.cpp
13
src/TDB2.cpp
@@ -1642,6 +1642,19 @@ int TDB2::next_id ()
|
||||
return _id++;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
const std::vector <Task> TDB2::all_tasks ()
|
||||
{
|
||||
std::vector <Task> all = pending.get_tasks ();
|
||||
std::vector <Task> extra = completed.get_tasks ();
|
||||
|
||||
std::vector <Task>::iterator task;
|
||||
for (task = extra.begin (); task != extra.end (); ++task)
|
||||
all.push_back (*task);
|
||||
|
||||
return all;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Locate task by ID.
|
||||
bool TDB2::get (int id, Task& task)
|
||||
|
||||
@@ -103,6 +103,7 @@ public:
|
||||
int next_id ();
|
||||
|
||||
// Generalized task accessors.
|
||||
const std::vector <Task> all_tasks ();
|
||||
bool get (int, Task&);
|
||||
bool get (const std::string&, Task&);
|
||||
const std::vector <Task> siblings (Task&);
|
||||
|
||||
Reference in New Issue
Block a user