| 122 | ChooseHint(item.get(), hint), pComputedItemContext); |
| 123 | } |
| 124 | void CollectItem(CollectedItems &collection, |
| 125 | BaseItem *pItem, const OrderingHint &hint, void *pComputedItemContext) |
| 126 | { |
| 127 | if (!pItem) |
| 128 | return; |
| 129 | |
| 130 | using namespace Registry; |
| 131 | if (const auto pIndirect = |
| 132 | dynamic_cast<IndirectItemBase*>(pItem)) { |
| 133 | auto delegate = pIndirect->ptr.get(); |
| 134 | if (delegate) |
| 135 | // recursion |
| 136 | CollectItem(collection, delegate, |
| 137 | ChooseHint(delegate, pIndirect->orderingHint), pComputedItemContext); |
| 138 | } |
| 139 | else |
| 140 | if (const auto pComputed = |
| 141 | dynamic_cast<ComputedItemBase*>(pItem)) { |
| 142 | auto result = pComputed->factory(pComputedItemContext); |
| 143 | if (result) { |
| 144 | // Guarantee long enough lifetime of the result |
| 145 | collection.computedItems.push_back( result ); |
| 146 | // recursion |
| 147 | CollectItem(collection, result.get(), |
| 148 | ChooseHint(result.get(), pComputed->orderingHint), |
| 149 | pComputedItemContext); |
| 150 | } |
| 151 | } |
| 152 | else |
| 153 | if (auto pGroup = dynamic_cast<GroupItemBase*>(pItem)) { |
| 154 | if (pGroup->GetOrdering() == GroupItemBase::Anonymous) |
| 155 | // anonymous grouping item is transparent to path calculations |
| 156 | // collect group members now |
| 157 | // recursion |
| 158 | CollectItems(collection, *pGroup, |
| 159 | ChooseHint(pGroup, hint), pComputedItemContext); |
| 160 | else |
| 161 | // all other group items |
| 162 | // defer collection of members until collecting at next lower level |
| 163 | collection.items.push_back( {pItem, nullptr, hint} ); |
| 164 | } |
| 165 | else { |
| 166 | wxASSERT( dynamic_cast<SingleItem*>(pItem) ); |
| 167 | // common to all single items |
| 168 | collection.items.push_back( {pItem, nullptr, hint} ); |
| 169 | } |
| 170 | } |
| 171 | |
| 172 | using Path = std::vector< Identifier >; |
| 173 |
no test coverage detected