本文整理汇总了C++中kjs::List类的典型用法代码示例。如果您正苦于以下问题:C++ List类的具体用法?C++ List怎么用?C++ List使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了List类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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;
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:26,代码来源:kjsembedpart.cpp
示例2: 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 );
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:27,代码来源:saxhandler.cpp
示例3: frameCount
KJS::Value KstBindDataSource::frameCount(KJS::ExecState *exec, const KJS::List& args) {
QString field;
if (args.size() == 1) {
if (args[0].type() != KJS::StringType) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Number(0);
}
field = args[0].toString(exec).qstring();
} else if (args.size() != 0) {
KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError, "Requires at most one argument.");
exec->setException(eobj);
return KJS::Number(0);
}
KstDataSourcePtr s = makeSource(_d);
if (!s) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Number(0);
}
s->writeLock();
int rc = s->frameCount(field);
s->unlock();
return KJS::Number(rc);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:29,代码来源:bind_datasource.cpp
示例4: callHandler
bool EventProxy::callHandler( QEvent *e )
{
// Be careful enabling this as if there are a lot of events then the event loop times
// out and the app crashes with 'Alarm Clock'.
// qDebug("JSObjectEventProxy::callHandler() event type %d" , e->type() );
KJS::ExecState *exec = m_interpreter->globalExec();
KJS::Identifier id = JSEventMapper::mapper()->findEventHandler( e->type() );
KJS::JSObject *jsobj(m_watch);
KJS::JSObject *fun = jsobj->get(exec, id )->toObject( exec );
KJS::JSValue *retValue;
if ( !fun->implementsCall() )
{
QString msg = i18n( "Bad event handler: Object %1 Identifier %2 Method %3 Type: %4.",
jsobj->className().ascii(),
id.ascii(),
fun->className().ascii(),
e->type());
retValue = throwError(exec, KJS::TypeError, msg);
}
else
{
// Process args
KJS::List args;
args.append( JSEventUtils::event(exec, e) );
// Call handler
retValue = fun->call( exec, jsobj, args );
}
if ( exec->hadException() )
{
if (m_interpreter->shouldPrintExceptions())
{
KJS::JSLock lock;
KJS::JSObject* exceptObj = retValue->toObject(exec);
QString message = toQString(exceptObj->toString(exec));
QString sourceURL = toQString(exceptObj->get(exec, "sourceURL")->toString(exec));
int sourceId = exceptObj->get(exec, "sourceId")->toUInt32(exec);
int line = exceptObj->get(exec, "line")->toUInt32(exec);
(*KJSEmbed::conerr()) << i18n("Exception calling '%1' function from %2:%3:%4", id.ascii(), !sourceURL.isEmpty() ? sourceURL : QString::number(sourceId), line, message) << endl;
}
// clear it so it doesn't stop other things
exec->clearException();
return false;
}
return true;
}
开发者ID:vasi,项目名称:kdelibs,代码行数:53,代码来源:eventproxy.cpp
示例5: listFromVariantArgs
static KJS::List listFromVariantArgs(KJS::ExecState *exec, const NPVariant *args, unsigned argCount)
{
KJS::List aList;
unsigned i;
const NPVariant *v = args;
for (i = 0; i < argCount; i++) {
aList.append (convertNPVariantToValue (exec, v));
v++;
}
return aList;
}
开发者ID:BackupTheBerlios,项目名称:wxwebcore-svn,代码行数:13,代码来源:NP_jsobject.cpp
示例6: Value
KJS::Value QDirImp::entryInfoList_30( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
{
int arg0 = (args.size() >= 1) ? args[0].toInteger(exec) : -1;
int arg1 = (args.size() >= 2) ? args[1].toInteger(exec) : -1;
instance->entryInfoList(
arg0,
arg1 );
return KJS::Value(); // Returns 'const QFileInfoList *'
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:13,代码来源:qdir_imp.cpp
示例7: Boolean
KJS::Value QDirImp::match_56( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
{
QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
QString arg1 = (args.size() >= 2) ? args[1].toString(exec).qstring() : QString::null;
bool ret;
ret = instance->match(
arg0,
arg1 );
return KJS::Boolean( ret );
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:14,代码来源:qdir_imp.cpp
示例8: constructorNames
QStringList KJSEmbedPart::constructorNames() const
{
QStringList classes;
KJS::List cons = constructorList();
KJS::ListIterator it = cons.begin();
while ( it != cons.end() ) {
KJS::Value v = *it;
classes += v.toString( js->globalExec() ).qstring();
it++;
}
return classes;
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:14,代码来源:kjsembedpart.cpp
示例9: String
KJS::Value QDirImp::absFilePath_13( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
{
QString arg0 = (args.size() >= 1) ? args[0].toString(exec).qstring() : QString::null;
bool arg1 = (args.size() >= 2) ? args[1].toBoolean(exec) : false;
QString ret;
ret = instance->absFilePath(
arg0,
arg1 );
return KJS::String( ret );
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:14,代码来源:qdir_imp.cpp
示例10: createBinding
KJS::Object QDirLoader::createBinding(KJSEmbedPart *jspart, KJS::ExecState *exec, const KJS::List &args) const
{
JSOpaqueProxy * prx;
if ( args.size() == 0 ) {
prx = new JSOpaqueProxy( new QDir( QDir::current() ), "QDir" );
} else {
QString arg0 = ( args.size() >= 1 ) ? args[ 0 ].toString( exec ).qstring() : QString::null;
prx = new JSOpaqueProxy( new QDir( arg0 ), "QDir" );
}
prx->setOwner( JSProxy::JavaScript );
KJS::Object proxyObj( prx );
addBindings( jspart, exec, proxyObj );
return proxyObj;
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:14,代码来源:qdir_imp.cpp
示例11: QVBoxLayout
KateKJSWrapperConfigPage::KateKJSWrapperConfigPage(KJS::Object pageConstructor,PluginKateKJSWrapper* parent,
QWidget *parentWidget)
: Kate::PluginConfigPage( parentWidget ),m_plugin(parent)
{
QVBoxLayout *l=new QVBoxLayout(this);
l->setAutoAdd(true);
l->activate();
KJS::Interpreter *js = parent->m_part->interpreter();
KJS::ExecState *exec = js->globalExec();
exec->clearException();
KJS::List param;
param.append(parent->m_part->factory()->createProxy(exec,this,0));
m_pageObject=pageConstructor.construct(exec,param);
}
开发者ID:iegor,项目名称:kdesktop,代码行数:14,代码来源:plugin_katekjswrapper.cpp
示例12:
static KMDI::ToolViewAccessor *createToolView(KJSEmbed::JSFactory *factory,KJS::Interpreter *js, Kate::MainWindow *winN,KJS::Object win,KJS::Object viewConstructor) {
KJS::List params;
KJS::ExecState *exec = js->globalExec();
params.append(win);
exec->clearException();
int dockPos;
if (!viewConstructor.implementsConstruct()) return 0;
KJS::Value dockPosV=viewConstructor.get(exec,KJS::Identifier("startPosition"));
if (exec->hadException()) {
dockPos=KDockWidget::DockLeft;
exec->clearException();
} else {
dockPos=dockPosV.toInteger(exec);
if (exec->hadException()) {
dockPos=KDockWidget::DockLeft;
exec->clearException();
}
}
QString viewName;
KJS::Value viewNameV=viewConstructor.get(exec,KJS::Identifier("name"));
if (exec->hadException()) {
viewName="kjs_unknown";
exec->clearException();
} else {
viewName=QString( viewNameV.toString(exec).qstring() );
if (exec->hadException()) {
viewName="kjs_unknown";
exec->clearException();
}
}
Kate::JS::ToolView *tv=new Kate::JS::ToolView(viewConstructor,exec,factory,params,viewName.utf8());
//params.append(factory->createProxy(exec,tv));
//KJS::Object otv=viewConstructor.construct(exec,params);
if (exec->hadException()) {
kdDebug()<<"Error while calling constructor"<<endl;
delete tv;
kdDebug()<<exec->exception().toString(exec).qstring()<<endl;
exec->clearException();
return 0;
}
KMDI::ToolViewAccessor *tva=winN->toolViewManager()->addToolView((KDockWidget::DockPosition)dockPos,tv,
tv->icon()?(*(tv->icon())):QPixmap(),tv->caption());
kdDebug()<<"****************************************************************************************"<<endl;
kdDebug()<<"PluginKateKJSWrapper: Toolview has been added"<<endl;
kdDebug()<<"****************************************************************************************"<<endl;
return tva;
}
开发者ID:iegor,项目名称:kdesktop,代码行数:49,代码来源:plugin_katekjswrapper.cpp
示例13: construct
KJS::Object KstBindDataSource::construct(KJS::ExecState *exec, const KJS::List& args) {
if (args.size() < 1) {
KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError);
exec->setException(eobj);
return KJS::Object();
}
if (args[0].type() != KJS::StringType) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Object();
}
QString file = args[0].toString(exec).qstring();
QString type;
if (args.size() == 2) {
if (args[1].type() != KJS::StringType) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Object();
}
type = args[1].toString(exec).qstring();
}
bool newSource = false;
KST::dataSourceList.lock().readLock();
KstDataSourcePtr ds = *KST::dataSourceList.findFileName(file);
KST::dataSourceList.lock().unlock();
if (!ds) {
ds = KstDataSource::loadSource(file, type);
newSource = true;
}
if (!ds) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Object();
}
if (newSource) {
KST::dataSourceList.lock().writeLock();
KST::dataSourceList.append(ds);
KST::dataSourceList.lock().unlock();
}
return KJS::Object(new KstBindDataSource(exec, ds));
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:49,代码来源:bind_datasource.cpp
示例14: convertToValue
KJS::Value QDirImp::entryList_28( KJS::ExecState *exec, KJS::Object &obj, const KJS::List &args )
{
int arg0 = (args.size() >= 1) ? args[0].toInteger(exec) : -1;
int arg1 = (args.size() >= 2) ? args[1].toInteger(exec) : -1;
QStringList ret;
ret = instance->entryList(
arg0,
arg1 );
return convertToValue( exec, ret );
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:15,代码来源:qdir_imp.cpp
示例15: samplesPerFrame
KJS::Value KstBindDataSource::samplesPerFrame(KJS::ExecState *exec, const KJS::List& args) {
if (args.size() != 1) {
KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError, "Requires exactly one argument.");
exec->setException(eobj);
return KJS::Number(0);
}
if (args[0].type() != KJS::StringType) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Number(0);
}
KstDataSourcePtr s = makeSource(_d);
if (!s) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Number(0);
}
s->writeLock();
int rc = s->samplesPerFrame(args[0].toString(exec).qstring());
s->unlock();
return KJS::Number(rc);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:26,代码来源:bind_datasource.cpp
示例16: isValidField
KJS::Value KstBindDataSource::isValidField(KJS::ExecState *exec, const KJS::List& args) {
if (args.size() != 1) {
KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError, "Requires exactly one argument.");
exec->setException(eobj);
return KJS::Boolean(false);
}
if (args[0].type() != KJS::StringType) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Boolean(false);
}
KstDataSourcePtr s = makeSource(_d);
if (!s) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Boolean(false);
}
s->writeLock();
bool rc = s->isValidField(args[0].toString(exec).qstring());
s->unlock();
return KJS::Boolean(rc);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:26,代码来源:bind_datasource.cpp
示例17: loadScript
KJS::Value KstBindKst::loadScript(KJS::ExecState *exec, const KJS::List& args) {
if (args.size() != 1) {
KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError);
exec->setException(eobj);
return KJS::Undefined();
}
if (args[0].type() != KJS::StringType) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Undefined();
}
QString fn = args[0].toString(exec).qstring();
if (!QFile::exists(fn)) { // One day make this support KIO FIXME
return KJS::Boolean(false);
}
if (_ext->part()->runFile(fn)) {
// FIXME: add to the script registry
} else {
KJS::Completion c = _ext->part()->completion();
if (!c.isNull()) {
QString err = c.toString(_ext->part()->globalExec()).qstring();
KstDebug::self()->log(i18n("Error running script %1: %2").arg(fn).arg(err), KstDebug::Error);
} else {
KstDebug::self()->log(i18n("Unknown error running script %1.").arg(fn), KstDebug::Error);
}
return KJS::Boolean(false);
}
return KJS::Boolean(true);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:33,代码来源:bind_kst.cpp
示例18: fieldList
KJS::Value KstBindDataSource::fieldList(KJS::ExecState *exec, const KJS::List& args) {
Q_UNUSED(args)
KJS::List rc;
KstDataSourcePtr s = makeSource(_d);
if (!s) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Object(exec->interpreter()->builtinArray().construct(exec, rc));
}
s->readLock();
QStringList l = s->fieldList();
s->unlock();
for (QStringList::ConstIterator i = l.begin(); i != l.end(); ++i) {
rc.append(KJS::String(*i));
}
return KJS::Object(exec->interpreter()->builtinArray().construct(exec, rc));
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:18,代码来源:bind_datasource.cpp
示例19: initScript
DOM::EventListener *KJSProxyImpl::createHTMLEventHandler(QString sourceUrl, QString code)
{
#ifdef KJS_DEBUGGER
if (KJSDebugWin::instance())
KJSDebugWin::instance()->setNextSourceInfo(sourceUrl,m_handlerLineno);
#else
Q_UNUSED(sourceUrl);
#endif
initScript();
//KJS::Constructor constr(KJS::Global::current().get("Function").imp());
KJS::Object constr = m_script->builtinFunction();
KJS::List args;
args.append(KJS::String("event"));
args.append(KJS::String(code));
Object handlerFunc = constr.construct(m_script->globalExec(), args); // ### is globalExec ok ?
return KJS::Window::retrieveWindow(m_part)->getJSEventListener(handlerFunc,true);
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:19,代码来源:kjs_proxy.cpp
示例20: construct
KJS::Object KstBindPoint::construct(KJS::ExecState *exec, const KJS::List& args) {
if (args.size() == 0) {
return KJS::Object(new KstBindPoint(exec, 0, 0));
}
if (args.size() != 2) {
KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError);
exec->setException(eobj);
return KJS::Object();
}
if (args[0].type() != KJS::NumberType || args[1].type() != KJS::NumberType) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Object();
}
return KJS::Object(new KstBindPoint(exec, args[0].toNumber(exec), args[1].toNumber(exec)));
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:19,代码来源:bind_point.cpp
注:本文中的kjs::List类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论