mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
TDB2
- Implemented CmdAdd.cpp and CmdLog.cpp using TDB2. - Implemented simple append writes in TDB2. - Modified CmdImport to accept and parse JSON. - Added more const-ness in DOM, Expression and Task, to allow TDB2::get_tasks to return a const vector ref, which is a Very Good Thing. - Corrected usage for the export command. - Implemented Task::urgency as a call to Task::urgency_c, which is a const overload to allow urgency calculations (without caching) for const Task objects. - Removed obolete code from TDB. - Added lots of diagnostic output for TDB2 - it's annoying, but will be gone soon. - Added mention in CmdHelp of the new <filter> and <modifications> syntax elements. Needs more. - Added Command::filter overload which uses TDB2. Not in use yet.
This commit is contained in:
parent
523c4dfcca
commit
8827f9c978
18 changed files with 400 additions and 173 deletions
|
@ -283,6 +283,48 @@ void Command::filter (std::vector <Task>& input, std::vector <Task>& output)
|
|||
output = input;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Command::filter (std::vector <Task>& output)
|
||||
{
|
||||
Timer timer ("Command::filter");
|
||||
|
||||
Arguments f;
|
||||
if (read_only ())
|
||||
f = context.args.extract_read_only_filter ();
|
||||
else
|
||||
f = context.args.extract_write_filter ();
|
||||
|
||||
if (f.size ())
|
||||
{
|
||||
const std::vector <Task>& pending = context.tdb2.pending.get_tasks ();
|
||||
const std::vector <Task>& completed = context.tdb2.completed.get_tasks (); // TODO Optional
|
||||
|
||||
Expression e (f);
|
||||
|
||||
output.clear ();
|
||||
std::vector <Task>::const_iterator task;
|
||||
for (task = pending.begin (); task != pending.end (); ++task)
|
||||
if (e.eval (*task))
|
||||
output.push_back (*task);
|
||||
|
||||
for (task = completed.begin (); task != completed.end (); ++task)
|
||||
if (e.eval (*task))
|
||||
output.push_back (*task);
|
||||
}
|
||||
else
|
||||
{
|
||||
const std::vector <Task>& pending = context.tdb2.pending.get_tasks ();
|
||||
const std::vector <Task>& completed = context.tdb2.completed.get_tasks ();
|
||||
|
||||
std::vector <Task>::const_iterator task;
|
||||
for (task = pending.begin (); task != pending.end (); ++task)
|
||||
output.push_back (*task);
|
||||
|
||||
for (task = completed.begin (); task != completed.end (); ++task)
|
||||
output.push_back (*task);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Apply the modifications in arguments to the task.
|
||||
void Command::modify_task_description_replace (Task& task, Arguments& arguments)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue