|
|
|
@ -56,30 +56,20 @@ namespace Compiler
|
|
|
|
|
Log(logLevel) << text.str();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContextRestore StreamErrorHandler::setContext(const std::string &context, bool restore)
|
|
|
|
|
void StreamErrorHandler::setContext(const std::string &context)
|
|
|
|
|
{
|
|
|
|
|
if (!restore)
|
|
|
|
|
{
|
|
|
|
|
mContext = context;
|
|
|
|
|
return {nullptr, {}};
|
|
|
|
|
}
|
|
|
|
|
ContextRestore restorer(this, mContext);
|
|
|
|
|
mContext = context;
|
|
|
|
|
return restorer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StreamErrorHandler::StreamErrorHandler() {}
|
|
|
|
|
|
|
|
|
|
ContextRestore::ContextRestore(StreamErrorHandler* handler, const std::string& context) : mHandler(handler), mContext(context) {}
|
|
|
|
|
|
|
|
|
|
ContextRestore::ContextRestore(ContextRestore&& other) : mHandler(other.mHandler), mContext(other.mContext)
|
|
|
|
|
ContextOverride::ContextOverride(StreamErrorHandler& handler, const std::string& context) : mHandler(handler), mContext(handler.mContext)
|
|
|
|
|
{
|
|
|
|
|
other.mHandler = nullptr;
|
|
|
|
|
mHandler.setContext(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContextRestore::~ContextRestore()
|
|
|
|
|
ContextOverride::~ContextOverride()
|
|
|
|
|
{
|
|
|
|
|
if(mHandler)
|
|
|
|
|
mHandler->setContext(mContext);
|
|
|
|
|
mHandler.setContext(mContext);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|