mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
DOM
- Standardized DOM interface to return success/failure, with the possibility of blank values. This matches the Eval::source callback interface‥ - Added more unit tests.
This commit is contained in:
parent
850dbb36f0
commit
e6df1b38e2
6 changed files with 140 additions and 71 deletions
|
@ -25,6 +25,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <Context.h>
|
||||
#include <Filter.h>
|
||||
#include <Eval.h>
|
||||
#include <Dates.h>
|
||||
#include <main.h>
|
||||
|
@ -33,20 +34,6 @@
|
|||
|
||||
extern Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
static bool domSource (const std::string& name, Variant& value)
|
||||
{
|
||||
Task t;
|
||||
std::string resolved = context.dom.get (name, t);
|
||||
if (resolved != name)
|
||||
{
|
||||
value = Variant (resolved);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CmdCalc::CmdCalc ()
|
||||
{
|
||||
|
|
|
@ -58,12 +58,12 @@ int CmdGet::execute (std::string& output)
|
|||
for (word = words.begin (); word != words.end (); ++word)
|
||||
{
|
||||
Task t;
|
||||
std::string result = context.dom.get (*word, t);
|
||||
results.push_back (result);
|
||||
|
||||
if (result != "" &&
|
||||
result != *word)
|
||||
std::string result;
|
||||
if (context.dom.get (*word, t, result))
|
||||
{
|
||||
results.push_back (result);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
join (output, " ", results);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue