本文整理汇总了C++中AutoIdVector::infallibleAppend方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoIdVector::infallibleAppend方法的具体用法?C++ AutoIdVector::infallibleAppend怎么用?C++ AutoIdVector::infallibleAppend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoIdVector
的用法示例。
在下文中一共展示了AutoIdVector::infallibleAppend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exports
bool
ModuleNamespaceObject::ProxyHandler::ownPropertyKeys(JSContext* cx, HandleObject proxy,
AutoIdVector& props) const
{
Rooted<ModuleNamespaceObject*> ns(cx, &proxy->as<ModuleNamespaceObject>());
RootedArrayObject exports(cx, &ns->exports());
uint32_t count = exports->length();
if (!props.reserve(props.length() + count))
return false;
for (uint32_t i = 0; i < count; i++) {
Value value = exports->getDenseElement(i);
props.infallibleAppend(AtomToId(&value.toString()->asAtom()));
}
return true;
}
示例2: exports
bool
ModuleNamespaceObject::ProxyHandler::ownPropertyKeys(JSContext* cx, HandleObject proxy,
AutoIdVector& props) const
{
Rooted<ModuleNamespaceObject*> ns(cx, &proxy->as<ModuleNamespaceObject>());
RootedObject exports(cx, &ns->exports());
uint32_t count;
if (!GetLengthProperty(cx, exports, &count) || !props.reserve(props.length() + count))
return false;
Rooted<ValueVector> names(cx, ValueVector(cx));
if (!names.resize(count) || !GetElements(cx, exports, count, names.begin()))
return false;
for (uint32_t i = 0; i < count; i++)
props.infallibleAppend(AtomToId(&names[i].toString()->asAtom()));
return true;
}