| 310 | } |
| 311 | |
| 312 | void TemplateClassGenerator::addBaseClass(const QString& base) |
| 313 | { |
| 314 | Q_D(TemplateClassGenerator); |
| 315 | |
| 316 | const InheritanceDescription desc = descriptionFromString(base); |
| 317 | |
| 318 | ClassDescription cd = description(); |
| 319 | cd.baseClasses << desc; |
| 320 | setDescription(cd); |
| 321 | |
| 322 | //Search for all super classes |
| 323 | auto visitor = [&](const IndexedDeclaration& indexedDeclaration) { |
| 324 | auto declaration = DeclarationPointer(indexedDeclaration.declaration()); |
| 325 | if (!declaration || declaration->isForwardDeclaration()) { |
| 326 | return PersistentSymbolTable::VisitorState::Continue; |
| 327 | } |
| 328 | |
| 329 | // Check if it's a class/struct/etc |
| 330 | if (declaration->type<StructureType>()) { |
| 331 | d->fetchSuperClasses(declaration); |
| 332 | d->directBaseClasses << declaration; |
| 333 | return PersistentSymbolTable::VisitorState::Break; |
| 334 | } |
| 335 | return PersistentSymbolTable::VisitorState::Continue; |
| 336 | }; |
| 337 | const auto id = IndexedQualifiedIdentifier(QualifiedIdentifier(desc.baseType)); |
| 338 | |
| 339 | DUChainReadLocker lock; |
| 340 | PersistentSymbolTable::self().visitDeclarations(id, visitor); |
| 341 | } |
| 342 | |
| 343 | void TemplateClassGenerator::setBaseClasses(const QList<QString>& bases) |
| 344 | { |