| 374 | } |
| 375 | |
| 376 | StaticNamespaceFolderNode* 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" |