MCPcopy Create free account
hub / github.com/KDE/kdevelop / removeItemsWithCache

Method removeItemsWithCache

kdevplatform/project/projectbuildsetmodel.cpp:180–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180void ProjectBuildSetModel::removeItemsWithCache( const QList<int>& itemIndices )
181{
182 /*
183 * Removes the items with given indices from both the build set and the ordering cache.
184 * List is given since removing many items together is more efficient than by one.
185 *
186 * Indices in the list shall be sorted.
187 */
188
189 Q_D(ProjectBuildSetModel);
190
191 QList<int> itemIndicesCopy = itemIndices;
192
193 beginRemoveRows( QModelIndex(), itemIndices.first(), itemIndices.last() );
194 for (QList<QStringList>::iterator cacheIterator = d->orderingCache.end() - 1;
195 cacheIterator >= d->orderingCache.begin() && !itemIndicesCopy.isEmpty();) {
196
197 int index = itemIndicesCopy.back();
198 Q_ASSERT( index >= 0 && index < d->items.size() );
199 if (*cacheIterator == d->items.at(index).itemPath()) {
200 cacheIterator = d->orderingCache.erase(cacheIterator);
201 d->items.removeAt(index);
202 itemIndicesCopy.removeLast();
203 }
204 --cacheIterator;
205
206 } // for
207 endRemoveRows();
208
209 Q_ASSERT( itemIndicesCopy.isEmpty() );
210}
211
212void ProjectBuildSetModel::insertItemWithCache( const BuildItem& item )
213{

Callers

nothing calls this directly

Calls 10

QModelIndexClass · 0.50
firstMethod · 0.45
lastMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
isEmptyMethod · 0.45
backMethod · 0.45
sizeMethod · 0.45
itemPathMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected