diff options
Diffstat (limited to 'src/namespacedef.cpp')
-rw-r--r-- | src/namespacedef.cpp | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index edd0add..1146924 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -363,18 +363,24 @@ void NamespaceDef::addUsingDirective(NamespaceDef *nd) { if (usingDirList==0) { - usingDirList = new NamespaceList; + usingDirList = new NamespaceSDict; + } + if (usingDirList->find(nd->qualifiedName())==0) + { + usingDirList->append(nd->qualifiedName(),nd); } - usingDirList->append(nd); } void NamespaceDef::addUsingDeclaration(ClassDef *cd) { if (usingDeclList==0) { - usingDeclList = new ClassList; + usingDeclList = new ClassSDict; + } + if (usingDeclList->find(cd->qualifiedName())==0) + { + usingDeclList->append(cd->qualifiedName(),cd); } - usingDeclList->append(cd); } QCString NamespaceDef::getOutputFileBase() const @@ -418,3 +424,43 @@ QCString NamespaceDef::displayName() const return result; } +void NamespaceDef::combineUsingRelations() +{ + if (visited) return; // already done + visited=TRUE; + if (usingDirList) + { + NamespaceSDict::Iterator nli(*usingDirList); + NamespaceDef *nd; + for (nli.toFirst();(nd=nli.current());++nli) + { + nd->combineUsingRelations(); + } + for (nli.toFirst();(nd=nli.current());++nli) + { + // add used namespaces of namespace nd to this namespace + if (nd->getUsedNamespaces()) + { + NamespaceSDict::Iterator unli(*nd->getUsedNamespaces()); + NamespaceDef *und; + for (unli.toFirst();(und=unli.current());++unli) + { + //printf("Adding namespace %s to the using list of %s\n",und->qualifiedName().data(),qualifiedName().data()); + addUsingDirective(und); + } + } + // add used classes of namespace nd to this namespace + if (nd->getUsedClasses()) + { + ClassSDict::Iterator cli(*nd->getUsedClasses()); + ClassDef *ucd; + for (cli.toFirst();(ucd=cli.current());++cli) + { + //printf("Adding class %s to the using list of %s\n",cd->qualifiedName().data(),qualifiedName().data()); + addUsingDeclaration(ucd); + } + } + } + } +} + |