本文整理汇总了C++中kjs::Object::implementsCall方法的典型用法代码示例。如果您正苦于以下问题:C++ Object::implementsCall方法的具体用法?C++ Object::implementsCall怎么用?C++ Object::implementsCall使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kjs::Object
的用法示例。
在下文中一共展示了Object::implementsCall方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startElement
bool SaxHandler::startElement( const QString &ns, const QString &ln, const QString &qn,
const QXmlAttributes &attrs )
{
if ( !jshandler.isValid() ) {
error = ErrorNoHandler;
return false;
}
KJS::Identifier funName("startElement");
if ( !jshandler.hasProperty(exec, funName) )
return QXmlDefaultHandler::startElement( ns, ln, qn, attrs );
KJS::Object fun = jshandler.get(exec, funName).toObject( exec );
if ( !fun.implementsCall() ) {
error = ErrorNotCallable;
return false;
}
KJS::List args;
args.append( KJS::String(ns) );
args.append( KJS::String(ln) );
args.append( KJS::String(qn) );
// TODO: XmlAttributes not yet supported
KJS::Value ret = fun.call( exec, jshandler, args );
return ret.toBoolean( exec );
}
示例2: callMethod
KJS::Value KJSEmbedPart::callMethod( const QString & methodName, const KJS::List & args ) const
{
KJS::ExecState *exec = js->globalExec();
KJS::Identifier id = KJS::Identifier( KJS::UString(methodName.latin1() ));
KJS::Object obj = js->globalObject();
KJS::Object fun = obj.get(exec, id ).toObject( exec );
KJS::Value retValue;
if ( !fun.implementsCall() )
{
// We need to create an exception here...
}
else
retValue = fun.call(exec, obj, args);
kdDebug( 80001 ) << "Returned type is: " << retValue.type() << endl;
if( exec->hadException() )
{
kdWarning( 80001 ) << "Got error: " << exec->exception().toString(exec).qstring() << endl;
return exec->exception();
}
else
{
if( retValue.type() == 1 && retValue.type() == 0)
{
kdDebug( 80001 ) << "Got void return type. " << endl;
return KJS::Null();
}
}
return retValue;
}
示例3: hasMethod
bool KJSEmbedPart::hasMethod( const QString & methodName )
{
KJS::ExecState *exec = js->globalExec();
KJS::Identifier id = KJS::Identifier( KJS::UString(methodName.latin1() ));
KJS::Object obj = js->globalObject();
KJS::Object fun = obj.get(exec, id ).toObject( exec );
return fun.implementsCall();
}
示例4: endDocument
bool SaxHandler::endDocument()
{
if ( !jshandler.isValid() ) {
error = ErrorNoHandler;
return false;
}
KJS::Identifier funName("endDocument");
if ( !jshandler.hasProperty(exec, funName) )
return QXmlDefaultHandler::endDocument();
KJS::Object fun = jshandler.get(exec, funName).toObject( exec );
if ( !fun.implementsCall() ) {
error = ErrorNotCallable;
return false;
}
KJS::Value ret = fun.call( exec, jshandler, KJS::List() );
return ret.toBoolean( exec );
}
示例5: characters
bool SaxHandler::characters( const QString &chars )
{
if ( !jshandler.isValid() ) {
error = ErrorNoHandler;
return false;
}
KJS::Identifier funName("characters");
if ( !jshandler.hasProperty(exec, funName) )
return QXmlDefaultHandler::characters( chars );
KJS::Object fun = jshandler.get(exec, funName).toObject( exec );
if ( !fun.implementsCall() ) {
error = ErrorNotCallable;
return false;
}
KJS::List args;
args.append( KJS::String(chars) );
KJS::Value ret = fun.call( exec, jshandler, args );
return ret.toBoolean( exec );
}