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

Method reset

plugins/quickopen/projectfilequickopen.cpp:336–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334}
335
336void ProjectFileDataProvider::reset()
337{
338 updateItems([this](QVector<ProjectFile>& closedFiles) {
339 const auto open = openFiles<IndexedStringView>();
340 // Don't "optimize" by assigning m_projectFiles to closedFiles and
341 // returning early if there are no open files. Such an optimization may
342 // speed up this call to reset() sometimes - if the destruction of the
343 // previous data of closedFiles doesn't take long for some reason. But
344 // this "optimization" will discard the current elements and capacity of
345 // closedFiles, eventually will trigger an extra allocation and
346 // construction of many ProjectFile objects: when a project is opened or
347 // closed, when a file is added to/removed from a project, or when a
348 // file is opened and reset() is called again. See also the
349 // documentation of PathFilter::updateItems().
350
351 closedFiles.resize(m_projectFiles.size());
352 const auto logicalEnd = std::remove_copy_if(
353 m_projectFiles.cbegin(), m_projectFiles.cend(),
354 closedFiles.begin(), [&open](const ProjectFile& f) {
355 return open.contains(f.indexedPath);
356 });
357 closedFiles.erase(logicalEnd, closedFiles.end());
358 });
359}
360
361QSet<IndexedString> ProjectFileDataProvider::files() const
362{

Callers 3

restart_internalMethod · 0.45
testProjectFileFilterMethod · 0.45

Calls 13

transformFunction · 0.85
sortFunction · 0.85
projectControllerMethod · 0.80
openDocumentsMethod · 0.80
documentControllerMethod · 0.80
findProjectForUrlMethod · 0.80
PathClass · 0.50
sizeMethod · 0.45
beginMethod · 0.45
containsMethod · 0.45
endMethod · 0.45
urlMethod · 0.45

Tested by 1

testProjectFileFilterMethod · 0.36