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

Method namespaceFolder

kdevplatform/language/classmodel/documentclassesfolder.cpp:376–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

374}
375
376StaticNamespaceFolderNode* DocumentClassesFolder::namespaceFolder(const KDevelop::QualifiedIdentifier& a_identifier)
377{
378 // Stop condition.
379 if (a_identifier.count() == 0)
380 return nullptr;
381
382 // Look it up in the cache.
383 NamespacesMap::iterator iter = m_namespaces.find(a_identifier);
384 if (iter == m_namespaces.end()) {
385 // It's not in the cache - create folders up to it.
386 Node* parentNode = namespaceFolder(a_identifier.left(-1));
387 if (parentNode == nullptr)
388 parentNode = this;
389
390 // Create the new node.
391 auto* newNode =
392 new StaticNamespaceFolderNode(a_identifier, m_model);
393 parentNode->addNode(newNode);
394
395 // Add it to the cache.
396 m_namespaces.insert(a_identifier, newNode);
397
398 // Return the result.
399 return newNode;
400 } else
401 return *iter;
402}
403
404#include "moc_documentclassesfolder.cpp"

Callers

nothing calls this directly

Calls 5

addNodeMethod · 0.80
countMethod · 0.45
findMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected