本文整理汇总了C++中kjs::Object::imp方法的典型用法代码示例。如果您正苦于以下问题:C++ Object::imp方法的具体用法?C++ Object::imp怎么用?C++ Object::imp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kjs::Object
的用法示例。
在下文中一共展示了Object::imp方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
}
示例2: 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;
}
}
示例3: call
KJS::Value Point::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
if( !JSProxy::checkType(self, JSProxy::ValueProxy, "QPoint") ) return KJS::Value();
JSValueProxy *vp = JSProxy::toValueProxy( self.imp() );
KJS::Value retValue = KJS::Value();
QPoint val = vp->toVariant().toPoint();
switch ( mid ) {
case Methodx:
retValue = KJS::Number(val.x());
break;
case MethodsetX:
val.setX(extractInt(exec,args,0));
break;
case Methody:
retValue = KJS::Number(val.y());
break;
case MethodsetY:
val.setY(extractInt(exec,args,0));
break;
case MethodmanhattanLength:
retValue = KJS::Number(val.manhattanLength());
break;
default:
QString msg = i18n( "Point has no method %1" ).arg(mid);
return throwError(exec, msg);
break;
}
vp->setValue(val);
return retValue;
}
示例4: 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 );
}
示例5: 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 );
}
示例6: call
KJS::Value KstBindTimeInterpretation::call(KJS::ExecState *exec, KJS::Object& self, const KJS::List& args) {
int id = this->id();
if (id <= 0) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Undefined();
}
KstBindTimeInterpretation *imp = dynamic_cast<KstBindTimeInterpretation*>(self.imp());
if (!imp) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Undefined();
}
return (imp->*timeInterpretationBindings[id - 1].method)(exec, args);
}
示例7: call
KJS::Value MyCustomObjectImp::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
kdDebug() << "MyCustomObjectImp::call() " << mid << endl;
JSOpaqueProxy *op = JSProxy::toOpaqueProxy( self.imp() );
if ( !op ) {
kdWarning() << "MyCustomObjectImp::call() failed, not a JSOpaqueProxy" << endl;
return KJS::Value();
}
if ( op->typeName() != "MyCustomObject" ) {
kdWarning() << "MyCustomObjectImp::call() failed, type is " << op->typeName() << endl;
return KJS::Value();
}
MyCustomObject *obj = op->toNative<MyCustomObject>();
KJS::Value retValue = KJS::Value();
switch ( mid ) {
case Methodthing:
{
retValue = KJS::String(obj->thing);
break;
}
case MethodsetThing:
{
obj->thing = extractString(exec, args, 0);
break;
}
case Methodmode:
{
retValue = KJS::Number( (int)obj->mode );
break;
}
case MethodsetMode:
{
obj->mode = (MyCustomObject::Mode) extractInt(exec, args, 0);
break;
}
default:
kdWarning() << "MyCustomObject has no method " << mid << endl;
break;
}
op->setValue((void*) obj, "MyCustomObject");
return retValue;
}
示例8: call
KJS::Value KstBindEllipse::call(KJS::ExecState *exec, KJS::Object& self, const KJS::List& args) {
int id = this->id();
if (id <= 0) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Undefined();
}
int start = KstBindViewObject::methodCount();
if (id > start) {
KstBindEllipse *imp = dynamic_cast<KstBindEllipse*>(self.imp());
if (!imp) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Undefined();
}
return (imp->*ellipseBindings[id - start - 1].method)(exec, args);
}
return KstBindViewObject::call(exec, self, args);
}
示例9: call
KJS::Value BrushImp::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
if( !JSProxy::checkType(self, JSProxy::ValueProxy, "QBrush") ) return KJS::Value();
JSValueProxy *op = JSProxy::toValueProxy( self.imp() );
QBrush brush = op->toVariant().toBrush();
KJS::Value retValue = KJS::Value();
switch ( mid ) {
case Methodstyle:
{
return KJS::Number((int) brush.style() );
break;
}
case MethodsetStyle:
{
int style = extractInt(exec, args, 0);
brush.setStyle((Qt::BrushStyle)style);
break;
}
case MethodColor:
{
return convertToValue(exec, brush.color());
break;
}
case MethodsetColor:
{
QColor color = extractQColor(exec, args, 0);
brush.setColor(color);
break;
}
default:
kdWarning() << "Brush has no method " << mid << endl;
break;
}
op->setValue(brush);
return retValue;
}
示例10: Value
KJS::Value KJSEmbed::Bindings::KFileItemImp::call( KJS::ExecState * exec, KJS::Object & self, const KJS::List & args )
{
kdDebug() << "KFileItemImp::call() " << mid << endl;
JSOpaqueProxy *op = JSProxy::toOpaqueProxy( self.imp() );
if ( !op ) {
kdWarning() << "KFileItemImp::call() failed, not a JSOpaqueProxy" << endl;
return KJS::Value();
}
if ( op->typeName() != "KFileItem" ) {
kdWarning() << "KFileItemImp::call() failed, type is " << op->typeName() << endl;
return KJS::Value();
}
KFileItem *obj = op->toNative<KFileItem >();
KJS::Value retValue = KJS::Value();
switch ( mid ) {
case Methodrefresh:
obj->refresh();
break;
case MethodrefreshMimeType:
obj->refreshMimeType();
break;
case Methodurl:
{
QString url = obj->url().url();
retValue = KJS::String(url);
break;
}
case MethodsetUrl:
{
QString url = extractQString(exec, args, 0);
obj->setURL(url);
break;
}
case MethodsetName:
case MethodpermissionsString:
case Methoduser:
case Methodgroup:
case MethodisLink:
case MethodisDir:
case MethodisFile:
case MethodisReadable:
case MethodlinkDest:
case MethodtimeString:
case MethodisLocalFile:
case Methodtext:
{
retValue = convertToValue(exec, obj->text() );
break;
}
case Methodname:
case MethodmimeType:
case MethodisMimeTypeKnown:
case MethodmimeComment:
case MethodiconName:
{
retValue = convertToValue( exec, obj->iconName() );
break;
}
case Methodpixmap:
{
int size = extractInt(exec, args, 0);
int state = extractInt(exec, args, 1);
retValue = convertToValue(exec, obj->pixmap(size, state));
break;
}
case Methodoverlays:
{
retValue = convertToValue(exec, obj->overlays());
break;
}
case MethodgetStatusBarInfo:
{
retValue = KJS::String( obj->getStatusBarInfo() );
break;
}
case MethodgetToolTipText:
{
int maxcount = extractInt(exec, args, 0);
retValue = KJS::String(obj->getToolTipText(maxcount));
break;
}
case Methodrun:
obj->run();
break;
default:
kdWarning() << "KFileItemImp has no method " << mid << endl;
break;
}
op->setValue((void*) obj, "KFileItem");
return retValue;
}
示例11: bind
KJS::Object KJSEmbedPart::bind( QObject *obj )
{
KJS::Object jsobj = jsfactory->createProxy( js->globalExec(), obj );
JSProxy::toObjectProxy(jsobj.imp() )->setOwner(JSProxy::Native);
return jsobj;
}
示例12: call
KJS::Value Pixmap::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args ) {
if( !JSProxy::checkType( self, JSProxy::ValueProxy, "QPixmap") )
return KJS::Value();
JSValueProxy *op = JSProxy::toValueProxy( self.imp() );
pix = op->toVariant().toPixmap();
KJS::Value retValue = KJS::Value();
switch ( mid ) {
case Methodwidth:
retValue = KJS::Number(width());
break;
case Methodheight:
retValue = KJS::Number(height());
break;
case Methoddepth:
retValue = KJS::Number(depth());
break;
case MethodisNull:
retValue = KJS::Boolean(isNull());
break;
case Methodsize:
retValue = convertToValue(exec, size());
break;
case Methodrect:
retValue = convertToValue(exec, rect());
break;
case Methodresize:
{
if( args.size() == 2)
resize(extractInt(exec, args, 0), extractInt(exec, args, 1));
else if( args.size() == 1)
resize(extractQSize(exec, args, 0) );
break;
}
case Methodfill:
fill( extractQColor(exec, args, 0));
break;
case Methodmask:
{
retValue = convertToValue(exec, mask() );
break;
}
case MethodsetMask:
{
setMask(extractQPixmap(exec, args, 0));
break;
}
case MethodcreateHeuristicMask:
{
retValue = convertToValue(exec, createHeuristicMask(extractBool(exec, args, 0)));
break;
}
case MethodgrabWindow:
{
int winid = extractInt(exec, args,0);
int x = extractInt(exec, args,1);
int y = extractInt(exec, args,2);
int w = extractInt(exec, args,3);
int h = extractInt(exec, args,4);
grabWindow(winid,x,y,w,h);
break;
}
default:
kdWarning() << "Image has no method " << mid << endl;
break;
}
op->setValue(pix);
return retValue;
}
示例13: call
KJS::Value QDirImp::call( KJS::ExecState *exec, KJS::Object &self, const KJS::List &args )
{
JSOpaqueProxy *op = JSProxy::toOpaqueProxy( self.imp() );
if ( !op ) {
kdWarning() << "QDirImp::call() failed, not a JSOpaqueProxy" << endl;
return KJS::Value();
}
if ( op->typeName() != "QDir" ) {
kdWarning() << "QDirImp::call() failed, type is " << op->typeName() << endl;
return KJS::Value();
}
instance = op->toNative<QDir>();
switch( mid ) {
case Method_setPath_7:
return setPath_7( exec, self, args );
break;
case Method_path_8:
return path_8( exec, self, args );
break;
case Method_absPath_9:
return absPath_9( exec, self, args );
break;
case Method_canonicalPath_10:
return canonicalPath_10( exec, self, args );
break;
case Method_dirName_11:
return dirName_11( exec, self, args );
break;
case Method_filePath_12:
return filePath_12( exec, self, args );
break;
case Method_absFilePath_13:
return absFilePath_13( exec, self, args );
break;
case Method_cd_14:
return cd_14( exec, self, args );
break;
case Method_cdUp_15:
return cdUp_15( exec, self, args );
break;
case Method_nameFilter_16:
return nameFilter_16( exec, self, args );
break;
case Method_setNameFilter_17:
return setNameFilter_17( exec, self, args );
break;
case Method_filter_18:
return filter_18( exec, self, args );
break;
case Method_setFilter_19:
return setFilter_19( exec, self, args );
break;
case Method_sorting_20:
return sorting_20( exec, self, args );
break;
case Method_setSorting_21:
return setSorting_21( exec, self, args );
break;
case Method_matchAllDirs_22:
return matchAllDirs_22( exec, self, args );
break;
case Method_setMatchAllDirs_23:
return setMatchAllDirs_23( exec, self, args );
break;
case Method_count_24:
return count_24( exec, self, args );
break;
case Method_encodedEntryList_26:
return encodedEntryList_26( exec, self, args );
break;
case Method_encodedEntryList_27:
return encodedEntryList_27( exec, self, args );
break;
case Method_entryList_28:
return entryList_28( exec, self, args );
break;
//.........这里部分代码省略.........