本文整理汇总了C++中IdentifierRep::number方法的典型用法代码示例。如果您正苦于以下问题:C++ IdentifierRep::number方法的具体用法?C++ IdentifierRep::number怎么用?C++ IdentifierRep::number使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IdentifierRep
的用法示例。
在下文中一共展示了IdentifierRep::number方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeProperty
bool NPJSObject::removeProperty(NPIdentifier propertyName)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName);
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
JSLock lock(SilenceAssertionsOnly);
if (identifierRep->isString()) {
Identifier identifier = identifierFromIdentifierRep(exec, identifierRep);
if (!m_jsObject->hasProperty(exec, identifier)) {
exec->clearException();
return false;
}
m_jsObject->methodTable()->deleteProperty(m_jsObject.get(), exec, identifier);
} else {
if (!m_jsObject->hasProperty(exec, identifierRep->number())) {
exec->clearException();
return false;
}
m_jsObject->methodTable()->deletePropertyByIndex(m_jsObject.get(), exec, identifierRep->number());
}
exec->clearException();
return true;
}
示例2: removeProperty
bool NPJSObject::removeProperty(NPIdentifier propertyName)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName);
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
VM& vm = exec->vm();
JSLockHolder lock(vm);
auto scope = DECLARE_CATCH_SCOPE(vm);
if (identifierRep->isString()) {
Identifier identifier = identifierFromIdentifierRep(exec, identifierRep);
if (!m_jsObject->hasProperty(exec, identifier)) {
scope.clearException();
return false;
}
m_jsObject->methodTable()->deleteProperty(m_jsObject.get(), exec, identifier);
} else {
if (!m_jsObject->hasProperty(exec, identifierRep->number())) {
scope.clearException();
return false;
}
m_jsObject->methodTable()->deletePropertyByIndex(m_jsObject.get(), exec, identifierRep->number());
}
scope.clearException();
return true;
}
示例3: _NPN_RemoveProperty
bool _NPN_RemoveProperty(NPP, NPObject* o, NPIdentifier propertyName)
{
if (o->_class == NPScriptObjectClass) {
JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o);
RootObject* rootObject = obj->rootObject;
if (!rootObject || !rootObject->isValid())
return false;
ExecState* exec = rootObject->globalObject()->globalExec();
IdentifierRep* i = static_cast<IdentifierRep*>(propertyName);
if (i->isString()) {
if (!obj->imp->hasProperty(exec, identifierFromNPIdentifier(exec, i->string()))) {
exec->clearException();
return false;
}
} else {
if (!obj->imp->hasProperty(exec, i->number())) {
exec->clearException();
return false;
}
}
JSLockHolder lock(exec);
if (i->isString())
obj->imp->methodTable()->deleteProperty(obj->imp, exec, identifierFromNPIdentifier(exec, i->string()));
else
obj->imp->methodTable()->deletePropertyByIndex(obj->imp, exec, i->number());
exec->clearException();
return true;
}
return false;
}
示例4: 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);
}
示例5: _NPN_HasProperty
bool _NPN_HasProperty(NPP, NPObject* o, NPIdentifier propertyName)
{
if (o->_class == NPScriptObjectClass) {
JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o);
RootObject* rootObject = obj->rootObject;
if (!rootObject || !rootObject->isValid())
return false;
ExecState* exec = rootObject->globalObject()->globalExec();
IdentifierRep* i = static_cast<IdentifierRep*>(propertyName);
JSLockHolder lock(exec);
if (i->isString()) {
bool result = obj->imp->hasProperty(exec, identifierFromNPIdentifier(exec, i->string()));
exec->clearException();
return result;
}
bool result = obj->imp->hasProperty(exec, i->number());
exec->clearException();
return result;
}
if (o->_class->hasProperty)
return o->_class->hasProperty(o, propertyName);
return false;
}
示例6: _NPN_SetProperty
bool _NPN_SetProperty(NPP, NPObject* o, NPIdentifier propertyName, const NPVariant* variant)
{
if (o->_class == NPScriptObjectClass) {
JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o);
RootObject* rootObject = obj->rootObject;
if (!rootObject || !rootObject->isValid())
return false;
ExecState* exec = rootObject->globalObject()->globalExec();
JSLockHolder lock(exec);
IdentifierRep* i = static_cast<IdentifierRep*>(propertyName);
if (i->isString()) {
PutPropertySlot slot(obj->imp);
obj->imp->methodTable()->put(obj->imp, exec, identifierFromNPIdentifier(exec, i->string()), convertNPVariantToValue(exec, variant, rootObject), slot);
} else
obj->imp->methodTable()->putByIndex(obj->imp, exec, i->number(), convertNPVariantToValue(exec, variant, rootObject), false);
exec->clearException();
return true;
}
if (o->_class->setProperty)
return o->_class->setProperty(o, propertyName, variant);
return false;
}
示例7: _NPN_GetProperty
bool _NPN_GetProperty(NPP, NPObject* o, NPIdentifier propertyName, NPVariant* variant)
{
if (o->_class == NPScriptObjectClass) {
JavaScriptObject* obj = reinterpret_cast<JavaScriptObject*>(o);
RootObject* rootObject = obj->rootObject;
if (!rootObject || !rootObject->isValid())
return false;
ExecState* exec = rootObject->globalObject()->globalExec();
IdentifierRep* i = static_cast<IdentifierRep*>(propertyName);
JSLockHolder lock(exec);
JSValue result;
if (i->isString())
result = obj->imp->get(exec, identifierFromNPIdentifier(exec, i->string()));
else
result = obj->imp->get(exec, i->number());
convertValueToNPVariant(exec, result, variant);
exec->clearException();
return true;
}
if (o->_class->hasProperty && o->_class->getProperty) {
if (o->_class->hasProperty(o, propertyName))
return o->_class->getProperty(o, propertyName, variant);
return false;
}
VOID_TO_NPVARIANT(*variant);
return false;
}
示例8: getProperty
bool NPJSObject::getProperty(NPIdentifier propertyName, NPVariant* result)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName);
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
JSLock lock(SilenceAssertionsOnly);
JSValue jsResult;
if (identifierRep->isString())
jsResult = m_jsObject->get(exec, identifierFromIdentifierRep(exec, identifierRep));
else
jsResult = m_jsObject->get(exec, identifierRep->number());
m_objectMap->convertJSValueToNPVariant(exec, jsResult, *result);
exec->clearException();
return true;
}
示例9: hasProperty
bool NPJSObject::hasProperty(NPIdentifier identifier)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(identifier);
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
JSLock lock(SilenceAssertionsOnly);
bool result;
if (identifierRep->isString())
result = m_jsObject->hasProperty(exec, identifierFromIdentifierRep(exec, identifierRep));
else
result = m_jsObject->hasProperty(exec, identifierRep->number());
exec->clearException();
return result;
}
示例10: setProperty
bool NPJSObject::setProperty(NPIdentifier propertyName, const NPVariant* value)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName);
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
JSLock lock(SilenceAssertionsOnly);
JSValue jsValue = m_objectMap->convertNPVariantToJSValue(exec, m_objectMap->globalObject(), *value);
if (identifierRep->isString()) {
PutPropertySlot slot;
m_jsObject->methodTable()->put(m_jsObject.get(), exec, identifierFromIdentifierRep(exec, identifierRep), jsValue, slot);
} else
m_jsObject->methodTable()->putByIndex(m_jsObject.get(), exec, identifierRep->number(), jsValue, false);
exec->clearException();
return true;
}
示例11: hasProperty
bool NPJSObject::hasProperty(NPIdentifier identifier)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(identifier);
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
VM& vm = exec->vm();
JSLockHolder lock(vm);
auto scope = DECLARE_CATCH_SCOPE(vm);
bool result;
if (identifierRep->isString())
result = m_jsObject->hasProperty(exec, identifierFromIdentifierRep(exec, identifierRep));
else
result = m_jsObject->hasProperty(exec, identifierRep->number());
scope.clearException();
return result;
}
示例12: setProperty
bool NPJSObject::setProperty(NPIdentifier propertyName, const NPVariant* value)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName);
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
VM& vm = exec->vm();
JSLockHolder lock(vm);
auto scope = DECLARE_CATCH_SCOPE(vm);
JSValue jsValue = m_objectMap->convertNPVariantToJSValue(exec, m_objectMap->globalObject(), *value);
if (identifierRep->isString()) {
PutPropertySlot slot(m_jsObject.get());
m_jsObject->methodTable()->put(m_jsObject.get(), exec, identifierFromIdentifierRep(exec, identifierRep), jsValue, slot);
} else
m_jsObject->methodTable()->putByIndex(m_jsObject.get(), exec, identifierRep->number(), jsValue, false);
scope.clearException();
return true;
}
示例13: getProperty
bool NPJSObject::getProperty(NPIdentifier propertyName, NPVariant* result)
{
IdentifierRep* identifierRep = static_cast<IdentifierRep*>(propertyName);
ExecState* exec = m_objectMap->globalExec();
if (!exec)
return false;
VM& vm = exec->vm();
JSLockHolder lock(vm);
auto scope = DECLARE_CATCH_SCOPE(vm);
JSValue jsResult;
if (identifierRep->isString())
jsResult = m_jsObject->get(exec, identifierFromIdentifierRep(exec, identifierRep));
else
jsResult = m_jsObject->get(exec, identifierRep->number());
m_objectMap->convertJSValueToNPVariant(exec, jsResult, *result);
scope.clearException();
return true;
}
示例14: npObjectPropertyEnumerator
void npObjectPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info, bool namedProperty)
{
NPObject* npObject = v8ObjectToNPObject(info.Holder());
// Verify that our wrapper wasn't using a NPObject which
// has already been deleted.
if (!npObject || !_NPN_IsAlive(npObject))
throwError(v8ReferenceError, "NPObject deleted", info.GetIsolate());
if (NP_CLASS_STRUCT_VERSION_HAS_ENUM(npObject->_class) && npObject->_class->enumerate) {
uint32_t count;
NPIdentifier* identifiers;
if (npObject->_class->enumerate(npObject, &identifiers, &count)) {
v8::Handle<v8::Array> properties = v8::Array::New(count);
for (uint32_t i = 0; i < count; ++i) {
IdentifierRep* identifier = static_cast<IdentifierRep*>(identifiers[i]);
if (namedProperty)
properties->Set(v8::Integer::New(i, info.GetIsolate()), v8::String::NewSymbol(identifier->string()));
else
properties->Set(v8::Integer::New(i, info.GetIsolate()), v8::Integer::New(identifier->number(), info.GetIsolate()));
}
v8SetReturnValue(info, properties);
return;
}
}
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:27,代码来源:V8NPObject.cpp