- Added TDB2::all_tasks as a helper function to load and combine tasks
  from pending and completed.
This commit is contained in:
Paul Beckingham 2011-09-05 10:45:58 -04:00
parent a3cb1172a1
commit 195c7d5142
2 changed files with 14 additions and 0 deletions

View file

@ -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)

View file

@ -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&);