本文整理汇总了C++中Identifier::string方法的典型用法代码示例。如果您正苦于以下问题:C++ Identifier::string方法的具体用法?C++ Identifier::string怎么用?C++ Identifier::string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Identifier
的用法示例。
在下文中一共展示了Identifier::string方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tryGet
Value DOMStyleSheetList::tryGet(ExecState *exec, const Identifier &p) const
{
#ifdef KJS_VERBOSE
kdDebug(6070) << "DOMStyleSheetList::tryGet " << p.qstring() << endl;
#endif
if(p == lengthPropertyName)
return Number(styleSheetList.length());
else if(p == "item")
return lookupOrCreateFunction< DOMStyleSheetListFunc >(exec, p, this, DOMStyleSheetList::Item, 1, DontDelete | Function);
// Retrieve stylesheet by index
bool ok;
long unsigned int u = p.toULong(&ok);
if(ok)
return getDOMStyleSheet(exec, DOM::StyleSheetList(styleSheetList).item(u));
// IE also supports retrieving a stylesheet by name, using the name/id of the <style> tag
// (this is consistent with all the other collections)
#if 0
// Bad implementation because DOM::StyleSheet doesn't inherit DOM::Node
// so we can't use DOMNamedNodesCollection.....
// We could duplicate it for stylesheets though - worth it ?
// Other problem of this implementation: it doesn't look for the ID attribute!
DOM::NameNodeListImpl namedList( m_doc.documentElement().handle(), p.string() );
int len = namedList.length();
if ( len ) {
QValueList<DOM::Node> styleSheets;
for ( int i = 0 ; i < len ; ++i ) {
DOM::HTMLStyleElement elem = DOM::Node(namedList.item(i));
if (!elem.isNull())
styleSheets.append(elem.sheet());
}
if ( styleSheets.count() == 1 ) // single result
return getDOMStyleSheet(exec, styleSheets[0]);
else if ( styleSheets.count() > 1 ) {
return new DOMNamedItemsCollection(exec,styleSheets);
}
}
#endif
// ### Bad implementation because returns a single element (are IDs always unique?)
// and doesn't look for name attribute (see implementation above).
// But unicity of stylesheet ids is good practice anyway ;)
DOM::DOMString pstr = p.string();
DOM::HTMLStyleElement styleElem = m_doc.getElementById(pstr);
if(!styleElem.isNull())
return getDOMStyleSheet(exec, styleElem.sheet());
return DOMObject::tryGet(exec, p);
}
示例2: registerWatchpointForImpureProperty
void VM::registerWatchpointForImpureProperty(const Identifier& propertyName, Watchpoint* watchpoint)
{
auto result = m_impurePropertyWatchpointSets.add(propertyName.string(), nullptr);
if (result.isNewEntry)
result.iterator->value = adoptRef(new WatchpointSet(IsWatched));
result.iterator->value->add(watchpoint);
}
示例3: addFunction
void JSDollarVMPrototype::addFunction(VM& vm, JSGlobalObject* globalObject, const char* name, NativeFunction function, unsigned arguments)
{
Identifier identifier = Identifier::fromString(&vm, name);
putDirect(vm, identifier, JSFunction::create(vm, globalObject, arguments, identifier.string(), function));
}