本文整理汇总了C++中ArrayIter::hasArrayData方法的典型用法代码示例。如果您正苦于以下问题:C++ ArrayIter::hasArrayData方法的具体用法?C++ ArrayIter::hasArrayData怎么用?C++ ArrayIter::hasArrayData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayIter
的用法示例。
在下文中一共展示了ArrayIter::hasArrayData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: iter_next_key
HOT_FUNC
int64 iter_next_key(Iter* iter, TypedValue* valOut, TypedValue* keyOut) {
TRACE(2, "iter_next: I %p\n", iter);
ASSERT(iter->m_itype == Iter::TypeArray ||
iter->m_itype == Iter::TypeIterator);
ArrayIter* arrIter = &iter->arr();
valOut = tvToCell(valOut);
keyOut = tvToCell(keyOut);
if (UNLIKELY(!arrIter->hasArrayData())) {
goto cold;
}
{
const ArrayData* ad = arrIter->getArrayData();
if (UNLIKELY(!IsHphpArray(ad))) {
goto cold;
}
const HphpArray* arr = (HphpArray*)ad;
ssize_t pos = arrIter->getPos();
if (size_t(pos) >= size_t(arr->getLastE())) {
if (UNLIKELY(arr->getCount() == 1)) {
goto cold;
}
arr->decRefCount();
iter->m_itype = Iter::TypeUndefined;
return 0;
}
pos = pos + 1;
HphpArray::Elm* elm = arr->getElm(pos);
if (UNLIKELY(elm->data.m_type >= HphpArray::KindOfTombstone)) {
goto cold;
}
if (UNLIKELY(tvWillBeReleased(valOut))) {
goto cold;
}
if (UNLIKELY(tvWillBeReleased(keyOut))) {
goto cold;
}
tvDecRefOnly(valOut);
tvDecRefOnly(keyOut);
arrIter->setPos(pos);
getHphpArrayElm(elm, valOut, keyOut);
return 1;
}
cold:
return iter_next_cold(iter, valOut, keyOut);
}