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

Function nodeNeedsUpdate

kdevplatform/language/editor/modificationrevisionset.cpp:235–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233// }
234
235static bool nodeNeedsUpdate(uint index)
236{
237 QMutexLocker lock(modificationRevisionSetMutex());
238
239 if (!index)
240 return false;
241
242 const auto currentTime = QDateTime::currentDateTimeUtc();
243
244 auto cached = needsUpdateCache.constFind(index);
245 if (cached != needsUpdateCache.constEnd()) {
246 if ((*cached).first.secsTo(currentTime) < cacheModificationTimesForSeconds) {
247 return cached->second;
248 }
249 }
250
251 bool result = false;
252
253 const Utils::SetNodeData* nodeData = FileModificationSetRepositoryRepresenter::repository().nodeFromIndex(index);
254 if (nodeData->contiguous()) {
255 //Do the actual checking
256 for (unsigned int a = nodeData->start(); a < nodeData->end(); ++a) {
257 const FileModificationPair* data = fileModificationPairRepository().itemFromIndex(a);
258 ModificationRevision revision = KDevelop::ModificationRevision::revisionForFile(data->file);
259 if (revision != data->revision) {
260 result = true;
261 break;
262 }
263 }
264 } else {
265 result = nodeNeedsUpdate(nodeData->leftNode()) || nodeNeedsUpdate(nodeData->rightNode());
266 }
267
268 needsUpdateCache.insert(index, std::make_pair(currentTime, result));
269
270 return result;
271}
272
273QString ModificationRevisionSet::toString() const
274{

Callers 1

needsUpdateMethod · 0.85

Calls 7

constEndMethod · 0.80
constFindMethod · 0.45
startMethod · 0.45
endMethod · 0.45
itemFromIndexMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected