Helper Command

- Added _query helper command for script writers, which accepts a filter like
  any other report, but returns raw JSON.
This commit is contained in:
Paul Beckingham 2010-12-26 10:00:41 -05:00
parent 126a3d88b5
commit 7f32435ce9
8 changed files with 72 additions and 0 deletions

View file

@ -423,6 +423,29 @@ std::string Task::composeYAML () const
return out.str ();
}
////////////////////////////////////////////////////////////////////////////////
std::string Task::composeJSON () const
{
std::stringstream out;
out << "{";
std::map <std::string, Att>::const_iterator i;
for (i = this->begin (); i != this->end (); ++i)
{
if (i != this->begin ())
out << ",";
out << "\""
<< i->second.name ()
<< "\":\""
<< i->second.value ()
<< "\"";
}
out << "}";
return out.str ();
}
////////////////////////////////////////////////////////////////////////////////
void Task::getAnnotations (std::vector <Att>& annotations) const
{