mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-04 12:28:35 +02:00
DOM
- Implemented lookup for <id>.<attr> and <uuid>.<attr>.
This commit is contained in:
parent
60ca284e3a
commit
4f0276c062
1 changed files with 19 additions and 9 deletions
28
src/DOM.cpp
28
src/DOM.cpp
|
@ -235,13 +235,18 @@ const std::string DOM::get (const std::string& name, const Task& task)
|
||||||
{
|
{
|
||||||
if (n.skip ('.'))
|
if (n.skip ('.'))
|
||||||
{
|
{
|
||||||
// TODO Obtain task 'id' from TDB2.
|
Task ref;
|
||||||
|
if (id == task.id)
|
||||||
|
ref = task;
|
||||||
|
else
|
||||||
|
context.tdb2.get (id, ref);
|
||||||
|
|
||||||
std::string attr;
|
std::string attr;
|
||||||
n.getUntilEOS (attr);
|
n.getUntilEOS (attr);
|
||||||
|
|
||||||
if (attr == "id") return format (task.id);
|
if (attr == "id") return format (ref.id);
|
||||||
else if (attr == "urgency") return format (task.urgency_c (), 4, 3);
|
else if (attr == "urgency") return format (ref.urgency_c (), 4, 3);
|
||||||
else if (A3::is_attribute (name, canonical)) return task.get (canonical);
|
else if (A3::is_attribute (name, canonical)) return ref.get (canonical);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,13 +255,18 @@ const std::string DOM::get (const std::string& name, const Task& task)
|
||||||
{
|
{
|
||||||
if (n.skip ('.'))
|
if (n.skip ('.'))
|
||||||
{
|
{
|
||||||
// TODO Obtain task 'uuid' from TDB2.
|
Task ref;
|
||||||
|
if (uuid == task.get ("uuid"))
|
||||||
|
ref = task;
|
||||||
|
else
|
||||||
|
context.tdb2.get (uuid, ref);
|
||||||
|
|
||||||
std::string attr;
|
std::string attr;
|
||||||
n.getUntilEOS (attr);
|
n.getUntilEOS (attr);
|
||||||
|
|
||||||
if (name == "id") return format (task.id);
|
if (name == "id") return format (ref.id);
|
||||||
else if (name == "urgency") return format (task.urgency_c (), 4, 3);
|
else if (name == "urgency") return format (ref.urgency_c (), 4, 3);
|
||||||
else if (A3::is_attribute (name, canonical)) return task.get (canonical);
|
else if (A3::is_attribute (name, canonical)) return ref.get (canonical);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +274,7 @@ const std::string DOM::get (const std::string& name, const Task& task)
|
||||||
return this->get (name);
|
return this->get (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Need a context-specific DOM::set. For Lua.
|
// TODO Need a context-specific DOM::set. For Lua. Probably.
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void DOM::set (const std::string& name, const std::string& value)
|
void DOM::set (const std::string& name, const std::string& value)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue