本文整理汇总了C++中QScriptValueImpl::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ QScriptValueImpl::isNull方法的具体用法?C++ QScriptValueImpl::isNull怎么用?C++ QScriptValueImpl::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QScriptValueImpl
的用法示例。
在下文中一共展示了QScriptValueImpl::isNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: method_apply
QScriptValueImpl Function::method_apply(QScriptContextPrivate *context, QScriptEnginePrivate *eng, QScriptClassInfo *)
{
if (! context->thisObject().isFunction()) {
return context->throwError(QScriptContext::TypeError,
QLatin1String("Function.prototype.apply"));
}
QScriptValueImpl thisObject = context->argument(0).toObject();
if (! (thisObject.isValid () && thisObject.isObject()))
thisObject = eng->globalObject();
QScriptValueImplList args;
QScriptValueImpl undefined = eng->undefinedValue();
QScriptValueImpl arg = context->argument(1);
if (Ecma::Array::Instance *arr = eng->arrayConstructor->get(arg)) {
QScript::Array actuals = arr->value;
for (quint32 i = 0; i < actuals.count(); ++i) {
QScriptValueImpl a = actuals.at(i);
if (! a.isValid())
args << undefined;
else
args << a;
}
} else if (arg.classInfo() == eng->m_class_arguments) {
QScript::ArgumentsObjectData *arguments;
arguments = static_cast<QScript::ArgumentsObjectData*> (arg.objectData());
QScriptObject *activation = arguments->activation.objectValue();
for (uint i = 0; i < arguments->length; ++i)
args << activation->m_objects[i];
} else if (!(arg.isUndefined() || arg.isNull())) {
return context->throwError(QScriptContext::TypeError,
QLatin1String("Function.prototype.apply: second argument is not an array"));
}
return context->thisObject().call(thisObject, args);
}
示例2: method_test
QScriptValueImpl RegExp::method_test(QScriptContextPrivate *context, QScriptEnginePrivate *eng, QScriptClassInfo *classInfo)
{
QScriptValueImpl r = method_exec(context, eng, classInfo);
return QScriptValueImpl(!r.isNull());
}