Refactor getDOM to use a pointer for the optional context
It's possible to call getDOM without a contextual task. Previously, this was done by referencing a "dummy" task which necessitated a way to distinguish such dummy tasks. This switches to using a pointer and treating the NULL value as meaning there is no context. Note that this cannot use `std::optional<&Task>`, as optional does not support reference types.
This commit is contained in:
committed by
Tomas Babej
parent
3af5ceadc1
commit
2812a8c77a
@@ -36,7 +36,7 @@
|
||||
#include <utf8.h>
|
||||
#include <util.h>
|
||||
|
||||
extern Task& contextTask;
|
||||
extern Task* contextTask;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
ColumnProject::ColumnProject ()
|
||||
@@ -121,7 +121,7 @@ void ColumnProject::modify (Task& task, const std::string& value)
|
||||
{
|
||||
Eval e;
|
||||
e.addSource (domSource);
|
||||
contextTask = task;
|
||||
contextTask = &task;
|
||||
|
||||
Variant v;
|
||||
e.evaluateInfixExpression (value, v);
|
||||
|
||||
Reference in New Issue
Block a user