本文整理汇总了C++中valueset::Range类的典型用法代码示例。如果您正苦于以下问题:C++ Range类的具体用法?C++ Range怎么用?C++ Range使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Range类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MarkKey
void
SetObject::mark(JSTracer* trc, JSObject* obj)
{
SetObject* setobj = static_cast<SetObject*>(obj);
if (ValueSet* set = setobj->getData()) {
for (ValueSet::Range r = set->all(); !r.empty(); r.popFront())
MarkKey(r, r.front(), trc);
}
}
示例2:
bool
SetObject::keys(JSContext* cx, HandleObject obj, JS::MutableHandle<GCVector<JS::Value>> keys)
{
ValueSet* set = obj->as<SetObject>().getData();
if (!set)
return false;
for (ValueSet::Range r = set->all(); !r.empty(); r.popFront()) {
if (!keys.append(r.front().get()))
return false;
}
return true;
}
示例3: value
bool
SetIteratorObject::next_impl(JSContext* cx, const CallArgs& args)
{
SetIteratorObject& thisobj = args.thisv().toObject().as<SetIteratorObject>();
ValueSet::Range* range = thisobj.range();
RootedValue value(cx);
bool done;
if (!range || range->empty()) {
js_delete(range);
thisobj.setReservedSlot(RangeSlot, PrivateValue(nullptr));
value.setUndefined();
done = true;
} else {
switch (thisobj.kind()) {
case SetObject::Values:
value = range->front().get();
break;
case SetObject::Entries: {
JS::AutoValueArray<2> pair(cx);
pair[0].set(range->front().get());
pair[1].set(range->front().get());
JSObject* pairObj = NewDenseCopiedArray(cx, 2, pair.begin());
if (!pairObj)
return false;
value.setObject(*pairObj);
break;
}
}
range->popFront();
done = false;
}
RootedObject result(cx, CreateItrResultObject(cx, value, done));
if (!result)
return false;
args.rval().setObject(*result);
return true;
}
示例4: SetIteratorObjectRange
bool
SetIteratorObject::next(Handle<SetIteratorObject*> setIterator, HandleArrayObject resultObj,
JSContext* cx)
{
// Check invariants for inlined _GetNextSetEntryForIterator.
// The array should be tenured, so that post-barrier can be done simply.
MOZ_ASSERT(resultObj->isTenured());
// The array elements should be fixed.
MOZ_ASSERT(resultObj->hasFixedElements());
MOZ_ASSERT(resultObj->getDenseInitializedLength() == 1);
MOZ_ASSERT(resultObj->getDenseCapacity() >= 1);
ValueSet::Range* range = SetIteratorObjectRange(setIterator);
if (!range || range->empty()) {
js_delete(range);
setIterator->setReservedSlot(RangeSlot, PrivateValue(nullptr));
return true;
}
resultObj->setDenseElementWithType(cx, 0, range->front().get());
range->popFront();
return false;
}