本文整理汇总了C++中kjs::Object::put方法的典型用法代码示例。如果您正苦于以下问题:C++ Object::put方法的具体用法?C++ Object::put怎么用?C++ Object::put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kjs::Object
的用法示例。
在下文中一共展示了Object::put方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addBindings
void MyCustomObjectImp::addBindings( KJS::ExecState *exec, KJS::Object &object ) {
kdDebug() << "MyCustomObjectImp::addBindings()" << endl;
JSOpaqueProxy *op = JSProxy::toOpaqueProxy( object.imp() );
if ( !op ) {
kdWarning() << "MyCustomObjectImp::addBindings() failed, not a JSOpaqueProxy" << endl;
return;
}
if ( op->typeName() != "MyCustomObject" ) {
kdWarning() << "MyCustomObjectImp::addBindings() failed, type is " << op->typeName() << endl;
return;
}
JSProxy::MethodTable methods[] = {
{ Methodmode, "mode"},
{ MethodsetMode, "setMode"},
{ Methodthing, "thing"},
{ MethodsetThing, "setThing"},
{ 0, 0 }
};
int idx = 0;
do {
MyCustomObjectImp *meth = new MyCustomObjectImp( exec, methods[idx].id );
object.put( exec , methods[idx].name, KJS::Object(meth) );
++idx;
} while( methods[idx].id );
//
// Define the enum constants
//
struct EnumValue {
const char *id;
int val;
};
EnumValue enums[] = {
// MyCustomObject::mode
{ "On", 0 },
{ "Off", 1 },
{ 0, 0 }
};
int enumidx = 0;
do {
object.put( exec, enums[enumidx].id, KJS::Number(enums[enumidx].val), KJS::ReadOnly );
++enumidx;
} while( enums[enumidx].id );
}
示例2: addBindings
void TextStreamImp::addBindings( KJS::ExecState *exec, KJS::Object &parent )
{
kdDebug() << "TextStreamImp::addBindings()" << endl;
JSOpaqueProxy *op = JSProxy::toOpaqueProxy( parent.imp() );
if ( !op ) {
kdWarning() << "TextStreamImp::addBindings() failed, not a JSOpaqueProxy" << endl;
return;
}
QTextStream *ts = op->toTextStream();
if ( !ts ) {
kdWarning() << "TextStreamImp::addBindings() failed, type is " << op->typeName() << endl;
return;
}
JSProxy::MethodTable methods[] = {
{ MethodIsReadable, "isReadable" },
{ MethodIsWritable, "isWritable" },
{ MethodPrint, "print" },
{ MethodPrintLn, "println" },
{ MethodReadLine, "readLine" },
{ MethodFlush, "flush" },
{ 0, 0 }
};
int idx = 0;
do {
TextStreamImp *tsi = new TextStreamImp( exec, idx, ts );
parent.put( exec , methods[idx].name, KJS::Object(tsi) );
++idx;
} while( methods[idx].id );
}
示例3: putValue
void KJSEmbedPart::putValue( const QString & valueName, const KJS::Value & value )
{
KJS::ExecState *exec = js->globalExec();
KJS::Identifier id = KJS::Identifier( KJS::UString(valueName.latin1() ));
KJS::Object obj = js->globalObject();
obj.put(exec, id, value);
}
示例4: addObject
KJS::Object KJSEmbedPart::addObject( QObject *obj, KJS::Object &parent, const char *name )
{
KJS::Object jsobj = bind( obj );
parent.put( js->globalExec(), name ? name : obj->name(), jsobj );
return jsobj;
}
示例5: addBindings
void KstBindEllipse::addBindings(KJS::ExecState *exec, KJS::Object& obj) {
int start = KstBindViewObject::methodCount();
for (int i = 0; ellipseBindings[i].name != 0L; ++i) {
KJS::Object o = KJS::Object(new KstBindEllipse(i + start + 1));
obj.put(exec, ellipseBindings[i].name, o, KJS::Function);
}
}
示例6: 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 ) );
}
}
示例7: KFileItemImp
void KJSEmbed::Bindings::KFileItemImp::addBindings( KJS::ExecState * exec, KJS::Object & object )
{
JSOpaqueProxy *op = JSProxy::toOpaqueProxy( object.imp() );
if ( !op )
{
kdWarning() << "KFileItemImp::addBindings() failed, not a JSOpaqueProxy" << endl;
return;
}
if ( op->typeName() != "KFileItem" )
{
kdWarning() << "KFileItemImp::addBindings() failed, type is " << op->typeName() <<
endl;
return;
}
JSProxy::MethodTable methods[] = {
{ Methodrefresh, "refresh"},
{ MethodrefreshMimeType, "refreshMimeType"},
{ Methodurl, "url"},
{ MethodsetUrl, "setUrl"},
{ MethodsetName, "setName"},
{ MethodpermissionsString, "permissionsString"},
{ Methoduser, "user"},
{ Methodgroup, "group"},
{ MethodisLink, "isLink"},
{ MethodisDir, "isDir"},
{ MethodisFile, "isFile"},
{ MethodisReadable, "isReadable"},
{ MethodlinkDest, "linkDest"},
{ MethodtimeString, "timeString"},
{ MethodisLocalFile, "isLocalFile"},
{ Methodtext, "text"},
{ Methodname, "name"},
{ MethodmimeType, "mimeType"},
{ MethodisMimeTypeKnown, "isMimeTypeKnown"},
{ MethodmimeComment, "mimeComment"},
{ MethodiconName, "iconName"},
{ Methodpixmap, "pixmap"},
{ Methodoverlays, "overlays"},
{ MethodgetStatusBarInfo, "getStatusBarInfo"},
{ MethodgetToolTipText, "getToolTipText"},
{ Methodrun, "run"},
{ 0, 0 }
};
int idx = 0;
do {
KFileItemImp *meth = new KFileItemImp( exec, methods[idx].id );
object.put( exec , methods[idx].name, KJS::Object(meth) );
++idx;
} while( methods[idx].id );
}
示例8: addBindingsEnum
void JSObjectProxy::addBindingsEnum( KJS::ExecState *exec, KJS::Object &object ) {
QMetaObject * mo = obj->metaObject();
QStrList enumList = mo->enumeratorNames( true );
for ( QStrListIterator iter( enumList ); iter.current(); ++iter ) {
const QMetaEnum *me = mo->enumerator( iter.current(), true );
for ( uint i = 0 ; i < me->count ; i++ ) {
QCString key( ( me->items ) [ i ].key );
int val = ( me->items ) [ i ].value;
object.put( exec, key.data(), KJS::Number( val ), KJS::ReadOnly );
}
}
}
示例9: JsDebugExtension
static void JsDebugExtension(ExecState *exec, KParts::ReadOnlyPart *part,
const KURL &, const QString &, KJS::Object &hostobj )
{
if ( !part->inherits( "KHTMLPart" ) )
return;
if ( !s_debug )
{
s_debug = new JsDebug;
s_debug->ref();
}
hostobj.put(exec, "DebugOut", Object(s_debug));
}
示例10: addBindings
void QFrameImp::addBindings( KJS::ExecState *exec, KJS::Object &object )
{
//
// Define the enum constants
//
struct EnumValue {
const char *id;
int val;
};
EnumValue enums[] = {
// enum Shape
{ "NoFrame", QFrame::NoFrame },
{ "Box", QFrame::Box },
{ "Panel", QFrame::Panel },
{ "WinPanel", QFrame::WinPanel },
{ "HLine", QFrame::HLine },
{ "VLine", QFrame::VLine },
{ "StyledPanel", QFrame::StyledPanel },
{ "PopupPanel", QFrame::PopupPanel },
{ "MenuBarPanel", QFrame::MenuBarPanel },
{ "ToolBarPanel", QFrame::ToolBarPanel },
{ "LineEditPanel", QFrame::LineEditPanel },
{ "TabWidgetPanel", QFrame::TabWidgetPanel },
{ "GroupBoxPanel", QFrame::GroupBoxPanel },
{ "MShape", QFrame::MShape },
// enum Shadow
{ "Plain", QFrame::Plain },
{ "Raised", QFrame::Raised },
{ "Sunken", QFrame::Sunken },
{ "MShadow", QFrame::MShadow },
{ 0, 0 }
};
int enumidx = 0;
do {
object.put( exec, enums[enumidx].id, KJS::Number(enums[enumidx].val), KJS::ReadOnly );
++enumidx;
} while( enums[enumidx].id );
}
示例11: addBindings
void JSObjectProxy::addBindings( KJS::ExecState *exec, KJS::Object &object ) {
kdDebug( 80001 ) << "JSObjectProxy::addBindings() " << ( obj->name() ? obj->name() : "dunno" )
<< ", class " << obj->className() << endl;
if ( policy->hasCapability( JSSecurityPolicy::CapabilityGetProperties | JSSecurityPolicy::CapabilitySetProperties ) ) {
object.put( exec, "properties", KJS::Object( new JSObjectProxyImp( exec, JSObjectProxyImp::MethodProps, this ) ) );
}
if ( policy->hasCapability( JSSecurityPolicy::CapabilityTree ) ) {
JSObjectProxyImp::addBindingsTree( exec, object, this );
JSObjectProxyImp::addBindingsDOM( exec, object, this );
}
if ( policy->hasCapability( JSSecurityPolicy::CapabilitySlots ) ) {
addBindingsSlots( exec, object );
JSObjectProxyImp::addBindingsConnect( exec, object, this );
}
addBindingsClass( exec, object );
}
示例12: addBindings
//.........这里部分代码省略.........
{ Method_isRoot_36, "isRoot" },
{ Method_isRelative_37, "isRelative" },
{ Method_convertToAbs_38, "convertToAbs" },
{ Method_remove_41, "remove" },
{ Method_rename_42, "rename" },
{ Method_exists_43, "exists" },
{ Method_refresh_44, "refresh" },
{ Method_convertSeparators_45, "convertSeparators" },
{ Method_drives_46, "drives" },
{ Method_separator_47, "separator" },
{ Method_setCurrent_48, "setCurrent" },
{ Method_current_49, "current" },
{ Method_home_50, "home" },
{ Method_root_51, "root" },
{ Method_currentDirPath_52, "currentDirPath" },
{ Method_homeDirPath_53, "homeDirPath" },
{ Method_rootDirPath_54, "rootDirPath" },
{ Method_match_55, "match" },
{ Method_match_56, "match" },
{ Method_cleanDirPath_57, "cleanDirPath" },
{ Method_isRelativePath_58, "isRelativePath" },
{ 0, 0 }
};
int idx = 0;
do {
QDirImp *meth = new QDirImp( exec, methods[idx].id );
object.put( exec , methods[idx].name, KJS::Object(meth) );
++idx;
} while( methods[idx].id );
//
// Define the enum constants
//
struct EnumValue {
const char *id;
int val;
};
EnumValue enums[] = {
// enum FilterSpec
{ "Dirs", QDir::Dirs },
{ "Files", QDir::Files },
{ "Drives", QDir::Drives },
{ "NoSymLinks", QDir::NoSymLinks },
{ "All", QDir::All },
{ "TypeMask", QDir::TypeMask },
{ "Readable", QDir::Readable },
{ "Writable", QDir::Writable },
{ "Executable", QDir::Executable },
{ "RWEMask", QDir::RWEMask },
{ "Modified", QDir::Modified },
{ "Hidden", QDir::Hidden },
{ "System", QDir::System },
{ "AccessMask", QDir::AccessMask },
{ "DefaultFilter", QDir::DefaultFilter },
// enum SortSpec
{ "Name", QDir::Name },
{ "Time", QDir::Time },
{ "Size", QDir::Size },
{ "Unsorted", QDir::Unsorted },
{ "SortByMask", QDir::SortByMask },
{ "DirsFirst", QDir::DirsFirst },
{ "Reversed", QDir::Reversed },
{ "IgnoreCase", QDir::IgnoreCase },
{ "DefaultSort", QDir::DefaultSort },
{ 0, 0 }
};
int enumidx = 0;
do {
object.put( exec, enums[enumidx].id, KJS::Number(enums[enumidx].val), KJS::ReadOnly );
++enumidx;
} while( enums[enumidx].id );
}
示例13: addBindings
void KstBindPoint::addBindings(KJS::ExecState *exec, KJS::Object& obj) {
for (int i = 0; pointBindings[i].name != 0L; ++i) {
KJS::Object o = KJS::Object(new KstBindPoint(i + 1));
obj.put(exec, pointBindings[i].name, o, KJS::Function);
}
}
示例14: addBindings
void KstBindTimeInterpretation::addBindings(KJS::ExecState *exec, KJS::Object& obj) {
for (int i = 0; timeInterpretationBindings[i].name != 0L; ++i) {
KJS::Object o = KJS::Object(new KstBindTimeInterpretation(i + 1));
obj.put(exec, timeInterpretationBindings[i].name, o, KJS::Function);
}
}