Bug
- Fixed bug in DOM access where the attribute name was not being properly used for UUID-based lookup.
This commit is contained in:
14
src/DOM.cpp
14
src/DOM.cpp
@@ -179,6 +179,8 @@ const std::string DOM::get (const std::string& name)
|
|||||||
const std::string DOM::get (const std::string& name, const Task& task)
|
const std::string DOM::get (const std::string& name, const Task& task)
|
||||||
{
|
{
|
||||||
Nibbler n (name);
|
Nibbler n (name);
|
||||||
|
n.save ();
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
std::string uuid;
|
std::string uuid;
|
||||||
std::string canonical;
|
std::string canonical;
|
||||||
@@ -189,7 +191,7 @@ const std::string DOM::get (const std::string& name, const Task& task)
|
|||||||
else if (A3::is_attribute (name, canonical)) return task.get (canonical);
|
else if (A3::is_attribute (name, canonical)) return task.get (canonical);
|
||||||
|
|
||||||
// <id>.<name>
|
// <id>.<name>
|
||||||
else if (n.getInt (id))
|
if (n.getInt (id))
|
||||||
{
|
{
|
||||||
if (n.skip ('.'))
|
if (n.skip ('.'))
|
||||||
{
|
{
|
||||||
@@ -206,10 +208,12 @@ const std::string DOM::get (const std::string& name, const Task& task)
|
|||||||
else if (attr == "urgency") return format (ref.urgency_c ());
|
else if (attr == "urgency") return format (ref.urgency_c ());
|
||||||
else if (A3::is_attribute (attr, canonical)) return ref.get (canonical);
|
else if (A3::is_attribute (attr, canonical)) return ref.get (canonical);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
n.restore ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// <uuid>.<name>
|
// <uuid>.<name>
|
||||||
else if (n.getUUID (uuid))
|
if (n.getUUID (uuid))
|
||||||
{
|
{
|
||||||
if (n.skip ('.'))
|
if (n.skip ('.'))
|
||||||
{
|
{
|
||||||
@@ -222,10 +226,12 @@ const std::string DOM::get (const std::string& name, const Task& task)
|
|||||||
std::string attr;
|
std::string attr;
|
||||||
n.getUntilEOS (attr);
|
n.getUntilEOS (attr);
|
||||||
|
|
||||||
if (name == "id") return format (ref.id);
|
if (attr == "id") return format (ref.id);
|
||||||
else if (name == "urgency") return format (ref.urgency_c (), 4, 3);
|
else if (attr == "urgency") return format (ref.urgency_c (), 4, 3);
|
||||||
else if (A3::is_attribute (attr, canonical)) return ref.get (canonical);
|
else if (A3::is_attribute (attr, canonical)) return ref.get (canonical);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
n.restore ();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delegate to the context-free version of DOM::get.
|
// Delegate to the context-free version of DOM::get.
|
||||||
|
|||||||
Reference in New Issue
Block a user