From e847d5dc322740b0097f56fc19311c8c74a44a55 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Mon, 19 Oct 2020 10:18:07 +0200 Subject: issue #8103: C++ Table of content, namespace list does not contains namespace without class --- src/context.cpp | 2 +- src/ftvhelp.cpp | 4 +- src/index.cpp | 595 +++++++++++++++++++++++++++----------------------------- src/util.cpp | 69 ++++--- src/util.h | 3 +- 5 files changed, 336 insertions(+), 337 deletions(-) diff --git a/src/context.cpp b/src/context.cpp index 05429d3..5a9ab38 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -6541,7 +6541,7 @@ class NestingContext::Private : public GenericNodeListContext if (!nd->isAnonymous() && (!rootOnly || nd->getOuterScope()==Doxygen::globalScope)) { - bool hasChildren = namespaceHasVisibleChild(nd,addClasses,false,ClassDef::Class); + bool hasChildren = namespaceHasNestedNamespace(nd); bool isLinkable = nd->isLinkableInProject(); if (isLinkable || hasChildren) { diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index 6fc14bf..b34f644 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -167,7 +167,7 @@ void FTVHelp::finalize() */ void FTVHelp::incContentsDepth() { - //printf("incContentsDepth() indent=%d\n",m_indent); + //printf("%p: incContentsDepth() indent=%d\n",this,m_indent); m_indent++; ASSERT(m_indent0); if (m_indent>0) { diff --git a/src/index.cpp b/src/index.cpp index 532f627..5dcdf82 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -326,6 +326,66 @@ void endFileWithNavPath(const Definition *d,OutputList &ol) } //---------------------------------------------------------------------- + +static bool memberVisibleInIndex(const MemberDef *md) +{ + bool isAnonymous = md->isAnonymous(); + bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS); + bool extractStatic = Config_getBool(EXTRACT_STATIC); + return (!isAnonymous && + (!hideUndocMembers || md->hasDocumentation()) && + (!md->isStatic() || extractStatic) + ); +} + +static void writeMemberToIndex(const Definition *def,const MemberDef *md,bool addToIndex) +{ + bool isAnonymous = md->isAnonymous(); + bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS); + const MemberList *enumList = md->enumFieldList(); + bool isDir = enumList!=0 && md->isEnumerate(); + if (md->getOuterScope()==def || md->getOuterScope()==Doxygen::globalScope) + { + Doxygen::indexList->addContentsItem(isDir, + md->name(),md->getReference(),md->getOutputFileBase(),md->anchor(),FALSE,addToIndex); + } + else // inherited member + { + Doxygen::indexList->addContentsItem(isDir, + md->name(),def->getReference(),def->getOutputFileBase(),md->anchor(),FALSE,addToIndex); + } + if (isDir) + { + if (!isAnonymous) + { + Doxygen::indexList->incContentsDepth(); + } + MemberListIterator emli(*enumList); + MemberDef *emd; + for (emli.toFirst();(emd=emli.current());++emli) + { + if (!hideUndocMembers || emd->hasDocumentation()) + { + if (emd->getOuterScope()==def || emd->getOuterScope()==Doxygen::globalScope) + { + Doxygen::indexList->addContentsItem(FALSE, + emd->name(),emd->getReference(),emd->getOutputFileBase(),emd->anchor(),FALSE,addToIndex); + } + else // inherited member + { + Doxygen::indexList->addContentsItem(FALSE, + emd->name(),def->getReference(),def->getOutputFileBase(),emd->anchor(),FALSE,addToIndex); + } + } + } + if (!isAnonymous) + { + Doxygen::indexList->decContentsDepth(); + } + } +} + +//---------------------------------------------------------------------- template void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part, const QCString &name,const QCString &anchor, @@ -366,55 +426,9 @@ void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part, MemberDef *md; for (mi.toFirst();(md=mi.current());++mi) { - const MemberList *enumList = md->enumFieldList(); - bool isDir = enumList!=0 && md->isEnumerate(); - bool isAnonymous = md->isAnonymous(); - static bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS); - static bool extractStatic = Config_getBool(EXTRACT_STATIC); - if (!isAnonymous && - (!hideUndocMembers || md->hasDocumentation()) && - (!md->isStatic() || extractStatic) - ) + if (memberVisibleInIndex(md)) { - if (md->getOuterScope()==def || md->getOuterScope()==Doxygen::globalScope) - { - Doxygen::indexList->addContentsItem(isDir, - md->name(),md->getReference(),md->getOutputFileBase(),md->anchor(),FALSE,addToIndex); - } - else // inherited member - { - Doxygen::indexList->addContentsItem(isDir, - md->name(),def->getReference(),def->getOutputFileBase(),md->anchor(),FALSE,addToIndex); - } - } - if (isDir) - { - if (!isAnonymous) - { - Doxygen::indexList->incContentsDepth(); - } - MemberListIterator emli(*enumList); - MemberDef *emd; - for (emli.toFirst();(emd=emli.current());++emli) - { - if (!hideUndocMembers || emd->hasDocumentation()) - { - if (emd->getOuterScope()==def || emd->getOuterScope()==Doxygen::globalScope) - { - Doxygen::indexList->addContentsItem(FALSE, - emd->name(),emd->getReference(),emd->getOutputFileBase(),emd->anchor(),FALSE,addToIndex); - } - else // inherited member - { - Doxygen::indexList->addContentsItem(FALSE, - emd->name(),def->getReference(),def->getOutputFileBase(),emd->anchor(),FALSE,addToIndex); - } - } - } - if (!isAnonymous) - { - Doxygen::indexList->decContentsDepth(); - } + writeMemberToIndex(def,md,addToIndex); } } } @@ -1554,7 +1568,7 @@ static int countNamespaces() //---------------------------------------------------------------------------- -void writeClassTree(ClassSDict *clDict,FTVHelp *ftv,bool addToIndex,bool globalOnly,ClassDef::CompoundType ct) +static void writeClassTree(ClassSDict *clDict,FTVHelp *ftv,bool addToIndex,bool globalOnly,ClassDef::CompoundType ct) { static bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE); if (clDict) @@ -1629,10 +1643,64 @@ void writeClassTree(ClassSDict *clDict,FTVHelp *ftv,bool addToIndex,bool globalO } } +static int countVisibleMembers(const NamespaceDef *nd) +{ + int count=0; + QListIterator eli(LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace)); + LayoutDocEntry *lde; + for (eli.toFirst();(lde=eli.current());++eli) + { + if (lde->kind()==LayoutDocEntry::MemberDef) + { + LayoutDocEntryMemberDef *lmd = (LayoutDocEntryMemberDef*)lde; + MemberList *ml = nd->getMemberList(lmd->type); + if (ml) + { + MemberListIterator mi(*ml); + MemberDef *md; + for (mi.toFirst();(md=mi.current());++mi) + { + if (memberVisibleInIndex(md)) + { + count++; + } + } + } + } + } + return count; +} + +static void writeNamespaceMembers(const NamespaceDef *nd,bool addToIndex) +{ + QListIterator eli(LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace)); + LayoutDocEntry *lde; + for (eli.toFirst();(lde=eli.current());++eli) + { + if (lde->kind()==LayoutDocEntry::MemberDef) + { + LayoutDocEntryMemberDef *lmd = (LayoutDocEntryMemberDef*)lde; + MemberList *ml = nd->getMemberList(lmd->type); + if (ml) + { + MemberListIterator mi(*ml); + MemberDef *md; + for (mi.toFirst();(md=mi.current());++mi) + { + //printf(" member %s visible=%d\n",md->name().data(),memberVisibleInIndex(md)); + if (memberVisibleInIndex(md)) + { + writeMemberToIndex(nd,md,addToIndex); + } + } + } + } + } +} + static void writeNamespaceTree(const NamespaceSDict *nsDict,FTVHelp *ftv, - bool rootOnly,bool showClasses,bool addToIndex,ClassDef::CompoundType ct) + bool rootOnly,bool addToIndex) { - static bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE); if (nsDict) { NamespaceSDict::Iterator nli(*nsDict); @@ -1643,8 +1711,11 @@ static void writeNamespaceTree(const NamespaceSDict *nsDict,FTVHelp *ftv, (!rootOnly || nd->getOuterScope()==Doxygen::globalScope)) { - bool hasChildren = namespaceHasVisibleChild(nd,showClasses,sliceOpt,ct); + bool hasChildren = namespaceHasNestedNamespace(nd); bool isLinkable = nd->isLinkableInProject(); + int visibleMembers = countVisibleMembers(nd); + + //printf("namespace %s hasChildren=%d visibleMembers=%d\n",nd->name().data(),hasChildren,visibleMembers); QCString ref; QCString file; @@ -1658,45 +1729,113 @@ static void writeNamespaceTree(const NamespaceSDict *nsDict,FTVHelp *ftv, } } - if ((isLinkable && !showClasses) || hasChildren) + bool isDir = hasChildren || visibleMembers>0; + if ((isLinkable) || isDir) { ftv->addContentsItem(hasChildren,nd->localName(),ref,file,0,FALSE,TRUE,nd); if (addToIndex) { - Doxygen::indexList->addContentsItem(hasChildren,nd->localName(),ref,file,QCString(), + Doxygen::indexList->addContentsItem(isDir,nd->localName(),ref,file,QCString(), hasChildren && !file.isEmpty(),addToIndex); } + if (addToIndex && isDir) + { + Doxygen::indexList->incContentsDepth(); + } - //printf("*** writeNamespaceTree count=%d addToIndex=%d showClasses=%d classCount=%d\n", - // count,addToIndex,showClasses,classCount); - if (hasChildren) + //printf("*** writeNamespaceTree count=%d addToIndex=%d false=%d classCount=%d\n", + // count,addToIndex,false,classCount); + if (isDir) { - if (addToIndex) Doxygen::indexList->incContentsDepth(); ftv->incContentsDepth(); - writeNamespaceTree(nd->getNamespaceSDict(),ftv,FALSE,showClasses,addToIndex,ct); - if (showClasses) + writeNamespaceTree(nd->getNamespaceSDict(),ftv,FALSE,addToIndex); + writeNamespaceMembers(nd,addToIndex); + ftv->decContentsDepth(); + } + if (addToIndex && isDir) + { + Doxygen::indexList->decContentsDepth(); + } + } + } + } + } +} + +static void writeClassTreeInsideNamespace(const NamespaceSDict *nsDict,FTVHelp *ftv, + bool rootOnly,bool addToIndex,ClassDef::CompoundType ct) +{ + static bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE); + if (nsDict) + { + NamespaceSDict::Iterator nli(*nsDict); + const NamespaceDef *nd; + for (nli.toFirst();(nd=nli.current());++nli) + { + if (!nd->isAnonymous() && + (!rootOnly || nd->getOuterScope()==Doxygen::globalScope)) + { + bool isDir = namespaceHasNestedClass(nd,sliceOpt,ct); + bool isLinkable = nd->isLinkableInProject(); + + //printf("namespace %s isDir=%d\n",nd->name().data(),isDir); + + QCString ref; + QCString file; + if (isLinkable) + { + ref = nd->getReference(); + file = nd->getOutputFileBase(); + if (nd->getLanguage()==SrcLangExt_VHDL) // UGLY HACK + { + file=file.replace(0,qstrlen("namespace"),"class"); + } + } + + if (isDir) + { + ftv->addContentsItem(isDir,nd->localName(),ref,file,0,FALSE,TRUE,nd); + + if (addToIndex) + { + // the namespace entry is already shown under the namespace list so don't + // add it to the nav index and don't create a separate index file for it otherwise + // it will overwrite the one written for the namespace list. + Doxygen::indexList->addContentsItem(isDir,nd->localName(),ref,file,QCString(), + false, // separateIndex + false // addToNavIndex + ); + } + if (addToIndex) + { + Doxygen::indexList->incContentsDepth(); + } + + ftv->incContentsDepth(); + writeClassTreeInsideNamespace(nd->getNamespaceSDict(),ftv,FALSE,addToIndex,ct); + ClassSDict *d = nd->getClassSDict(); + if (sliceOpt) + { + if (ct == ClassDef::Interface) { - ClassSDict *d = nd->getClassSDict(); - if (sliceOpt) - { - if (ct == ClassDef::Interface) - { - d = nd->getInterfaceSDict(); - } - else if (ct == ClassDef::Struct) - { - d = nd->getStructSDict(); - } - else if (ct == ClassDef::Exception) - { - d = nd->getExceptionSDict(); - } - } - writeClassTree(d,ftv,addToIndex,FALSE,ct); + d = nd->getInterfaceSDict(); + } + else if (ct == ClassDef::Struct) + { + d = nd->getStructSDict(); + } + else if (ct == ClassDef::Exception) + { + d = nd->getExceptionSDict(); } - ftv->decContentsDepth(); - if (addToIndex) Doxygen::indexList->decContentsDepth(); + } + writeClassTree(d,ftv,addToIndex,FALSE,ct); + ftv->decContentsDepth(); + + if (addToIndex) + { + Doxygen::indexList->decContentsDepth(); } } } @@ -1794,7 +1933,7 @@ static void writeNamespaceIndex(OutputList &ol) Doxygen::indexList->incContentsDepth(); } FTVHelp* ftv = new FTVHelp(FALSE); - writeNamespaceTree(Doxygen::namespaceSDict,ftv,TRUE,FALSE,addToIndex,ClassDef::Class); + writeNamespaceTree(Doxygen::namespaceSDict,ftv,TRUE,addToIndex); QGString outStr; FTextStream t(&outStr); ftv->generateTreeViewInline(t); @@ -2424,26 +2563,50 @@ static void writeAlphabeticalExceptionIndex(OutputList &ol) //---------------------------------------------------------------------------- -static void writeAnnotatedIndex(OutputList &ol) +struct AnnotatedIndexContext +{ + AnnotatedIndexContext(int numAnno,int numPrint, + LayoutNavEntry::Kind lk,LayoutNavEntry::Kind fk, + const QCString &title,const QCString &intro, + ClassDef::CompoundType ct, + const QCString &fn, + HighlightedItem hi) : + numAnnotated(numAnno), numPrinted(numPrint), + listKind(lk), fallbackKind(fk), + listDefaultTitleText(title), listDefaultIntroText(intro), + compoundType(ct),fileBaseName(fn), + hiItem(hi) { } + + const int numAnnotated; + const int numPrinted; + const LayoutNavEntry::Kind listKind; + const LayoutNavEntry::Kind fallbackKind; + const QCString listDefaultTitleText; + const QCString listDefaultIntroText; + const ClassDef::CompoundType compoundType; + const QCString fileBaseName; + const HighlightedItem hiItem; +}; + +static void writeAnnotatedIndexGeneric(OutputList &ol,const AnnotatedIndexContext ctx) { //printf("writeAnnotatedIndex: count=%d printed=%d\n", // annotatedClasses,annotatedClassesPrinted); - if (annotatedClasses==0) return; + if (ctx.numAnnotated==0) return; ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); - if (annotatedClassesPrinted==0) + if (ctx.numPrinted==0) { ol.disable(OutputGenerator::Latex); ol.disable(OutputGenerator::RTF); } - LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::ClassList); - if (lne==0) lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Classes); // fall back - QCString title = lne ? lne->title() : theTranslator->trCompoundList(); + LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(ctx.listKind); + if (lne==0) lne = LayoutDocManager::instance().rootNavEntry()->find(ctx.fallbackKind); // fall back + QCString title = lne ? lne->title() : ctx.listDefaultTitleText; bool addToIndex = lne==0 || lne->visible(); - - startFile(ol,"annotated",0,title,HLI_AnnotatedClasses); + startFile(ol,ctx.fileBaseName,0,title,ctx.hiItem); startTitle(ol,0); ol.parseText(title); @@ -2452,7 +2615,7 @@ static void writeAnnotatedIndex(OutputList &ol) ol.startContents(); ol.startTextBlock(); - ol.parseText(lne ? lne->intro() : theTranslator->trCompoundListDescription()); + ol.parseText(lne ? lne->intro() : ctx.listDefaultIntroText); ol.endTextBlock(); // --------------- @@ -2462,7 +2625,7 @@ static void writeAnnotatedIndex(OutputList &ol) ol.disable(OutputGenerator::Html); Doxygen::indexList->disable(); - writeAnnotatedClassList(ol, ClassDef::Class); + writeAnnotatedClassList(ol, ctx.compoundType); Doxygen::indexList->enable(); ol.popGeneratorState(); @@ -2476,17 +2639,16 @@ static void writeAnnotatedIndex(OutputList &ol) { if (addToIndex) { - Doxygen::indexList->addContentsItem(TRUE,title,0,"annotated",0,TRUE,TRUE); + Doxygen::indexList->addContentsItem(TRUE,title,0,ctx.fileBaseName,0,TRUE,TRUE); Doxygen::indexList->incContentsDepth(); } - FTVHelp* ftv = new FTVHelp(FALSE); - writeNamespaceTree(Doxygen::namespaceSDict,ftv,TRUE,TRUE,addToIndex,ClassDef::Class); - writeClassTree(Doxygen::classSDict,ftv,addToIndex,TRUE,ClassDef::Class); + FTVHelp ftv(false); + writeClassTreeInsideNamespace(Doxygen::namespaceSDict,&ftv,TRUE,addToIndex,ctx.compoundType); + writeClassTree(Doxygen::classSDict,&ftv,addToIndex,TRUE,ctx.compoundType); QGString outStr; FTextStream t(&outStr); - ftv->generateTreeViewInline(t); + ftv.generateTreeViewInline(t); ol.writeString(outStr); - delete ftv; if (addToIndex) { Doxygen::indexList->decContentsDepth(); @@ -2502,233 +2664,58 @@ static void writeAnnotatedIndex(OutputList &ol) //---------------------------------------------------------------------------- -static void writeAnnotatedInterfaceIndex(OutputList &ol) +static void writeAnnotatedIndex(OutputList &ol) { - //printf("writeAnnotatedInterfaceIndex: count=%d printed=%d\n", - // annotatedInterfaces,annotatedInterfacesPrinted); - if (annotatedInterfaces==0) return; + writeAnnotatedIndexGeneric(ol, + AnnotatedIndexContext(annotatedClasses,annotatedClassesPrinted, + LayoutNavEntry::ClassList,LayoutNavEntry::Classes, + theTranslator->trCompoundList(),theTranslator->trCompoundListDescription(), + ClassDef::Class, + "annotated", + HLI_AnnotatedClasses)); - ol.pushGeneratorState(); - ol.disable(OutputGenerator::Man); - if (annotatedInterfacesPrinted==0) - { - ol.disable(OutputGenerator::Latex); - ol.disable(OutputGenerator::RTF); - } - LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::InterfaceList); - if (lne==0) lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Interfaces); // fall back - QCString title = lne ? lne->title() : theTranslator->trInterfaceList(); - bool addToIndex = lne==0 || lne->visible(); - - startFile(ol,"annotatedinterfaces",0,title,HLI_AnnotatedInterfaces); - - startTitle(ol,0); - ol.parseText(title); - endTitle(ol,0,0); - - ol.startContents(); - - ol.startTextBlock(); - ol.parseText(lne ? lne->intro() : theTranslator->trInterfaceListDescription()); - ol.endTextBlock(); - - // --------------- - // Linear interface index for Latex/RTF - // --------------- - ol.pushGeneratorState(); - ol.disable(OutputGenerator::Html); - Doxygen::indexList->disable(); - - writeAnnotatedClassList(ol, ClassDef::Interface); - - Doxygen::indexList->enable(); - ol.popGeneratorState(); - - // --------------- - // Hierarchical interface index for HTML - // --------------- - ol.pushGeneratorState(); - ol.disableAllBut(OutputGenerator::Html); +} - { - if (addToIndex) - { - Doxygen::indexList->addContentsItem(TRUE,title,0,"annotatedinterfaces",0,TRUE,TRUE); - Doxygen::indexList->incContentsDepth(); - } - FTVHelp* ftv = new FTVHelp(FALSE); - writeNamespaceTree(Doxygen::namespaceSDict,ftv,TRUE,TRUE,addToIndex,ClassDef::Interface); - writeClassTree(Doxygen::classSDict,ftv,addToIndex,TRUE,ClassDef::Interface); - QGString outStr; - FTextStream t(&outStr); - ftv->generateTreeViewInline(t); - ol.writeString(outStr); - delete ftv; - if (addToIndex) - { - Doxygen::indexList->decContentsDepth(); - } - } +//---------------------------------------------------------------------------- - ol.popGeneratorState(); - // ------ +static void writeAnnotatedInterfaceIndex(OutputList &ol) +{ + writeAnnotatedIndexGeneric(ol, + AnnotatedIndexContext(annotatedInterfaces,annotatedInterfacesPrinted, + LayoutNavEntry::InterfaceList,LayoutNavEntry::Interfaces, + theTranslator->trInterfaceList(),theTranslator->trInterfaceListDescription(), + ClassDef::Interface, + "annotatedinterfaces", + HLI_AnnotatedInterfaces)); - endFile(ol); // contains ol.endContents() - ol.popGeneratorState(); } //---------------------------------------------------------------------------- static void writeAnnotatedStructIndex(OutputList &ol) { - //printf("writeAnnotatedStructIndex: count=%d printed=%d\n", - // annotatedStructs,annotatedStructsPrinted); - if (annotatedStructs==0) return; - - ol.pushGeneratorState(); - ol.disable(OutputGenerator::Man); - if (annotatedStructsPrinted==0) - { - ol.disable(OutputGenerator::Latex); - ol.disable(OutputGenerator::RTF); - } - LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::StructList); - if (lne==0) lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Structs); // fall back - QCString title = lne ? lne->title() : theTranslator->trStructList(); - bool addToIndex = lne==0 || lne->visible(); - - startFile(ol,"annotatedstructs",0,title,HLI_AnnotatedStructs); - - startTitle(ol,0); - ol.parseText(title); - endTitle(ol,0,0); - - ol.startContents(); - - ol.startTextBlock(); - ol.parseText(lne ? lne->intro() : theTranslator->trStructListDescription()); - ol.endTextBlock(); - - // --------------- - // Linear struct index for Latex/RTF - // --------------- - ol.pushGeneratorState(); - ol.disable(OutputGenerator::Html); - Doxygen::indexList->disable(); - - writeAnnotatedClassList(ol, ClassDef::Struct); - - Doxygen::indexList->enable(); - ol.popGeneratorState(); - - // --------------- - // Hierarchical struct index for HTML - // --------------- - ol.pushGeneratorState(); - ol.disableAllBut(OutputGenerator::Html); - - { - if (addToIndex) - { - Doxygen::indexList->addContentsItem(TRUE,title,0,"annotatedstructs",0,TRUE,TRUE); - Doxygen::indexList->incContentsDepth(); - } - FTVHelp* ftv = new FTVHelp(FALSE); - writeNamespaceTree(Doxygen::namespaceSDict,ftv,TRUE,TRUE,addToIndex,ClassDef::Struct); - writeClassTree(Doxygen::classSDict,ftv,addToIndex,TRUE,ClassDef::Struct); - QGString outStr; - FTextStream t(&outStr); - ftv->generateTreeViewInline(t); - ol.writeString(outStr); - delete ftv; - if (addToIndex) - { - Doxygen::indexList->decContentsDepth(); - } - } + writeAnnotatedIndexGeneric(ol, + AnnotatedIndexContext(annotatedStructs,annotatedStructsPrinted, + LayoutNavEntry::StructList,LayoutNavEntry::Structs, + theTranslator->trStructList(),theTranslator->trStructListDescription(), + ClassDef::Struct, + "annotatedstructs", + HLI_AnnotatedStructs)); - ol.popGeneratorState(); - // ------ - - endFile(ol); // contains ol.endContents() - ol.popGeneratorState(); } //---------------------------------------------------------------------------- static void writeAnnotatedExceptionIndex(OutputList &ol) { - //printf("writeAnnotatedExceptionIndex: count=%d printed=%d\n", - // annotatedExceptions,annotatedExceptionsPrinted); - if (annotatedExceptions==0) return; - - ol.pushGeneratorState(); - ol.disable(OutputGenerator::Man); - if (annotatedExceptionsPrinted==0) - { - ol.disable(OutputGenerator::Latex); - ol.disable(OutputGenerator::RTF); - } - LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::ExceptionList); - if (lne==0) lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Exceptions); // fall back - QCString title = lne ? lne->title() : theTranslator->trExceptionList(); - bool addToIndex = lne==0 || lne->visible(); - - startFile(ol,"annotatedexceptions",0,title,HLI_AnnotatedExceptions); - - startTitle(ol,0); - ol.parseText(title); - endTitle(ol,0,0); - - ol.startContents(); - - ol.startTextBlock(); - ol.parseText(lne ? lne->intro() : theTranslator->trExceptionListDescription()); - ol.endTextBlock(); - - // --------------- - // Linear interface index for Latex/RTF - // --------------- - ol.pushGeneratorState(); - ol.disable(OutputGenerator::Html); - Doxygen::indexList->disable(); - - writeAnnotatedClassList(ol, ClassDef::Exception); + writeAnnotatedIndexGeneric(ol, + AnnotatedIndexContext(annotatedExceptions,annotatedExceptionsPrinted, + LayoutNavEntry::ExceptionList,LayoutNavEntry::Exceptions, + theTranslator->trExceptionList(),theTranslator->trExceptionListDescription(), + ClassDef::Exception, + "annotatedexceptions", + HLI_AnnotatedExceptions)); - Doxygen::indexList->enable(); - ol.popGeneratorState(); - - // --------------- - // Hierarchical interface index for HTML - // --------------- - ol.pushGeneratorState(); - ol.disableAllBut(OutputGenerator::Html); - - { - if (addToIndex) - { - Doxygen::indexList->addContentsItem(TRUE,title,0,"annotatedexceptions",0,TRUE,TRUE); - Doxygen::indexList->incContentsDepth(); - } - FTVHelp* ftv = new FTVHelp(FALSE); - writeNamespaceTree(Doxygen::namespaceSDict,ftv,TRUE,TRUE,addToIndex,ClassDef::Exception); - writeClassTree(Doxygen::classSDict,ftv,addToIndex,TRUE,ClassDef::Exception); - QGString outStr; - FTextStream t(&outStr); - ftv->generateTreeViewInline(t); - ol.writeString(outStr); - delete ftv; - if (addToIndex) - { - Doxygen::indexList->decContentsDepth(); - } - } - - ol.popGeneratorState(); - // ------ - - endFile(ol); // contains ol.endContents() - ol.popGeneratorState(); } //---------------------------------------------------------------------------- diff --git a/src/util.cpp b/src/util.cpp index 2e31df7..dd25284 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -8031,54 +8031,65 @@ uint getUtf8CodeToUpper( const QCString& s, int idx ) } //-------------------------------------------------------------------------------------- +// +bool namespaceHasNestedNamespace(const NamespaceDef *nd) +{ + NamespaceSDict::Iterator cnli(*nd->getNamespaceSDict()); + const NamespaceDef *cnd; + for (cnli.toFirst();(cnd=cnli.current());++cnli) + { + if (cnd->isLinkableInProject() && !cnd->isAnonymous()) + { + return true; + } + } + return false; +} -bool namespaceHasVisibleChild(const NamespaceDef *nd,bool includeClasses,bool filterClasses,ClassDef::CompoundType ct) +bool namespaceHasNestedClass(const NamespaceDef *nd,bool filterClasses,ClassDef::CompoundType ct) { + //printf(">namespaceHasVisibleChild(%s,includeClasses=%d)\n",nd->name().data(),includeClasses); if (nd->getNamespaceSDict()) { NamespaceSDict::Iterator cnli(*nd->getNamespaceSDict()); const NamespaceDef *cnd; for (cnli.toFirst();(cnd=cnli.current());++cnli) { - if (cnd->isLinkableInProject() && !cnd->isAnonymous()) - { - return TRUE; - } - else if (namespaceHasVisibleChild(cnd,includeClasses,filterClasses,ct)) + if (namespaceHasNestedClass(cnd,filterClasses,ct)) { + //printf("name().data(),includeClasses); return TRUE; } } } - if (includeClasses) + + const ClassSDict *d = nd->getClassSDict(); + if (filterClasses) { - const ClassSDict *d = nd->getClassSDict(); - if (filterClasses) + if (ct == ClassDef::Interface) { - if (ct == ClassDef::Interface) - { - d = nd->getInterfaceSDict(); - } - else if (ct == ClassDef::Struct) - { - d = nd->getStructSDict(); - } - else if (ct == ClassDef::Exception) - { - d = nd->getExceptionSDict(); - } + d = nd->getInterfaceSDict(); } + else if (ct == ClassDef::Struct) + { + d = nd->getStructSDict(); + } + else if (ct == ClassDef::Exception) + { + d = nd->getExceptionSDict(); + } + } - if (d) + if (d) + { + ClassSDict::Iterator cli(*d); + const ClassDef *cd; + for (;(cd=cli.current());++cli) { - ClassSDict::Iterator cli(*d); - const ClassDef *cd; - for (;(cd=cli.current());++cli) + if (cd->isLinkableInProject() && cd->templateMaster()==0) { - if (cd->isLinkableInProject() && cd->templateMaster()==0) - { - return TRUE; - } + //printf("name().data(),includeClasses); + return TRUE; } } } diff --git a/src/util.h b/src/util.h index 03296f9..bc4b025 100644 --- a/src/util.h +++ b/src/util.h @@ -312,7 +312,8 @@ void initClassHierarchy(ClassSDict *cl); bool hasVisibleRoot(const BaseClassList &bcl); bool classHasVisibleChildren(const ClassDef *cd); -bool namespaceHasVisibleChild(const NamespaceDef *nd,bool includeClasses,bool filterClasses,ClassDef::CompoundType ct); +bool namespaceHasNestedNamespace(const NamespaceDef *nd); +bool namespaceHasNestedClass(const NamespaceDef *nd,bool filterClasses,ClassDef::CompoundType ct); bool classVisibleInIndex(const ClassDef *cd); int minClassDistance(const ClassDef *cd,const ClassDef *bcd,int level=0); -- cgit v0.12