本文整理汇总了C++中PropertyNameArray::add方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyNameArray::add方法的具体用法?C++ PropertyNameArray::add怎么用?C++ PropertyNameArray::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyNameArray
的用法示例。
在下文中一共展示了PropertyNameArray::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPropertyNames
void CInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArray)
{
if (!NP_CLASS_STRUCT_VERSION_HAS_ENUM(_object->_class) || !_object->_class->enumerate)
return;
uint32_t count;
NPIdentifier* identifiers;
{
JSLock::DropAllLocks dropAllLocks(false);
#if PLATFORM(AMIGAOS4)
if (!_object->_class->enumerate(_object, &identifiers, (uint32_t *)&count))
#else
if (!_object->_class->enumerate(_object, &identifiers, &count))
#endif
return;
}
for (uint32_t i = 0; i < count; i++) {
PrivateIdentifier* identifier = static_cast<PrivateIdentifier*>(identifiers[i]);
if (identifier->isString)
nameArray.add(identifierFromNPIdentifier(identifier->value.string));
else
nameArray.add(Identifier::from(exec, identifier->value.number));
}
// FIXME: This should really call NPN_MemFree but that's in WebKit
free(identifiers);
}
示例2: getSparseArrayPropertyNames
void PropertyMap::getSparseArrayPropertyNames(PropertyNameArray& propertyNames) const
{
if (!_table) {
#if USE_SINGLE_ENTRY
UString::Rep *key = _singleEntry.key;
if (key) {
UString k(key);
bool fitsInUInt32;
k.toUInt32(&fitsInUInt32);
if (fitsInUInt32)
propertyNames.add(Identifier(key));
}
#endif
return;
}
int size = _table->size;
Entry *entries = _table->entries;
for (int i = 0; i != size; ++i) {
UString::Rep *key = entries[i].key;
if (isValid(key)) {
UString k(key);
bool fitsInUInt32;
k.toUInt32(&fitsInUInt32);
if (fitsInUInt32)
propertyNames.add(Identifier(key));
}
}
}
示例3: getOwnPropertyNames
void JSCSSStyleDeclaration::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
JSCSSStyleDeclaration* thisObject = jsCast<JSCSSStyleDeclaration*>(object);
ASSERT_GC_OBJECT_INHERITS(thisObject, info());
unsigned length = thisObject->impl()->length();
for (unsigned i = 0; i < length; ++i)
propertyNames.add(Identifier::from(exec, i));
static Identifier* propertyIdentifiers = 0;
if (!propertyIdentifiers) {
Vector<String, numCSSProperties> jsPropertyNames;
for (int id = firstCSSProperty; id < firstCSSProperty + numCSSProperties; ++id)
jsPropertyNames.append(getJSPropertyName(static_cast<CSSPropertyID>(id)));
sort(jsPropertyNames.begin(), jsPropertyNames.end(), WTF::codePointCompareLessThan);
propertyIdentifiers = new Identifier[numCSSProperties];
for (int i = 0; i < numCSSProperties; ++i)
propertyIdentifiers[i] = Identifier(exec, jsPropertyNames[i].impl());
}
for (int i = 0; i < numCSSProperties; ++i)
propertyNames.add(propertyIdentifiers[i]);
Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
}
示例4: getEnumerablePropertyNames
void PropertyMap::getEnumerablePropertyNames(PropertyNameArray& propertyNames) const
{
if (!_table) {
#if USE_SINGLE_ENTRY
UString::Rep *key = _singleEntry.key;
if (key && !(_singleEntry.attributes & DontEnum))
propertyNames.add(Identifier(key));
#endif
return;
}
// Allocate a buffer to use to sort the keys.
Vector<Entry*, smallMapThreshold> sortedEnumerables(_table->keyCount);
// Get pointers to the enumerable entries in the buffer.
Entry** p = sortedEnumerables.data();
int size = _table->size;
Entry* entries = _table->entries;
for (int i = 0; i != size; ++i) {
Entry* e = &entries[i];
if (e->key && !(e->attributes & DontEnum))
*p++ = e;
}
// Sort the entries by index.
qsort(sortedEnumerables.data(), p - sortedEnumerables.data(), sizeof(Entry*), comparePropertyMapEntryIndices);
// Put the keys of the sorted entries into the list.
for (Entry** q = sortedEnumerables.data(); q != p; ++q)
propertyNames.add(Identifier(q[0]->key));
}
示例5: getPropertyNames
void CInstance::getPropertyNames(ExecState* exec, PropertyNameArray& nameArray)
{
if (!NP_CLASS_STRUCT_VERSION_HAS_ENUM(_object->_class) || !_object->_class->enumerate)
return;
uint32_t count;
NPIdentifier* identifiers;
{
JSLock::DropAllLocks dropAllLocks(SilenceAssertionsOnly);
ASSERT(globalExceptionString().isNull());
#if PLATFORM(AMIGAOS4)
bool ok = _object->_class->enumerate(_object, &identifiers, (uint32_t *)&count);
#else
bool ok = _object->_class->enumerate(_object, &identifiers, &count);
#endif
moveGlobalExceptionToExecState(exec);
if (!ok)
return;
}
for (uint32_t i = 0; i < count; i++) {
IdentifierRep* identifier = static_cast<IdentifierRep*>(identifiers[i]);
if (identifier->isString())
nameArray.add(identifierFromNPIdentifier(identifier->string()));
else
nameArray.add(Identifier::from(exec, identifier->number()));
}
// FIXME: This should really call NPN_MemFree but that's in WebKit
free(identifiers);
}
示例6: getOwnPropertyNames
void JSArray::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
// FIXME: Filling PropertyNameArray with an identifier for every integer
// is incredibly inefficient for large arrays. We need a different approach,
// which almost certainly means a different structure for PropertyNameArray.
ArrayStorage* storage = m_storage;
unsigned usedVectorLength = min(storage->m_length, m_vectorLength);
for (unsigned i = 0; i < usedVectorLength; ++i) {
if (storage->m_vector[i])
propertyNames.add(Identifier::from(exec, i));
}
if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
SparseArrayValueMap::iterator end = map->end();
for (SparseArrayValueMap::iterator it = map->begin(); it != end; ++it)
propertyNames.add(Identifier::from(exec, it->first));
}
if (mode == IncludeDontEnumProperties)
propertyNames.add(exec->propertyNames().length);
JSObject::getOwnPropertyNames(exec, propertyNames, mode);
}
示例7: getPropertyNames
void QtInstance::getPropertyNames(ExecState* exec, PropertyNameArray& array)
{
// This is the enumerable properties, so put:
// properties
// dynamic properties
// slots
QObject* obj = getObject();
if (obj) {
const QMetaObject* meta = obj->metaObject();
int i;
for (i = 0; i < meta->propertyCount(); i++) {
QMetaProperty prop = meta->property(i);
if (prop.isScriptable())
array.add(Identifier(exec, prop.name()));
}
#ifndef QT_NO_PROPERTIES
QList<QByteArray> dynProps = obj->dynamicPropertyNames();
foreach (const QByteArray& ba, dynProps)
array.add(Identifier(exec, ba.constData()));
#endif
const int methodCount = meta->methodCount();
for (i = 0; i < methodCount; i++) {
QMetaMethod method = meta->method(i);
if (method.access() != QMetaMethod::Private) {
QByteArray sig = method.methodSignature();
array.add(Identifier(exec, String(sig.constData(), sig.length())));
}
}
}
}
示例8: getPropertyNames
void QtPixmapInstance::getPropertyNames(ExecState*exec, PropertyNameArray& arr)
{
arr.add(Identifier(exec, UString(QtPixmapToDataUrlMethod::name())));
arr.add(Identifier(exec, UString(QtPixmapAssignToElementMethod::name())));
arr.add(Identifier(exec, UString(QtPixmapToStringMethod::name())));
arr.add(Identifier(exec, UString(QtPixmapWidthField::name())));
arr.add(Identifier(exec, UString(QtPixmapHeightField::name())));
}
示例9: getPropertyNames
void Structure::getPropertyNames(PropertyNameArray& propertyNames, EnumerationMode mode)
{
materializePropertyMapIfNecessary();
if (!m_propertyTable)
return;
if (m_propertyTable->keyCount < tinyMapThreshold) {
PropertyMapEntry* a[tinyMapThreshold];
int i = 0;
unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount;
for (unsigned k = 1; k <= entryCount; k++) {
ASSERT(m_hasNonEnumerableProperties || !(m_propertyTable->entries()[k].attributes & DontEnum));
if (m_propertyTable->entries()[k].key && (!(m_propertyTable->entries()[k].attributes & DontEnum) || (mode == IncludeDontEnumProperties))) {
PropertyMapEntry* value = &m_propertyTable->entries()[k];
int j;
for (j = i - 1; j >= 0 && a[j]->index > value->index; --j)
a[j + 1] = a[j];
a[j + 1] = value;
++i;
}
}
if (!propertyNames.size()) {
for (int k = 0; k < i; ++k)
propertyNames.addKnownUnique(a[k]->key);
} else {
for (int k = 0; k < i; ++k)
propertyNames.add(a[k]->key);
}
return;
}
// Allocate a buffer to use to sort the keys.
Vector<PropertyMapEntry*, smallMapThreshold> sortedEnumerables(m_propertyTable->keyCount);
// Get pointers to the enumerable entries in the buffer.
PropertyMapEntry** p = sortedEnumerables.data();
unsigned entryCount = m_propertyTable->keyCount + m_propertyTable->deletedSentinelCount;
for (unsigned i = 1; i <= entryCount; i++) {
if (m_propertyTable->entries()[i].key && (!(m_propertyTable->entries()[i].attributes & DontEnum) || (mode == IncludeDontEnumProperties)))
*p++ = &m_propertyTable->entries()[i];
}
size_t enumerableCount = p - sortedEnumerables.data();
// Sort the entries by index.
qsort(sortedEnumerables.data(), enumerableCount, sizeof(PropertyMapEntry*), comparePropertyMapEntryIndices);
sortedEnumerables.resize(enumerableCount);
// Put the keys of the sorted entries into the list.
if (!propertyNames.size()) {
for (size_t i = 0; i < sortedEnumerables.size(); ++i)
propertyNames.addKnownUnique(sortedEnumerables[i]->key);
} else {
for (size_t i = 0; i < sortedEnumerables.size(); ++i)
propertyNames.add(sortedEnumerables[i]->key);
}
}
示例10: getOwnPropertyNames
void StringObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
int size = internalValue()->length();
for (int i = 0; i < size; ++i)
propertyNames.add(Identifier(exec, UString::from(i)));
if (mode == IncludeDontEnumProperties)
propertyNames.add(exec->propertyNames().length);
return JSObject::getOwnPropertyNames(exec, propertyNames, mode);
}
示例11: getOwnPropertyNames
void JSTestEventTarget::getOwnPropertyNames(JSObject* object, ExecState* state, PropertyNameArray& propertyNames, EnumerationMode mode)
{
auto* thisObject = jsCast<JSTestEventTarget*>(object);
ASSERT_GC_OBJECT_INHERITS(object, info());
for (unsigned i = 0, count = thisObject->wrapped().length(); i < count; ++i)
propertyNames.add(Identifier::from(state, i));
for (auto& propertyName : thisObject->wrapped().supportedPropertyNames())
propertyNames.add(Identifier::fromString(state, propertyName));
JSObject::getOwnPropertyNames(object, state, propertyNames, mode);
}
示例12: getOwnPropertyNames
void AJFunction::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
if (!isHostFunction() && (mode == IncludeDontEnumProperties)) {
propertyNames.add(exec->propertyNames().arguments);
propertyNames.add(exec->propertyNames().callee);
propertyNames.add(exec->propertyNames().caller);
propertyNames.add(exec->propertyNames().length);
}
Base::getOwnPropertyNames(exec, propertyNames, mode);
}
示例13: getOwnPropertyNames
void StringObject::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
StringObject* thisObject = jsCast<StringObject*>(object);
int size = thisObject->internalValue()->length();
for (int i = 0; i < size; ++i)
propertyNames.add(Identifier(exec, String::number(i)));
if (mode == IncludeDontEnumProperties)
propertyNames.add(exec->propertyNames().length);
return JSObject::getOwnPropertyNames(thisObject, exec, propertyNames, mode);
}
示例14: getOwnPropertyNames
void RuntimeArray::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
unsigned length = getLength();
for (unsigned i = 0; i < length; ++i)
propertyNames.add(Identifier::from(exec, i));
if (mode == IncludeDontEnumProperties)
propertyNames.add(exec->propertyNames().length);
JSObject::getOwnPropertyNames(exec, propertyNames, mode);
}
示例15: getOwnPropertyNames
void Arguments::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)
{
for (unsigned i = 0; i < d->numArguments; ++i) {
if (!d->deletedArguments || !d->deletedArguments[i])
propertyNames.add(Identifier(exec, UString::number(i)));
}
if (mode == IncludeDontEnumProperties) {
propertyNames.add(exec->propertyNames().callee);
propertyNames.add(exec->propertyNames().length);
}
JSObject::getOwnPropertyNames(exec, propertyNames, mode);
}