bool NameValueTableWrapper::validFullPos(const FullPos & fp) const { assert(fp.getContainer() == (ArrayData*)this); if (fp.getResetFlag()) return false; if (fp.m_pos == ArrayData::invalid_index) return false; NameValueTable::Iterator iter(m_tab, fp.m_pos); return (iter.valid()); }
bool NameValueTableWrapper::ValidFullPos(const ArrayData* ad, const FullPos & fp) { assert(fp.getContainer() == ad); auto a = asNVTW(ad); if (fp.getResetFlag()) return false; if (fp.m_pos == invalid_index) return false; NameValueTable::Iterator iter(a->m_tab, fp.m_pos); return iter.valid(); }
bool NameValueTableWrapper::advanceFullPos(FullPos& fp) { bool reset = fp.getResetFlag(); NameValueTable::Iterator iter = reset ? NameValueTable::Iterator(m_tab) : NameValueTable::Iterator(m_tab, fp.m_pos); if (reset) { fp.setResetFlag(false); } else { if (!iter.valid()) { return false; } iter.next(); } fp.m_pos = iter.toInteger(); if (!iter.valid()) return false; // To conform to PHP behavior, we need to set the internal // cursor to point to the next element. iter.next(); m_pos = iter.toInteger(); return true; }