本文整理汇总了C++中kjs::Object::hasProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ Object::hasProperty方法的具体用法?C++ Object::hasProperty怎么用?C++ Object::hasProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kjs::Object
的用法示例。
在下文中一共展示了Object::hasProperty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addBindingsClass
void JSObjectProxy::addBindingsClass( KJS::ExecState *exec, KJS::Object & /*object*/ ) {
KJS::Identifier clazzid;
QObject *o = obj;
Bindings::BindingObject *bo = dynamic_cast<Bindings::BindingObject *>( o );
if ( bo ) {
clazzid = KJS::Identifier( bo->jsClassName() ? bo->jsClassName() : obj->className() );
} else {
clazzid = KJS::Identifier( obj->className() );
}
KJS::Object global = js->globalObject();
if ( global.hasProperty( exec, clazzid ) ) {
kdDebug( 80001 ) << "addBindingsClass() " << clazzid.qstring() << " already known" << endl;
KJS::Object clazz = global.get( exec, clazzid ).toObject( exec );
Bindings::JSFactoryImp *imp = dynamic_cast<Bindings::JSFactoryImp *>( clazz.imp() );
if ( !imp ) {
kdWarning() << "addBindingsClass() Class was not created by normal means" << endl;
return ;
}
kdDebug( 80001 ) << "addBindingsClass() Adding enums" << endl;
imp->setDefaultValue( js->builtinObject().construct( exec, KJS::List() ) );
addBindingsEnum( exec, clazz );
} else {
kdWarning() << "addBindingsClass() " << clazzid.qstring() << " not known" << endl;
}
}
示例2: constructorList
KJS::List KJSEmbedPart::constructorList() const
{
KJS::List items;
KJS::Object obj = js->globalObject();
KJS::ExecState *exec = js->globalExec();
KJS::ReferenceList l = obj.propList( exec );
KJS::ReferenceListIterator propIt = l.begin();
while ( propIt != l.end() ) {
KJS::Identifier name = propIt->getPropertyName( exec );
if ( obj.hasProperty( exec, name ) ) {
KJS::Value v = obj.get( exec, name );
KJS::Object vobj = v.toObject( exec );
if ( vobj.implementsConstruct() )
items.append( KJS::String( name.ustring() ) );
}
propIt++;
}
return items;
}
示例3: addSlotBinding
void JSObjectProxy::addSlotBinding( const QCString &name, KJS::ExecState *exec, KJS::Object &object ) {
// Lookup and bind slot
QMetaObject * mo = obj->metaObject();
int slotid = mo->findSlot( name.data(), true );
if ( slotid == -1 )
return ;
const QMetaData *md = mo->slot( slotid, true );
if ( md->access != QMetaData::Public )
return ;
// Find signature
int id = Bindings::JSSlotUtils::findSignature( name );
// kdDebug( 80001 )<<"JSObjectProxy::addSlotBinding()::slot:"<<name<<" id:"<<id<<endl;
if ( id < 0 )
return ;
QCString jsname = name;
jsname.detach();
jsname.replace( QRegExp( "\\([^\\)]*\\)" ), "" );
// Find the return type, we only care if it is a pointer type
const QUMethod *m = md->method;
const char *retclass = 0;
QCString ptr( "ptr" );
if ( m->count && ( m->parameters->inOut == QUParameter::Out )
&& ( ptr == m->parameters->type->desc() ) ) {
retclass = ( const char * ) m->parameters->typeExtra;
// kdDebug(80001) << "Return type is a pointer, type " << retclass << endl;
}
// Create the Imp
JSObjectProxyImp *imp = new JSObjectProxyImp( exec, JSObjectProxyImp::MethodSlot,
retclass ? retclass : "", id, name, this );
if ( !object.hasProperty( exec, KJS::Identifier( jsname ) ) ) {
// The identifier is unused
object.put( exec, KJS::Identifier( jsname.data() ), KJS::Object( imp ) );
} else {
// The identifier has already been used
QString s( name );
QCString cs = QString( "%1%2" ).arg( jsname ).arg( s.contains( ',' ) + 1 ).ascii();
//kdDebug(80001) << "Method " << jsname << " exists, using " << cs << " for " << s << endl;
object.put( exec, KJS::Identifier( cs.data() ), KJS::Object( imp ) );
}
}