本文整理汇总了C++中var::getObject方法的典型用法代码示例。如果您正苦于以下问题:C++ var::getObject方法的具体用法?C++ var::getObject怎么用?C++ var::getObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类var
的用法示例。
在下文中一共展示了var::getObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nativeFunction
var HiseJavascriptEngine::RootObject::FunctionCall::invokeFunction(const Scope& s, const var& function, const var& thisObject) const
{
s.checkTimeOut(location);
var argVars[16];
const int thisNumArgs = jmin<int>(16, arguments.size());
for (int i = 0; i < thisNumArgs; i++)
{
argVars[i] = arguments.getUnchecked(i)->getResult(s);
}
const var::NativeFunctionArgs args(thisObject, argVars, thisNumArgs);
if (var::NativeFunction nativeFunction = function.getNativeFunction())
return nativeFunction(args);
if (FunctionObject* fo = dynamic_cast<FunctionObject*> (function.getObject()))
return fo->invoke(s, args);
if (DotOperator* dot = dynamic_cast<DotOperator*> (object.get()))
if (DynamicObject* o = thisObject.getDynamicObject())
if (o->hasMethod(dot->child)) // allow an overridden DynamicObject::invokeMethod to accept a method call.
return o->invokeMethod(dot->child, args);
location.throwError("This expression is not a function!"); return var();
}
示例2: invoke
const var var::invoke (const var& targetObject, const var* arguments, int numArguments) const
{
if (isMethod())
{
DynamicObject* const target = targetObject.getObject();
if (target != 0)
return (target->*(value.methodValue)) (arguments, numArguments);
}
return var::null;
}
示例3:
bool HiseJavascriptEngine::RootObject::isFunction(const var& v) noexcept
{
return dynamic_cast<FunctionObject*> (v.getObject()) != nullptr;
}