本文整理汇总了C++中actiontools::ActionInstance::exceptionActionInstance方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionInstance::exceptionActionInstance方法的具体用法?C++ ActionInstance::exceptionActionInstance怎么用?C++ ActionInstance::exceptionActionInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类actiontools::ActionInstance
的用法示例。
在下文中一共展示了ActionInstance::exceptionActionInstance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: executionException
void Executer::executionException(int exception,
const QString &message)
{
ActionTools::ActionInstance *actionInstance = currentActionInstance();
bool standardException = (exception >= 0 && exception < ActionTools::ActionException::ExceptionCount);
bool customException = false;
for(ActionTools::ActionException *actionException: actionInstance->definition()->exceptions())
{
if(actionException->id() == exception)
{
customException = true;
break;
}
}
if(!standardException && !customException)
{
mConsoleWidget->addDesignErrorLine(tr("Action design error: Invalid exception emitted (%1, line %2)")
.arg(actionInstance->definition()->name())
.arg(mCurrentActionIndex+1), ActionTools::ConsoleWidget::Error);
stopExecution();
return;
}
ActionTools::ActionException::ExceptionActionInstance exceptionActionInstance = actionInstance->exceptionActionInstance(static_cast<ActionTools::ActionException::Exception>(exception));
ActionTools::ConsoleWidget::Type exceptionType;
bool shouldStopExecution;
switch(exceptionActionInstance.action())
{
case ActionTools::ActionException::SkipExceptionAction:
exceptionType = ActionTools::ConsoleWidget::Information;
actionExecutionEnded();
shouldStopExecution = false;
break;
case ActionTools::ActionException::GotoLineExceptionAction:
{
exceptionType = ActionTools::ConsoleWidget::Information;
if(canExecuteAction(exceptionActionInstance.line()) != CanExecute)
{
ActionTools::ActionInstance *currentAction = mScript->actionAt(mCurrentActionIndex);
qint64 currentActionRuntimeId = -1;
if(currentAction)
currentActionRuntimeId = currentAction->runtimeId();
mConsoleWidget->addExceptionLine(tr("Invalid exception line: %1").arg(exceptionActionInstance.line()),
currentActionRuntimeId,
exception,
ActionTools::ConsoleWidget::Error);
shouldStopExecution = true;
}
else
{
QScriptValue script = mScriptEngine->globalObject().property("Script");
script.setProperty("nextLine", mScriptEngine->newVariant(QVariant(exceptionActionInstance.line())));
actionExecutionEnded();
shouldStopExecution = false;
}
}
break;
default:
exceptionType = ActionTools::ConsoleWidget::Error;
shouldStopExecution = true;
}
if(shouldStopExecution)
{
QString finalMessage = tr("Script line %1: ").arg(mCurrentActionIndex+1);
ActionTools::ActionInstance *currentAction = mScript->actionAt(mCurrentActionIndex);
qint64 currentActionRuntimeId = -1;
if(currentAction)
currentActionRuntimeId = currentAction->runtimeId();
mConsoleWidget->addActionLine(finalMessage + message,
currentActionRuntimeId,
mScriptEngine->globalObject().property("currentParameter").toString(),
mScriptEngine->globalObject().property("currentSubParameter").toString(),
mScriptAgent->currentLine(),
mScriptAgent->currentColumn(),
exceptionType);
stopExecution();
}
}