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

Method updateLocals

kdevplatform/debugger/variable/variablecollection.cpp:323–373  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323QList<Variable*> Locals::updateLocals(const QStringList& locals)
324{
325 QSet<QString> existing, current;
326 for (int i = 0; i < childItems.size(); i++)
327 {
328 Q_ASSERT(qobject_cast<KDevelop::Variable*>(child(i)));
329 auto* var= static_cast<KDevelop::Variable*>(child(i));
330 existing << var->expression();
331 }
332
333 for (const QString& var : locals) {
334 current << var;
335 // If we currently don't display this local var, add it.
336 if( !existing.contains( var ) ) {
337 // FIXME: passing variableCollection this way is awkward.
338 // In future, variableCollection probably should get a
339 // method to create variable.
340 Variable* v =
341 currentSession()->variableController()->createVariable(
342 ICore::self()->debugController()->variableCollection(),
343 this, var );
344 appendChild( v, false );
345 }
346 }
347
348 for (int i = 0; i < childItems.size(); ++i) {
349 auto* v = static_cast<KDevelop::Variable*>(child(i));
350 if (!current.contains(v->expression())) {
351 removeChild(i);
352 --i;
353 // FIXME: check that -var-delete is sent.
354 delete v;
355 }
356 }
357
358
359 if (hasMore()) {
360 setHasMore(false);
361 }
362
363 // Variables which changed just value are updated by a call to -var-update.
364 // Variables that changed type -- likewise.
365
366 QList<Variable*> ret;
367 ret.reserve(childItems.size());
368 for (TreeItem* i : std::as_const(childItems)) {
369 Q_ASSERT(qobject_cast<Variable*>(i));
370 ret << static_cast<Variable*>(i);
371 }
372 return ret;
373}
374
375void Locals::resetChanged()
376{

Callers

nothing calls this directly

Calls 11

childFunction · 0.85
currentSessionFunction · 0.85
hasMoreFunction · 0.85
debugControllerMethod · 0.80
sizeMethod · 0.45
expressionMethod · 0.45
containsMethod · 0.45
createVariableMethod · 0.45
variableControllerMethod · 0.45
variableCollectionMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected