add Context::withCurrentTask
This commit is contained in:
committed by
Tomas Babej
parent
2ea6dd627e
commit
53127bf844
@@ -1328,6 +1328,12 @@ void Context::debugTiming (const std::string& details, const Timer& timer)
|
||||
debug (out.str ());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CurrentTask Context::withCurrentTask (const Task *task)
|
||||
{
|
||||
return CurrentTask(this, task);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// This capability is to answer the question of 'what did I just do to generate
|
||||
// this output?'.
|
||||
@@ -1429,6 +1435,19 @@ void Context::debug (const std::string& input)
|
||||
debugMessages.push_back (input);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CurrentTask::CurrentTask (Context *context, const Task *task)
|
||||
: context {context}, previous {context->currentTask}
|
||||
{
|
||||
context->currentTask = task;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
CurrentTask::~CurrentTask ()
|
||||
{
|
||||
context->currentTask = previous;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// vim ts=2:sw=2
|
||||
|
||||
Reference in New Issue
Block a user