本文整理汇总了C++中kjs::Identifier类的典型用法代码示例。如果您正苦于以下问题:C++ Identifier类的具体用法?C++ Identifier怎么用?C++ Identifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Identifier类的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: 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;
}
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:28,代码来源:jsobjectproxy.cpp
示例3: jsNull
KJS::JSValue *SlotProxy::callMethod(const QByteArray &methodName, void **_a)
{
#ifdef DEBUG_SLOTPROXY
qDebug() << "SlotProxy::callMethod(" << methodName << ",_a) obj=" << this;
#endif
KJS::ExecState *exec = m_interpreter->globalExec();
exec->clearException();
// Crash
// KJS::Interpreter::globalExec()->context().thisValue()
KJS::List args = convertArguments(exec, _a);
KJS::Identifier id = KJS::Identifier(KJS::UString(methodName.data()));
KJS::JSObject *fun = m_object->get(exec, id)->toObject(exec);
KJS::JSValue *retValue;
if (!fun->implementsCall()) {
#ifdef DEBUG_SLOTPROXY
qDebug() << "SlotProxy::callMethod got bad handler";
#endif
QString msg = i18n("Bad slot handler: Object %1 Identifier %2 Method %3 Signature: %4.",
m_object->className().ascii(),
id.ascii(),
methodName.data(),
QString(m_signature));
retValue = throwError(exec, KJS::TypeError, msg);
} else {
retValue = fun->call(exec, m_object, args);
}
if (exec->hadException()) {
#ifdef DEBUG_SLOTPROXY
qDebug() << "SlotProxy::callMethod had exception";
#endif
if (m_interpreter->shouldPrintExceptions()) {
KJS::JSLock lock;
KJS::JSObject *exceptObj = exec->exception()->toObject(exec);//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);
// would include the line number, but it's always last line of file
int line = exceptObj->get(exec, "line")->toUInt32(exec);
(*KJSEmbed::conerr()) << i18n("Exception calling '%1' slot from %2:%3:%4", QString(methodName), !sourceURL.isEmpty() ? sourceURL : QString::number(sourceId), line, message) << endl;
}
// clear it so it doesn't stop other things
exec->clearException();
return KJS::jsNull();
} else {
if (retValue->type() == 1 || retValue->type() == 0) {
return KJS::jsNull();
}
}
return retValue;
}
开发者ID:KDE,项目名称:kjsembed,代码行数:55,代码来源:slotproxy.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: empty
PassRefPtr<StringImpl> AtomicString::add(const KJS::Identifier& identifier)
{
if (identifier.isNull())
return 0;
UString::Rep* string = identifier.ustring().rep();
unsigned length = string->size();
if (!length)
return StringImpl::empty();
HashAndCharacters buffer = { string->computedHash(), string->data(), length };
pair<HashSet<StringImpl*>::iterator, bool> addResult = stringTable->add<HashAndCharacters, HashAndCharactersTranslator>(buffer);
if (!addResult.second)
return *addResult.first;
return adoptRef(*addResult.first);
}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:16,代码来源:AtomicString.cpp
示例6: extract
KJS::Value KstBindWindowCollection::extract(KJS::ExecState *exec, const KJS::Identifier& item) const {
KstViewWindow *w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(item.qstring()));
if (w) {
return KJS::Object(new KstBindWindow(exec, w));
}
return KJS::Undefined();
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:7,代码来源:bind_windowcollection.cpp
示例7: extract
KJS::Value KstBindPluginModuleCollection::extract(KJS::ExecState *exec, const KJS::Identifier& item) const {
QString plugin = item.qstring();
const QMap<QString,Plugin::Data>& pluginList = PluginCollection::self()->pluginList();
for (QMap<QString,Plugin::Data>::ConstIterator it = pluginList.begin(); it != pluginList.end(); ++it) {
if (it.data()._name == plugin) {
return KJS::Object(new KstBindPluginModule(exec, it.data()));
}
}
const KstPluginInfoList pluginInfo = KstDataObject::pluginInfoList();
for (KstPluginInfoList::ConstIterator it = pluginInfo.begin(); it != pluginInfo.end(); ++it) {
if (it.key() == plugin) {
KstDataObjectPtr ptr = KstDataObject::plugin(it.key());
if (ptr) {
KstBasicPluginPtr bp = kst_cast<KstBasicPlugin>(ptr);
if (bp) {
return KJS::Object(new KstBindPluginModule(exec, bp));
}
}
}
}
return KJS::Undefined();
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:27,代码来源:bind_pluginmodulecollection.cpp
示例8: extract
KJS::Value KstBindDataObjectCollection::extract(KJS::ExecState *exec, const KJS::Identifier& item) const {
KstReadLocker rl(&KST::dataObjectList.lock());
KstDataObjectPtr d = *KST::dataObjectList.findTag(item.qstring());
if (d) {
return KJS::Object(KstBindDataObject::bind(exec, d));
}
return KJS::Undefined();
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:8,代码来源:bind_dataobjectcollection.cpp
示例9: hasProperty
bool KstBindTimeInterpretation::hasProperty(KJS::ExecState *exec, const KJS::Identifier& propertyName) const {
QString prop = propertyName.qstring();
for (int i = 0; timeInterpretationProperties[i].name; ++i) {
if (prop == timeInterpretationProperties[i].name) {
return true;
}
}
return KstBinding::hasProperty(exec, propertyName);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:10,代码来源:bind_timeinterpretation.cpp
示例10: hasProperty
bool KstBindDataObjectCollection::hasProperty(KJS::ExecState *exec, const KJS::Identifier& propertyName) const {
QString prop = propertyName.qstring();
for (int i = 0; dataObjectCollectionProperties[i].name; ++i) {
if (prop == dataObjectCollectionProperties[i].name) {
return true;
}
}
return KstBindCollection::hasProperty(exec, propertyName);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:10,代码来源:bind_dataobjectcollection.cpp
示例11: hasProperty
bool KstBindEllipse::hasProperty(KJS::ExecState *exec, const KJS::Identifier& propertyName) const {
QString prop = propertyName.qstring();
for (int i = 0; ellipseProperties[i].name; ++i) {
if (prop == ellipseProperties[i].name) {
return true;
}
}
return KstBindViewObject::hasProperty(exec, propertyName);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:10,代码来源:bind_ellipse.cpp
示例12: hasProperty
bool KstBindPoint::hasProperty(KJS::ExecState *exec, const KJS::Identifier& propertyName) const {
QString prop = propertyName.qstring();
for (int i = 0; pointProperties[i].name; ++i) {
if (prop == pointProperties[i].name) {
return true;
}
}
return KstBinding::hasProperty(exec, propertyName);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:10,代码来源:bind_point.cpp
示例13: extract
KJS::Value KstBindPluginModuleCollection::extract(KJS::ExecState *exec, const KJS::Identifier& item) const {
const QMap<QString,Plugin::Data>& pluginList = PluginCollection::self()->pluginList();
QString i = item.qstring();
for (QMap<QString,Plugin::Data>::ConstIterator it = pluginList.begin(); it != pluginList.end(); ++it) {
if (it.data()._name == i) {
return KJS::Object(new KstBindPluginModule(exec, it.data()));
}
}
return KJS::Undefined();
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:10,代码来源:bind_pluginmodulecollection.cpp
示例14: put
void JSObjectProxy::put( KJS::ExecState *exec,
const KJS::Identifier &p, const KJS::Value &v,
int attr ) {
if ( !isAllowed( exec->interpreter() ) ) {
kdWarning() << "JS put request from unknown interpreter, ignoring" << endl;
return ;
}
if ( !policy->hasCapability( JSSecurityPolicy::CapabilitySetProperties ) ) {
ObjectImp::put( exec, p, v, attr );
return ;
}
if ( !obj ) {
kdDebug( 80001 ) << "JS setting '" << p.ascii() << "' but qobj has died" << endl;
ObjectImp::put( exec, p, v, attr );
return ;
}
// Properties
QMetaObject *meta = obj->metaObject();
int propIndex = meta->findProperty( p.ascii(), true );
if ( propIndex != -1 ) {
QVariant val = convertToVariant( exec, v );
if ( meta->property(propIndex, true)->isEnumType() ) {
obj->setProperty( p.ascii(), val.toUInt() );
} else if ( val.isValid() ) {
obj->setProperty( p.ascii(), val );
} else {
kdWarning(80001) << "Error setting value." << endl;
}
} else {
ObjectImp::put( exec, p, v, attr );
}
if ( jspart->factory() ->eventMapper() ->isEventHandler( p ) ) {
if ( evproxy.isNull() )
evproxy = new KJSEmbed::JSObjectEventProxy( this );
evproxy->addFilter( jspart->factory() ->eventMapper() ->findEventType( p ) );
kdDebug( 80001 ) << "Adding event handler " << p.ascii() << endl;
}
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:42,代码来源:jsobjectproxy.cpp
示例15: get
KJS::Value KstBindKst::get(KJS::ExecState *exec, const KJS::Identifier& propertyName) const {
if (propertyName.qstring() == "version") {
return KJS::String(KSTVERSION);
}
if (propertyName.qstring() == "scriptVersion") {
return KJS::Number(1);
}
QString prop = propertyName.qstring();
for (int i = 0; kstProperties[i].name; ++i) {
if (prop == kstProperties[i].name) {
if (!kstProperties[i].get) {
break;
}
return (this->*kstProperties[i].get)(exec);
}
}
return KstBinding::get(exec, propertyName);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:21,代码来源:bind_kst.cpp
示例16: get
KJS::Value JSObjectProxy::get( KJS::ExecState *exec, const KJS::Identifier &p ) const {
if ( !isAllowed( exec->interpreter() ) ) {
kdWarning() << "JS get request from unknown interpreter, ignoring" << endl;
return KJS::Null();
}
if ( !policy->isPropertyAllowed( this, obj, p.ascii() ) )
return ObjectImp::get( exec, p );
if ( !obj ) {
kdDebug( 80001 ) << "JS getting '" << p.ustring().qstring() << "' but qobj has died" << endl;
return ObjectImp::get( exec, p );
}
kdDebug( 80001 ) << "JS getting '" << p.ascii() << endl;
// Properties
QString prop = p.ustring().qstring();
QMetaObject *meta = obj->metaObject();
if ( meta->findProperty( p.ascii(), true ) != -1 ) {
QVariant val = obj->property( prop.ascii() );
kdDebug( 80001 ) << "JS getting '" << p.ascii() << "' ( " << val.typeName() << ")" << endl;
return convertToValue( exec, val );
}
return ObjectImp::get
( exec, p );
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:29,代码来源:jsobjectproxy.cpp
示例17: get
KJS::Value KstBindTimeInterpretation::get(KJS::ExecState *exec, const KJS::Identifier& propertyName) const {
QString prop = propertyName.qstring();
for (int i = 0; timeInterpretationProperties[i].name; ++i) {
if (prop == timeInterpretationProperties[i].name) {
if (!timeInterpretationProperties[i].get) {
break;
}
return (this->*timeInterpretationProperties[i].get)(exec);
}
}
return KstBinding::get(exec, propertyName);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:13,代码来源:bind_timeinterpretation.cpp
示例18: get
KJS::Value KstBindPoint::get(KJS::ExecState *exec, const KJS::Identifier& propertyName) const {
QString prop = propertyName.qstring();
for (int i = 0; pointProperties[i].name; ++i) {
if (prop == pointProperties[i].name) {
if (!pointProperties[i].get) {
break;
}
return (this->*pointProperties[i].get)(exec);
}
}
return KstBinding::get(exec, propertyName);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:13,代码来源:bind_point.cpp
示例19: put
void KstBindTimeInterpretation::put(KJS::ExecState *exec, const KJS::Identifier& propertyName, const KJS::Value& value, int attr) {
QString prop = propertyName.qstring();
for (int i = 0; timeInterpretationProperties[i].name; ++i) {
if (prop == timeInterpretationProperties[i].name) {
if (!timeInterpretationProperties[i].set) {
break;
}
(this->*timeInterpretationProperties[i].set)(exec, value);
return;
}
}
KstBinding::put(exec, propertyName, value, attr);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:14,代码来源:bind_timeinterpretation.cpp
示例20: hasProperty
bool KstBindKst::hasProperty(KJS::ExecState *exec, const KJS::Identifier& propertyName) const {
QString prop = propertyName.qstring();
for (int i = 0; kstProperties[i].name; ++i) {
if (prop == kstProperties[i].name) {
return true;
}
}
if (prop == "version" || prop == "scriptVersion") {
return true;
}
return KstBinding::hasProperty(exec, propertyName);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:14,代码来源:bind_kst.cpp
注:本文中的kjs::Identifier类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论