| 1620 | } |
| 1621 | |
| 1622 | UnsignedVector IdfObject_Impl::repeatExtensibleIndices(const UnsignedVector& indices) const { |
| 1623 | |
| 1624 | // assume indices is in order, and any extensible field indices are from the first |
| 1625 | // extensible group |
| 1626 | UnsignedVector result = indices; |
| 1627 | |
| 1628 | // nothing to do if not extensible |
| 1629 | if (!m_iddObject.properties().extensible) { |
| 1630 | return result; |
| 1631 | } |
| 1632 | |
| 1633 | // nothing to do if last index is not in extensible group |
| 1634 | if (!result.empty() && !m_iddObject.isExtensibleField(result.back())) { |
| 1635 | return result; |
| 1636 | } |
| 1637 | |
| 1638 | // otherwise, find group indices of extensible field indices in result |
| 1639 | UnsignedVector groupIndices; |
| 1640 | for (unsigned index : result) { |
| 1641 | if (m_iddObject.isExtensibleField(index)) { |
| 1642 | groupIndices.push_back(m_iddObject.extensibleIndex(index).field); |
| 1643 | } |
| 1644 | } |
| 1645 | |
| 1646 | unsigned n = m_fields.size(); |
| 1647 | unsigned nn = m_iddObject.numFields(); |
| 1648 | unsigned ne = m_iddObject.properties().numExtensible; |
| 1649 | unsigned groupIndex = 1; |
| 1650 | while (nn + groupIndex * ne < n) { |
| 1651 | for (unsigned gi : groupIndices) { |
| 1652 | unsigned index = nn + groupIndex * ne + gi; |
| 1653 | if (index < n) { |
| 1654 | result.push_back(index); |
| 1655 | } |
| 1656 | } |
| 1657 | ++groupIndex; |
| 1658 | } |
| 1659 | |
| 1660 | return result; |
| 1661 | } |
| 1662 | |
| 1663 | // QUERY HELPERS |
| 1664 |
nothing calls this directly
no test coverage detected