本文整理汇总了C++中DynamicObject::SetPropertyWithAttributes方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicObject::SetPropertyWithAttributes方法的具体用法?C++ DynamicObject::SetPropertyWithAttributes怎么用?C++ DynamicObject::SetPropertyWithAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicObject
的用法示例。
在下文中一共展示了DynamicObject::SetPropertyWithAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateConsoleScope
void DebugManager::UpdateConsoleScope(DynamicObject* copyFromScope, ScriptContext* scriptContext)
{
Assert(copyFromScope != nullptr);
DynamicObject* consoleScope = this->GetConsoleScope(scriptContext);
Js::RecyclableObject* recyclableObject = Js::RecyclableObject::FromVar(copyFromScope);
ulong newPropCount = recyclableObject->GetPropertyCount();
for (ulong i = 0; i < newPropCount; i++)
{
Js::PropertyId propertyId = recyclableObject->GetPropertyId((Js::PropertyIndex)i);
// For deleted properties we won't have a property id
if (propertyId != Js::Constants::NoProperty)
{
Js::PropertyValueInfo propertyValueInfo;
Var propertyValue;
BOOL gotPropertyValue = recyclableObject->GetProperty(recyclableObject, propertyId, &propertyValue, &propertyValueInfo, scriptContext);
AssertMsg(gotPropertyValue, "DebugManager::UpdateConsoleScope Should have got valid value?");
OUTPUT_TRACE(Js::ConsoleScopePhase, _u("Adding property '%s'\n"), scriptContext->GetPropertyName(propertyId)->GetBuffer());
BOOL updateSuccess = consoleScope->SetPropertyWithAttributes(propertyId, propertyValue, propertyValueInfo.GetAttributes(), &propertyValueInfo);
AssertMsg(updateSuccess, "DebugManager::UpdateConsoleScope Unable to update property value. Am I missing a scenario?");
}
}
OUTPUT_TRACE(Js::ConsoleScopePhase, _u("Number of properties on console scope object after update are %d\n"), consoleScope->GetPropertyCount());
}
示例2: EntryJsBuiltIn_Internal_InitInternalProperties
Var JsBuiltInEngineInterfaceExtensionObject::EntryJsBuiltIn_Internal_InitInternalProperties(RecyclableObject *function, CallInfo callInfo, ...)
{
EngineInterfaceObject_CommonFunctionProlog(function, callInfo);
DynamicObject* obj = DynamicObject::FromVar(args.Values[1]);
unsigned propCount = TaggedInt::ToUInt32(args.Values[2]);
Assert(callInfo.Count == 3 + propCount);
for (unsigned i = 0; i < propCount; i++)
{
JavascriptString *propName = JavascriptString::FromVar(args.Values[i + 3]);
obj->SetPropertyWithAttributes(JavascriptOperators::GetPropertyId(propName, scriptContext), scriptContext->GetLibrary()->GetNull(), PropertyWritable, nullptr);
}
return obj;
}