mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-04 12:28:35 +02:00
TDB2
- Added TDB2::all_tasks as a helper function to load and combine tasks from pending and completed.
This commit is contained in:
parent
a3cb1172a1
commit
195c7d5142
2 changed files with 14 additions and 0 deletions
13
src/TDB2.cpp
13
src/TDB2.cpp
|
@ -1642,6 +1642,19 @@ int TDB2::next_id ()
|
||||||
return _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.
|
// Locate task by ID.
|
||||||
bool TDB2::get (int id, Task& task)
|
bool TDB2::get (int id, Task& task)
|
||||||
|
|
|
@ -103,6 +103,7 @@ public:
|
||||||
int next_id ();
|
int next_id ();
|
||||||
|
|
||||||
// Generalized task accessors.
|
// Generalized task accessors.
|
||||||
|
const std::vector <Task> all_tasks ();
|
||||||
bool get (int, Task&);
|
bool get (int, Task&);
|
||||||
bool get (const std::string&, Task&);
|
bool get (const std::string&, Task&);
|
||||||
const std::vector <Task> siblings (Task&);
|
const std::vector <Task> siblings (Task&);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue