本文整理汇总了C++中js::Value::setInt32方法的典型用法代码示例。如果您正苦于以下问题:C++ Value::setInt32方法的具体用法?C++ Value::setInt32怎么用?C++ Value::setInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类js::Value
的用法示例。
在下文中一共展示了Value::setInt32方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: funcArgs
void
JavaScriptFilterService::doIdle(void)
{
ODL_OBJENTER(); //####
if (isActive())
{
ODL_LOG("(isActive())"); //####
if (_goAhead.check())
{
ODL_LOG("(_goAhead.check())"); //####
if (_scriptThreadFunc.isNullOrUndefined())
{
ODL_LOG("(_scriptThreadFunc.isNullOrUndefined())"); //####
// We have a request from an input handler.
if (_inHandlers.size() > _mostRecentSlot)
{
ODL_LOG("(getInletCount() > _mostRecentSlot)"); //####
JS::HandleValue handlerFunc = _inletHandlers[_mostRecentSlot];
JavaScriptFilterInputHandler * aHandler = _inHandlers.at(_mostRecentSlot);
if (aHandler && (! handlerFunc.isNullOrUndefined()))
{
ODL_LOG("(aHandler && (! handlerFunc.isNullOrUndefined()))"); //####
JS::RootedValue argValue(_context);
JS::Value slotNumberValue;
JS::AutoValueVector funcArgs(_context);
JS::RootedValue funcResult(_context);
slotNumberValue.setInt32(static_cast<int32_t>(_mostRecentSlot));
createValueFromBottle(_context, aHandler->getReceivedData(), &argValue);
funcArgs.append(slotNumberValue);
funcArgs.append(argValue);
JS_BeginRequest(_context);
if (JS_CallFunctionValue(_context, _global, handlerFunc, funcArgs,
&funcResult))
{
// We don't care about the function result, as it's supposed to just
// write to the outlet stream(s).
}
else
{
ODL_LOG("! (JS_CallFunctionValue(_context, _global, " //####
"handlerFunc, funcArgs, &funcResult))"); //####
JS::RootedValue exc(_context);
if (JS_GetPendingException(_context, &exc))
{
JS_ClearPendingException(_context);
std::stringstream buff;
YarpString message("Exception occurred while executing "
"handler function for inlet ");
buff << _mostRecentSlot;
message += buff.str();
message += ".";
MpM_FAIL_(message.c_str());
}
}
JS_EndRequest(_context);
}
}
_staller.post();
}
else
{
ODL_LOG("! (_scriptThreadFunc.isNullOrUndefined())"); //####
try
{
JS::AutoValueVector funcArgs(_context);
JS::RootedValue funcResult(_context);
JS_BeginRequest(_context);
if (JS_CallFunctionValue(_context, _global, _scriptThreadFunc, funcArgs,
&funcResult))
{
ODL_LOG("(JS_CallFunctionValue(_context, _global, " //####
"_scriptThreadFunc, funcArgs, &funcResult))"); //####
// We don't care about the function result, as it's supposed to just perform
// an iteration of the thread.
}
else
{
ODL_LOG("! (JS_CallFunctionValue(_context, _global, " //####
"_scriptThreadFunc, funcArgs, &funcResult))"); //####
JS::RootedValue exc(_context);
if (JS_GetPendingException(_context, &exc))
{
ODL_LOG("(JS_GetPendingException(_context, &exc))"); //####
JS_ClearPendingException(_context);
MpM_FAIL_("Exception occurred while executing the scriptThread "
"function.");
}
}
JS_EndRequest(_context);
}
catch (...)
{
ODL_LOG("Exception caught"); //####
throw;
//.........这里部分代码省略.........