From 67ec066282ab93018fa4865cfb7fb39c5b6df8e4 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 12 Jun 2021 15:13:05 +0200 Subject: Added concepts to the templated output also made some changes to make the templated HTML output better match the built-in output. --- src/conceptdef.cpp | 27 +- src/conceptdef.h | 1 + src/context.cpp | 567 ++++++++++++++++++++++++++++++++---- src/context.h | 96 +++++- src/definition.cpp | 14 - src/doxygen.cpp | 2 +- src/index.cpp | 3 +- src/template.cpp | 41 +++ src/template.h | 2 +- templates/html/htmlannotated.tpl | 2 +- templates/html/htmlbase.tpl | 12 +- templates/html/htmlclasses.tpl | 2 +- templates/html/htmlconcept.tpl | 65 +++++ templates/html/htmlconcepts.tpl | 15 + templates/html/htmldirtree.tpl | 6 +- templates/html/htmlexamples.tpl | 2 +- templates/html/htmlfiles.tpl | 2 +- templates/html/htmlhierarchy.tpl | 2 +- templates/html/htmlindexpages.tpl | 2 +- templates/html/htmljsmenudata.tpl | 3 + templates/html/htmljsnavtree.tpl | 2 +- templates/html/htmllayout.tpl | 30 +- templates/html/htmlmembersindex.tpl | 20 +- templates/html/htmlmodules.tpl | 2 +- templates/html/htmlnamespaces.tpl | 2 +- templates/html/htmlpages.tpl | 2 +- templates/html/htmltabs.tpl | 4 + 27 files changed, 792 insertions(+), 136 deletions(-) create mode 100644 templates/html/htmlconcept.tpl create mode 100644 templates/html/htmlconcepts.tpl diff --git a/src/conceptdef.cpp b/src/conceptdef.cpp index 3047f4a..ee2d43a 100644 --- a/src/conceptdef.cpp +++ b/src/conceptdef.cpp @@ -52,6 +52,7 @@ class ConceptDefImpl : public DefinitionMixin const QCString &header,bool localNames) const; virtual const NamespaceDef *getNamespaceDef() const; virtual const FileDef *getFileDef() const; + virtual QCString title() const; //---------- ConceptDefMutable virtual void setIncludeFile(FileDef *fd,const QCString &incName,bool local,bool force); @@ -125,6 +126,8 @@ class ConceptDefAliasImpl : public DefinitionAliasMixin { return getCdAlias()->getNamespaceDef(); } virtual const FileDef *getFileDef() const { return getCdAlias()->getFileDef(); } + virtual QCString title() const + { return getCdAlias()->title(); } virtual void writeDeclarationLink(OutputList &ol,bool &found, const QCString &header,bool localNames) const { getCdAlias()->writeDeclarationLink(ol,found,header,localNames); } @@ -255,14 +258,9 @@ const FileDef *ConceptDefImpl::getFileDef() const return m_fileDef; } -void ConceptDefImpl::setInitializer(const QCString &init) -{ - m_initializer = init; -} - -QCString ConceptDefImpl::initializer() const +QCString ConceptDefImpl::title() const { - return m_initializer; + return theTranslator->trConceptReference(displayName()); } void ConceptDefImpl::writeTagFile(TextStream &tagFile) @@ -379,6 +377,16 @@ static QCString templateSpec(const ArgumentList &al) return t.str(); } +void ConceptDefImpl::setInitializer(const QCString &init) +{ + m_initializer = templateSpec(m_tArgList)+"\nconcept "+name()+" = "+init; +} + +QCString ConceptDefImpl::initializer() const +{ + return m_initializer; +} + void ConceptDefImpl::writeDefinition(OutputList &ol,const QCString &title) const { ol.startGroupHeader(); @@ -391,10 +399,6 @@ void ConceptDefImpl::writeDefinition(OutputList &ol,const QCString &title) const QCString scopeName; if (getOuterScope()!=Doxygen::globalScope) scopeName=getOuterScope()->name(); TextStream conceptDef; - conceptDef << templateSpec(m_tArgList); - conceptDef << "\nconcept "; - conceptDef << name(); - conceptDef << " = "; conceptDef << m_initializer; intf->parseCode(ol,scopeName,conceptDef.str(),SrcLangExt_Cpp,false,QCString(), m_fileDef, -1,-1,true,0,false,this); @@ -479,6 +483,7 @@ void ConceptDefImpl::writeDocumentation(OutputList &ol) // ---- title part startTitle(ol,getOutputFileBase(),this); ol.parseText(pageTitle); + addGroupListToTitle(ol,this); endTitle(ol,getOutputFileBase(),displayName()); // ---- contents part diff --git a/src/conceptdef.h b/src/conceptdef.h index 82f097f..8d40ce5 100644 --- a/src/conceptdef.h +++ b/src/conceptdef.h @@ -36,6 +36,7 @@ class ConceptDef : public Definition const QCString &header,bool localNames) const = 0; virtual const NamespaceDef *getNamespaceDef() const = 0; virtual const FileDef *getFileDef() const = 0; + virtual QCString title() const = 0; }; class ConceptDefMutable : public DefinitionMutable, public ConceptDef diff --git a/src/context.cpp b/src/context.cpp index 6835d98..11a706b 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -654,6 +654,14 @@ class TranslateContext::Private // TODO: VHDL: theTranslator->trVhdlType(VhdlDocGen::ENTITY,FALSE) // TODO: Fortran: trDataTypes() } + TemplateVariant concepts() const + { + return theTranslator->trConcept(true,false); + } + TemplateVariant conceptDefinition() const + { + return theTranslator->trConceptDefinition(); + } TemplateVariant classList() const { return theTranslator->trCompoundList(); @@ -957,6 +965,11 @@ class TranslateContext::Private bool extractAll = Config_getBool(EXTRACT_ALL); return theTranslator->trNamespaceListDescription(extractAll); } + TemplateVariant conceptListDescription() const + { + bool extractAll = Config_getBool(EXTRACT_ALL); + return theTranslator->trConceptListDescription(extractAll); + } TemplateVariant directories() const { return theTranslator->trDirectories(); @@ -1079,6 +1092,10 @@ class TranslateContext::Private s_inst.addProperty("classListDescription", &Private::classListDescription); //%% string classIndex s_inst.addProperty("classIndex", &Private::classIndex); + //%% string concepts + s_inst.addProperty("concepts", &Private::concepts); + //%% string conceptDefintion + s_inst.addProperty("conceptDefinition", &Private::conceptDefinition); //%% string namespaceIndex s_inst.addProperty("namespaceIndex", &Private::namespaceIndex); //%% string classHierarchy @@ -1193,6 +1210,8 @@ class TranslateContext::Private s_inst.addProperty("fileListDescription",&Private::fileListDescription); //%% string namespaceListDescription s_inst.addProperty("namespaceListDescription",&Private::namespaceListDescription); + //%% string conceptListDescription + s_inst.addProperty("conceptListDescription",&Private::conceptListDescription); //%% string directories s_inst.addProperty("directories", &Private::directories); //%% string moduleDescription @@ -1340,10 +1359,10 @@ static TemplateVariant parseDoc(const Definition *def,const QCString &file,int l return result; } -static TemplateVariant parseCode(MemberDef *md,const QCString &scopeName,const QCString &relPath, +static TemplateVariant parseCode(const Definition *d,const QCString &scopeName,const QCString &relPath, const QCString &code,int startLine=-1,int endLine=-1,bool showLineNumbers=FALSE) { - auto intf = Doxygen::parserManager->getCodeParser(md->getDefFileExtension()); + auto intf = Doxygen::parserManager->getCodeParser(d->getDefFileExtension()); intf->resetCodeParserState(); TextStream t; switch (g_globals.outputFormat) @@ -1351,15 +1370,15 @@ static TemplateVariant parseCode(MemberDef *md,const QCString &scopeName,const Q case ContextOutputFormat_Html: { HtmlCodeGenerator codeGen(t,relPath); - intf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,QCString(),md->getBodyDef(), - startLine,endLine,TRUE,md,showLineNumbers,md); + intf->parseCode(codeGen,scopeName,code,d->getLanguage(),FALSE,QCString(),d->getBodyDef(), + startLine,endLine,TRUE,toMemberDef(d),showLineNumbers,d); } break; case ContextOutputFormat_Latex: { - LatexCodeGenerator codeGen(t,relPath,md->docFile()); - intf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,QCString(),md->getBodyDef(), - startLine,endLine,TRUE,md,showLineNumbers,md); + LatexCodeGenerator codeGen(t,relPath,d->docFile()); + intf->parseCode(codeGen,scopeName,code,d->getLanguage(),FALSE,QCString(),d->getBodyDef(), + startLine,endLine,TRUE,toMemberDef(d),showLineNumbers,d); } break; // TODO: support other generators @@ -1641,7 +1660,7 @@ class DefinitionContext TemplateList *list = TemplateList::alloc(); if (m_def->getOuterScope() && m_def->getOuterScope()!=Doxygen::globalScope) { - fillPath(m_def->getOuterScope(),list); + fillPath(m_def,list); } else if (m_def->definitionType()==Definition::TypeFile && (toFileDef(m_def))->getDirDef()) { @@ -3716,9 +3735,21 @@ class PageContext::Private : public DefinitionContext { if (m_isMainPage) { - if (mainPageHasTitle()) + QCString projectName = Config_getString(PROJECT_NAME); + if (Doxygen::mainPage && !Doxygen::mainPage->title().isEmpty()) + { + if (Doxygen::mainPage->title().lower()!="notitle") + { + return m_pageDef->title(); + } + else + { + return ""; + } + } + else if (!projectName.isEmpty()) { - return m_pageDef->title(); + return projectName+" "+theTranslator->trDocumentation(); } else { @@ -4478,7 +4509,7 @@ class MemberContext::Private : public DefinitionContext { scopeName = m_memberDef->getNamespaceDef()->name(); } - cache.initializer = parseCode(const_cast(m_memberDef), + cache.initializer = parseCode(m_memberDef, scopeName,relPathAsString(), m_memberDef->initializer()); cache.initializerParsed = TRUE; @@ -5002,7 +5033,7 @@ class MemberContext::Private : public DefinitionContext { scopeName = m_memberDef->getNamespaceDef()->name(); } - cache.sourceCode = parseCode(const_cast(m_memberDef), + cache.sourceCode = parseCode(m_memberDef, scopeName,relPathAsString(), codeFragment,startLine,endLine,TRUE); cache.sourceCodeParsed = TRUE; @@ -5280,6 +5311,160 @@ StringVector MemberContext::fields() const //------------------------------------------------------------------------ +//%% struct Concept(Symbol): class information +//%% { +class ConceptContext::Private : public DefinitionContext +{ + public: + Private(const ConceptDef *cd) : DefinitionContext(cd), + m_conceptDef(cd) + { + static bool init=FALSE; + if (!init) + { + addBaseProperties(s_inst); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subHighlight); + s_inst.addProperty("hasDetails", &Private::hasDetails); + s_inst.addProperty("includeInfo", &Private::includeInfo); + s_inst.addProperty("templateDecls", &Private::templateDecls); + s_inst.addProperty("initializer", &Private::initializer); + s_inst.addProperty("initializerAsCode", &Private::initializerAsCode); + init=TRUE; + } + if (!cd->cookie()) { cd->setCookie(new ConceptContext::Private::Cachable(cd)); } + } + virtual ~Private() {} + TemplateVariant get(const QCString &n) const + { + return s_inst.get(this,n); + } + StringVector fields() const + { + return s_inst.fields(); + } + TemplateVariant title() const + { + return TemplateVariant(m_conceptDef->title()); + } + TemplateVariant highlight() const + { + return TemplateVariant("concepts"); + } + TemplateVariant subHighlight() const + { + return TemplateVariant(""); + } + TemplateVariant hasDetails() const + { + return m_conceptDef->hasDetailedDescription(); + } + TemplateVariant includeInfo() const + { + Cachable &cache = getCache(); + if (!cache.includeInfo && m_conceptDef->includeInfo()) + { + cache.includeInfo.reset(IncludeInfoContext::alloc(m_conceptDef->includeInfo(),m_conceptDef->getLanguage())); + } + if (cache.includeInfo) + { + return cache.includeInfo.get(); + } + else + { + return TemplateVariant(FALSE); + } + } + void addTemplateDecls(const ConceptDef *cd,TemplateList *tl) const + { + if (!cd->getTemplateParameterList().empty()) + { + ArgumentListContext *al = ArgumentListContext::alloc(cd->getTemplateParameterList(),cd,relPathAsString()); + // since a TemplateVariant does take ownership of the object, we add it + // a separate list just to be able to delete it and avoid a memory leak + tl->append(al); + } + } + TemplateVariant templateDecls() const + { + Cachable &cache = getCache(); + if (!cache.templateDecls) + { + TemplateList *tl = TemplateList::alloc(); + addTemplateDecls(m_conceptDef,tl); + cache.templateDecls.reset(tl); + } + return cache.templateDecls.get(); + } + TemplateVariant initializer() const + { + return createLinkedText(m_conceptDef,relPathAsString(),m_conceptDef->initializer()); + } + TemplateVariant initializerAsCode() const + { + Cachable &cache = getCache(); + if (!cache.initializerParsed) + { + QCString scopeName; + if (m_conceptDef->getOuterScope()!=Doxygen::globalScope) + { + scopeName = m_conceptDef->getOuterScope()->name(); + } + cache.initializer = parseCode(m_conceptDef, + scopeName,relPathAsString(), + m_conceptDef->initializer()); + cache.initializerParsed = TRUE; + } + return cache.initializer; + } + + private: + const ConceptDef *m_conceptDef; + struct Cachable : public DefinitionContext::Cachable + { + Cachable(const ConceptDef *cd) : DefinitionContext::Cachable(cd) {} + SharedPtr includeInfo; + SharedPtr typeConstraints; + SharedPtr templateDecls; + TemplateVariant initializer; + bool initializerParsed = false; + }; + Cachable &getCache() const + { + Cachable *c = static_cast(m_conceptDef->cookie()); + assert(c!=0); + return *c; + } + static PropertyMapper s_inst; +}; +//%% } + +PropertyMapper ConceptContext::Private::s_inst; + +ConceptContext::ConceptContext(const ConceptDef *cd) : RefCountedContext("ConceptContext") +{ + //printf("ConceptContext::ConceptContext(%s)\n",cd?qPrint(cd->name()):""); + p = new Private(cd); +} + +ConceptContext::~ConceptContext() +{ + delete p; +} + +TemplateVariant ConceptContext::get(const QCString &n) const +{ + return p->get(n); +} + +StringVector ConceptContext::fields() const +{ + return p->fields(); +} + +//------------------------------------------------------------------------ + //%% struct Module(Symbol): group information //%% { class ModuleContext::Private : public DefinitionContext @@ -6052,7 +6237,7 @@ class ClassHierarchyContext::Private public: Private() { - m_classTree.reset(NestingContext::alloc(0,0)); + m_classTree.reset(NestingContext::alloc(0,0,false)); ClassDefSet visitedClasses; m_classTree->addClassHierarchy(*Doxygen::classLinkedMap,visitedClasses); m_classTree->addClassHierarchy(*Doxygen::hiddenClassLinkedMap,visitedClasses); @@ -6201,12 +6386,13 @@ class NestingNodeContext::Private { public: Private(const NestingNodeContext *parent,const NestingNodeContext *thisNode, - const Definition *d,int index,int level,bool addCls,bool inherit, bool hideSuper, + const Definition *d,int index,int level, + bool useFullName,bool addCls,bool addCps,bool inherit, bool hideSuper, ClassDefSet &visitedClasses) - : m_parent(parent), m_def(d), m_level(level), m_index(index) + : m_parent(parent), m_def(d), m_level(level), m_index(index), m_useFullName(useFullName) { - m_children.reset(NestingContext::alloc(thisNode,level+1)); - m_members.reset(NestingContext::alloc(thisNode,level+1)); + m_children.reset(NestingContext::alloc(thisNode,level+1,useFullName)); + m_members.reset(NestingContext::alloc(thisNode,level+1,useFullName)); static bool init=FALSE; if (!init) { @@ -6240,6 +6426,7 @@ class NestingNodeContext::Private s_inst.addProperty("brief",&Private::brief); //%% bool isLinkable s_inst.addProperty("isLinkable",&Private::isLinkable); + s_inst.addProperty("partOfGroup",&Private::partOfGroup); s_inst.addProperty("anchor",&Private::anchor); s_inst.addProperty("fileName",&Private::fileName); s_inst.addProperty("isReference",&Private::isReference); @@ -6247,7 +6434,7 @@ class NestingNodeContext::Private init=TRUE; } - addNamespaces(addCls,visitedClasses); + addNamespaces(addCls,addCps,visitedClasses); addClasses(inherit,hideSuper,visitedClasses); addDirFiles(visitedClasses); addPages(visitedClasses); @@ -6392,7 +6579,11 @@ class NestingNodeContext::Private } TemplateVariant name() const { - return m_def->displayName(FALSE); + return m_def->displayName(m_useFullName); + } + TemplateVariant partOfGroup() const + { + return !(m_def->partOfGroups().empty() || m_useFullName); } QCString relPathAsString() const { @@ -6465,20 +6656,42 @@ class NestingNodeContext::Private m_children->addClasses(cd->getClasses(),FALSE,visitedClasses); } } + const GroupDef *gd = toGroupDef(m_def); + if (gd) + { + m_children->addClasses(gd->getClasses(),FALSE,visitedClasses); + } + } + void addConcepts(ClassDefSet &visitedClasses) + { + const GroupDef *gd = toGroupDef(m_def); + if (gd) + { + m_children->addConcepts(gd->getConcepts(),FALSE,visitedClasses); + } } - void addNamespaces(bool addClasses,ClassDefSet &visitedClasses) + void addNamespaces(bool addClasses,bool addConcepts,ClassDefSet &visitedClasses) { const NamespaceDef *nd = toNamespaceDef(m_def); if (nd) { if (!nd->getNamespaces().empty()) { - m_children->addNamespaces(nd->getNamespaces(),FALSE,addClasses,visitedClasses); + m_children->addNamespaces(nd->getNamespaces(),FALSE,addClasses,addConcepts,visitedClasses); } if (addClasses) { m_children->addClasses(nd->getClasses(),FALSE,visitedClasses); } + if (addConcepts) + { + m_children->addConcepts(nd->getConcepts(),FALSE,visitedClasses); + } + } + const GroupDef *gd = toGroupDef(m_def); + if (gd) + { + m_children->addConcepts(gd->getConcepts(),false,visitedClasses); } } void addDirFiles(ClassDefSet &visitedClasses) @@ -6489,6 +6702,11 @@ class NestingNodeContext::Private m_children->addDirs(dd->subDirs(),visitedClasses); m_children->addFiles(dd->getFiles(),visitedClasses); } + const GroupDef *gd = toGroupDef(m_def); + if (gd) + { + m_children->addDirs(gd->getDirs(),visitedClasses); + } } void addPages(ClassDefSet &visitedClasses) { @@ -6497,6 +6715,11 @@ class NestingNodeContext::Private { m_children->addPages(pd->getSubPages(),FALSE,visitedClasses); } + const GroupDef *gd = toGroupDef(m_def); + if (gd) + { + m_children->addPages(gd->getPages(),FALSE,visitedClasses); + } } void addModules(ClassDefSet &visitedClasses) { @@ -6555,6 +6778,7 @@ class NestingNodeContext::Private SharedPtr m_members; int m_level; int m_index; + bool m_useFullName; struct Cachable { SharedPtr classContext; @@ -6574,11 +6798,13 @@ class NestingNodeContext::Private PropertyMapper NestingNodeContext::Private::s_inst; NestingNodeContext::NestingNodeContext(const NestingNodeContext *parent, - const Definition *d,int index,int level,bool addClass,bool inherit,bool hideSuper, + const Definition *d,int index,int level, + bool useFullName,bool addClass,bool addConcepts, + bool inherit,bool hideSuper, ClassDefSet &visitedClasses) : RefCountedContext("NestingNodeContext") { - p = new Private(parent,this,d,index,level,addClass,inherit,hideSuper,visitedClasses); + p = new Private(parent,this,d,index,level,useFullName,addClass,addConcepts,inherit,hideSuper,visitedClasses); } NestingNodeContext::~NestingNodeContext() @@ -6607,38 +6833,40 @@ QCString NestingNodeContext::id() const class NestingContext::Private : public GenericNodeListContext { public: - Private(const NestingNodeContext *parent,int level) - : m_parent(parent), m_level(level), m_index(0) {} + Private(const NestingNodeContext *parent,int level,bool useFullName) + : m_parent(parent), m_level(level), m_useFullName(useFullName) {} - void addNamespace(const NamespaceDef *nd,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses) + void addNamespace(const NamespaceDef *nd,bool rootOnly,bool addClasses,bool addConcepts, + ClassDefSet &visitedClasses) { if (!nd->isAnonymous() && (!rootOnly || nd->getOuterScope()==Doxygen::globalScope)) { bool hasChildren = namespaceHasNestedNamespace(nd) || - namespaceHasNestedClass(nd,false,ClassDef::Class) || - namespaceHasNestedConcept(nd); + (addClasses && namespaceHasNestedClass(nd,false,ClassDef::Class)) || + (addConcepts && namespaceHasNestedConcept(nd)); bool isLinkable = nd->isLinkableInProject(); if (isLinkable || hasChildren) { - NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,nd,m_index,m_level,addClasses,FALSE,FALSE,visitedClasses); + NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,nd,m_index,m_level,m_useFullName, + addClasses,addConcepts,FALSE,FALSE,visitedClasses); append(nnc); m_index++; } } } - void addNamespaces(const NamespaceLinkedMap &nsLinkedMap,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses) + void addNamespaces(const NamespaceLinkedMap &nsLinkedMap,bool rootOnly,bool addClasses,bool addConcepts,ClassDefSet &visitedClasses) { for (const auto &nd : nsLinkedMap) { - addNamespace(nd.get(),rootOnly,addClasses,visitedClasses); + addNamespace(nd.get(),rootOnly,addClasses,addConcepts,visitedClasses); } } - void addNamespaces(const NamespaceLinkedRefMap &nsLinkedMap,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses) + void addNamespaces(const NamespaceLinkedRefMap &nsLinkedMap,bool rootOnly,bool addClasses,bool addConcepts,ClassDefSet &visitedClasses) { for (const auto &nd : nsLinkedMap) { - addNamespace(nd,rootOnly,addClasses,visitedClasses); + addNamespace(nd,rootOnly,addClasses,addConcepts,visitedClasses); } } void addClass(const ClassDef *cd,bool rootOnly,ClassDefSet &visitedClasses) @@ -6659,7 +6887,21 @@ class NestingContext::Private : public GenericNodeListContext { if (classVisibleInIndex(cd) && cd->templateMaster()==0) { - NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,cd,m_index,m_level,TRUE,FALSE,FALSE,visitedClasses); + NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,cd,m_index,m_level,m_useFullName, + TRUE,FALSE,FALSE,FALSE,visitedClasses); + append(nnc); + m_index++; + } + } + } + void addConcept(const ConceptDef *cd,bool rootOnly,ClassDefSet &visitedClasses) + { + if (!rootOnly || cd->getOuterScope()==0 || cd->getOuterScope()==Doxygen::globalScope) + { + if (cd->isLinkable()) + { + NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,cd,m_index,m_level,m_useFullName, + FALSE,TRUE,FALSE,FALSE,visitedClasses); append(nnc); m_index++; } @@ -6679,13 +6921,28 @@ class NestingContext::Private : public GenericNodeListContext addClass(cd.get(),rootOnly,visitedClasses); } } + void addConcepts(const ConceptLinkedRefMap &cpLinkedMap,bool rootOnly,ClassDefSet &visitedClasses) + { + for (const auto &cd : cpLinkedMap) + { + addConcept(cd,rootOnly,visitedClasses); + } + } + void addConcepts(const ConceptLinkedMap &cpLinkedMap,bool rootOnly,ClassDefSet &visitedClasses) + { + for (const auto &cd : cpLinkedMap) + { + addConcept(cd.get(),rootOnly,visitedClasses); + } + } void addDirs(const DirLinkedMap &dirLinkedMap,ClassDefSet &visitedClasses) { for (const auto &dd : dirLinkedMap) { if (dd->getOuterScope()==Doxygen::globalScope) { - append(NestingNodeContext::alloc(m_parent,dd.get(),m_index,m_level,FALSE,FALSE,FALSE,visitedClasses)); + append(NestingNodeContext::alloc(m_parent,dd.get(),m_index,m_level,m_useFullName, + FALSE,FALSE,FALSE,FALSE,visitedClasses)); m_index++; } } @@ -6694,7 +6951,8 @@ class NestingContext::Private : public GenericNodeListContext { for(const auto dd : dirList) { - append(NestingNodeContext::alloc(m_parent,dd,m_index,m_level,FALSE,FALSE,FALSE,visitedClasses)); + append(NestingNodeContext::alloc(m_parent,dd,m_index,m_level,m_useFullName, + FALSE,FALSE,FALSE,FALSE,visitedClasses)); m_index++; } } @@ -6706,7 +6964,8 @@ class NestingContext::Private : public GenericNodeListContext { if (fd->getDirDef()==0) // top level file { - NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,fd.get(),m_index,m_level,FALSE,FALSE,FALSE,visitedClasses); + NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,fd.get(),m_index,m_level,m_useFullName, + FALSE,FALSE,FALSE,FALSE,visitedClasses); append(nnc); m_index++; } @@ -6717,7 +6976,8 @@ class NestingContext::Private : public GenericNodeListContext { for (const auto &fd : fList) { - NestingNodeContext *nnc=NestingNodeContext::alloc(m_parent,fd,m_index,m_level,FALSE,FALSE,FALSE,visitedClasses); + NestingNodeContext *nnc=NestingNodeContext::alloc(m_parent,fd,m_index,m_level,m_useFullName, + FALSE,FALSE,FALSE,FALSE,visitedClasses); append(nnc); m_index++; } @@ -6728,7 +6988,8 @@ class NestingContext::Private : public GenericNodeListContext pd->getOuterScope()==0 || pd->getOuterScope()->definitionType()!=Definition::TypePage) { - append(NestingNodeContext::alloc(m_parent,pd,m_index,m_level,FALSE,FALSE,FALSE,visitedClasses)); + append(NestingNodeContext::alloc(m_parent,pd,m_index,m_level,m_useFullName, + FALSE,FALSE,FALSE,FALSE,visitedClasses)); m_index++; } } @@ -6755,7 +7016,8 @@ class NestingContext::Private : public GenericNodeListContext (!gd->isReference() || externalGroups) ) { - append(NestingNodeContext::alloc(m_parent,gd.get(),m_index,m_level,FALSE,FALSE,FALSE,visitedClasses)); + append(NestingNodeContext::alloc(m_parent,gd.get(),m_index,m_level,m_useFullName, + FALSE,FALSE,FALSE,FALSE,visitedClasses)); m_index++; } } @@ -6766,7 +7028,8 @@ class NestingContext::Private : public GenericNodeListContext { if (gd->isVisible()) { - append(NestingNodeContext::alloc(m_parent,gd,m_index,m_level,FALSE,FALSE,FALSE,visitedClasses)); + append(NestingNodeContext::alloc(m_parent,gd,m_index,m_level,m_useFullName, + FALSE,FALSE,FALSE,FALSE,visitedClasses)); m_index++; } } @@ -6793,7 +7056,8 @@ class NestingContext::Private : public GenericNodeListContext if (cd->isVisibleInHierarchy() && b) { - NestingNodeContext *tnc = NestingNodeContext::alloc(m_parent,cd,m_index,m_level,TRUE,TRUE,hideSuper,visitedClasses); + NestingNodeContext *tnc = NestingNodeContext::alloc(m_parent,cd,m_index,m_level,m_useFullName, + TRUE,FALSE,TRUE,hideSuper,visitedClasses); append(tnc); m_index++; } @@ -6821,7 +7085,8 @@ class NestingContext::Private : public GenericNodeListContext if (cd->isVisibleInHierarchy()) // should it be visible { // new root level class - NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,cd.get(),m_index,m_level,TRUE,TRUE,FALSE,visitedClasses); + NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,cd.get(),m_index,m_level,m_useFullName, + TRUE,FALSE,TRUE,FALSE,visitedClasses); append(nnc); m_index++; } @@ -6836,7 +7101,8 @@ class NestingContext::Private : public GenericNodeListContext { if (md->visibleInIndex()) { - NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,md,m_index,m_level+1,TRUE,TRUE,FALSE,visitedClasses); + NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,md,m_index,m_level+1,m_useFullName, + TRUE,FALSE,TRUE,FALSE,visitedClasses); append(nnc); m_index++; } @@ -6847,12 +7113,14 @@ class NestingContext::Private : public GenericNodeListContext private: const NestingNodeContext *m_parent; int m_level; - int m_index; + int m_index = 0; + bool m_useFullName; }; -NestingContext::NestingContext(const NestingNodeContext *parent,int level) : RefCountedContext("NestingContext") +NestingContext::NestingContext(const NestingNodeContext *parent,int level,bool useFullName) : + RefCountedContext("NestingContext") { - p = new Private(parent,level); + p = new Private(parent,level,useFullName); } NestingContext::~NestingContext() @@ -6886,14 +7154,24 @@ void NestingContext::addClasses(const ClassLinkedMap &clLinkedMap,bool rootOnly, p->addClasses(clLinkedMap,rootOnly,visitedClasses); } -void NestingContext::addNamespaces(const NamespaceLinkedMap &nsLinkedMap,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses) +void NestingContext::addConcepts(const ConceptLinkedRefMap &cpLinkedRefMap,bool rootOnly,ClassDefSet &visitedClasses) { - p->addNamespaces(nsLinkedMap,rootOnly,addClasses,visitedClasses); + p->addConcepts(cpLinkedRefMap,rootOnly,visitedClasses); } -void NestingContext::addNamespaces(const NamespaceLinkedRefMap &nsLinkedRefMap,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses) +void NestingContext::addConcepts(const ConceptLinkedMap &cpLinkedMap,bool rootOnly,ClassDefSet &visitedClasses) { - p->addNamespaces(nsLinkedRefMap,rootOnly,addClasses,visitedClasses); + p->addConcepts(cpLinkedMap,rootOnly,visitedClasses); +} + +void NestingContext::addNamespaces(const NamespaceLinkedMap &nsLinkedMap,bool rootOnly,bool addClasses,bool addConcepts,ClassDefSet &visitedClasses) +{ + p->addNamespaces(nsLinkedMap,rootOnly,addClasses,addConcepts,visitedClasses); +} + +void NestingContext::addNamespaces(const NamespaceLinkedRefMap &nsLinkedRefMap,bool rootOnly,bool addClasses,bool addConcepts,ClassDefSet &visitedClasses) +{ + p->addNamespaces(nsLinkedRefMap,rootOnly,addClasses,addConcepts,visitedClasses); } void NestingContext::addDirs(const DirLinkedMap &dirs,ClassDefSet &visitedClasses) @@ -6960,9 +7238,9 @@ class ClassTreeContext::Private public: Private() { - m_classTree.reset(NestingContext::alloc(0,0)); + m_classTree.reset(NestingContext::alloc(0,0,false)); ClassDefSet visitedClasses; - m_classTree->addNamespaces(*Doxygen::namespaceLinkedMap,TRUE,TRUE,visitedClasses); + m_classTree->addNamespaces(*Doxygen::namespaceLinkedMap,TRUE,TRUE,FALSE,visitedClasses); m_classTree->addClasses(*Doxygen::classLinkedMap,TRUE,visitedClasses); //%% Nesting tree static bool init=FALSE; @@ -7082,6 +7360,51 @@ StringVector ClassTreeContext::fields() const //------------------------------------------------------------------------ +//%% list ConceptList[Concept] : list of namespaces +class ConceptListContext::Private : public GenericNodeListContext +{ + public: + void addConcepts(const ConceptLinkedMap &nsLinkedMap) + { + for (const auto &cd : nsLinkedMap) + { + if (cd->isLinkableInProject()) + { + append(ConceptContext::alloc(cd.get())); + } + } + } +}; + +ConceptListContext::ConceptListContext() : RefCountedContext("ConceptListContext") +{ + p = new Private; + p->addConcepts(*Doxygen::conceptLinkedMap); +} + +ConceptListContext::~ConceptListContext() +{ + delete p; +} + +// TemplateListIntf +uint ConceptListContext::count() const +{ + return p->count(); +} + +TemplateVariant ConceptListContext::at(uint index) const +{ + return p->at(index); +} + +TemplateListIntf::ConstIterator *ConceptListContext::createIterator() const +{ + return p->createIterator(); +} + +//------------------------------------------------------------------------ + //%% list NamespaceList[Namespace] : list of namespaces class NamespaceListContext::Private : public GenericNodeListContext { @@ -7134,9 +7457,9 @@ class NamespaceTreeContext::Private public: Private() { - m_namespaceTree.reset(NestingContext::alloc(0,0)); + m_namespaceTree.reset(NestingContext::alloc(0,0,false)); ClassDefSet visitedClasses; - m_namespaceTree->addNamespaces(*Doxygen::namespaceLinkedMap,TRUE,FALSE,visitedClasses); + m_namespaceTree->addNamespaces(*Doxygen::namespaceLinkedMap,TRUE,FALSE,TRUE,visitedClasses); //%% Nesting tree static bool init=FALSE; if (!init) @@ -7410,7 +7733,7 @@ class FileTreeContext::Private Private() { // Add dirs tree - m_dirFileTree.reset(NestingContext::alloc(0,0)); + m_dirFileTree.reset(NestingContext::alloc(0,0,false)); ClassDefSet visitedClasses; m_dirFileTree->addDirs(*Doxygen::dirLinkedMap,visitedClasses); if (Doxygen::inputNameLinkedMap) @@ -7529,7 +7852,7 @@ class PageTreeContext::Private public: Private(const PageLinkedMap &pages) { - m_pageTree.reset(NestingContext::alloc(0,0)); + m_pageTree.reset(NestingContext::alloc(0,0,false)); ClassDefSet visitedClasses; // Add pages m_pageTree->addPages(pages,TRUE,visitedClasses); @@ -7773,6 +8096,124 @@ TemplateListIntf::ConstIterator *ModuleListContext::createIterator() const //------------------------------------------------------------------------ +//%% struct ConceptTree: tree of modules +//%% { +class ConceptTreeContext::Private +{ + public: + Private() + { + m_conceptTree.reset(NestingContext::alloc(0,0,false)); + ClassDefSet visitedClasses; + // Add concepts + m_conceptTree->addNamespaces(*Doxygen::namespaceLinkedMap,TRUE,FALSE,TRUE,visitedClasses); + m_conceptTree->addConcepts(*Doxygen::conceptLinkedMap,TRUE,visitedClasses); + + //%% ConceptList tree: + static bool init=FALSE; + if (!init) + { + s_inst.addProperty("tree", &Private::tree); + s_inst.addProperty("fileName", &Private::fileName); + s_inst.addProperty("relPath", &Private::relPath); + s_inst.addProperty("highlight", &Private::highlight); + s_inst.addProperty("subhighlight", &Private::subhighlight); + s_inst.addProperty("title", &Private::title); + s_inst.addProperty("preferredDepth",&Private::preferredDepth); + s_inst.addProperty("maxDepth", &Private::maxDepth); + init=TRUE; + } + } + TemplateVariant get(const QCString &n) const + { + return s_inst.get(this,n); + } + StringVector fields() const + { + return s_inst.fields(); + } + TemplateVariant tree() const + { + return m_conceptTree.get(); + } + TemplateVariant fileName() const + { + return "concepts"; + } + TemplateVariant relPath() const + { + return ""; + } + TemplateVariant highlight() const + { + return "concepts"; + } + TemplateVariant subhighlight() const + { + return ""; + } + TemplateVariant title() const + { + return theTranslator->trConcept(true,false); + } + TemplateVariant maxDepth() const + { + if (!m_cache.maxDepthComputed) + { + m_cache.maxDepth = computeMaxDepth(m_conceptTree.get()); + m_cache.maxDepthComputed=TRUE; + } + return m_cache.maxDepth; + } + TemplateVariant preferredDepth() const + { + if (!m_cache.preferredDepthComputed) + { + m_cache.preferredDepth = computePreferredDepth(m_conceptTree.get(),maxDepth().toInt()); + m_cache.preferredDepthComputed=TRUE; + } + return m_cache.preferredDepth; + } + private: + SharedPtr m_conceptTree; + struct Cachable + { + Cachable() : maxDepth(0), maxDepthComputed(FALSE), + preferredDepth(0), preferredDepthComputed(FALSE) {} + int maxDepth; + bool maxDepthComputed; + int preferredDepth; + bool preferredDepthComputed; + }; + mutable Cachable m_cache; + static PropertyMapper s_inst; +}; +//%% } + +PropertyMapper ConceptTreeContext::Private::s_inst; + +ConceptTreeContext::ConceptTreeContext() : RefCountedContext("ConceptTreeContext") +{ + p = new Private; +} + +ConceptTreeContext::~ConceptTreeContext() +{ + delete p; +} + +TemplateVariant ConceptTreeContext::get(const QCString &name) const +{ + return p->get(name); +} + +StringVector ConceptTreeContext::fields() const +{ + return p->fields(); +} + +//------------------------------------------------------------------------ + //%% struct ModuleTree: tree of modules //%% { class ModuleTreeContext::Private @@ -7780,7 +8221,7 @@ class ModuleTreeContext::Private public: Private() { - m_moduleTree.reset(NestingContext::alloc(0,0)); + m_moduleTree.reset(NestingContext::alloc(0,0,true)); ClassDefSet visitedClasses; // Add modules m_moduleTree->addModules(*Doxygen::groupLinkedMap,visitedClasses); @@ -8000,7 +8441,7 @@ class ExampleTreeContext::Private public: Private() { - m_exampleTree.reset(NestingContext::alloc(0,0)); + m_exampleTree.reset(NestingContext::alloc(0,0,false)); ClassDefSet visitedClasses; // Add pages m_exampleTree->addPages(*Doxygen::exampleLinkedMap,TRUE,visitedClasses); @@ -10471,6 +10912,8 @@ void generateOutputViaTemplate() SharedPtr classIndex (ClassIndexContext::alloc()); SharedPtr classTree (ClassTreeContext::alloc()); SharedPtr classHierarchy (ClassHierarchyContext::alloc()); + SharedPtr conceptList (ConceptListContext::alloc()); + SharedPtr conceptTree (ConceptTreeContext::alloc()); SharedPtr namespaceList (NamespaceListContext::alloc()); SharedPtr namespaceTree (NamespaceTreeContext::alloc()); SharedPtr dirList (DirListContext::alloc()); @@ -10501,6 +10944,10 @@ void generateOutputViaTemplate() ctx->set("classIndex",classIndex.get()); //%% ClassHierarchy classHierarchy: ctx->set("classHierarchy",classHierarchy.get()); + //%% ConceptList conceptList: + ctx->set("conceptList",conceptList.get()); + //%% ConceptTree conceptTree: + ctx->set("conceptTree",conceptTree.get()); //%% NamespaceList namespaceList: ctx->set("namespaceList",namespaceList.get()); //%% NamespaceTree namespaceTree: @@ -10532,7 +10979,7 @@ void generateOutputViaTemplate() else { // TODO: for LaTeX output index should be main... => solve in template - Doxygen::mainPage.reset(createPageDef("[generated]",1,"index","",theTranslator->trMainPage())); + Doxygen::mainPage.reset(createPageDef("[generated]",1,"index","",Config_getString(PROJECT_NAME))); Doxygen::mainPage->setFileName("index"); SharedPtr mainPage(PageContext::alloc(Doxygen::mainPage.get(),TRUE,FALSE)); ctx->set("mainPage",mainPage.get()); diff --git a/src/context.h b/src/context.h index bff4903..67333b9 100644 --- a/src/context.h +++ b/src/context.h @@ -18,10 +18,8 @@ #include "types.h" #include "template.h" -#include #include "classdef.h" #include "searchindex.h" -#include "membergroup.h" class Definition; @@ -33,6 +31,10 @@ class GroupDef; class GroupLinkedMap; class GroupList; +class ConceptDef; +class ConceptLinkedMap; +class ConceptLinkedRefMap; + class NamespaceDef; class NamespaceLinkedMap; class NamespaceLinkedRefMap; @@ -59,6 +61,10 @@ class MemberInfo; class DotNode; class DotGfxHierarchyTable; +class MemberGroup; +class MemberGroupList; +class MemberGroupRefList; + //---------------------------------------------------- #define DEBUG_REF 0 @@ -253,7 +259,6 @@ class IncludeInfoListContext : public RefCountedContext, public TemplateListIntf Private *p; }; - //---------------------------------------------------- class ClassContext : public RefCountedContext, public TemplateStructIntf @@ -274,6 +279,27 @@ class ClassContext : public RefCountedContext, public TemplateStructIntf Private *p; }; + +//---------------------------------------------------- + +class ConceptContext : public RefCountedContext, public TemplateStructIntf +{ + public: + static ConceptContext *alloc(const ConceptDef *cd) { return new ConceptContext(cd); } + + // TemplateStructIntf methods + virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } + + private: + ConceptContext(const ConceptDef *); + ~ConceptContext(); + class Private; + Private *p; +}; + //---------------------------------------------------- class NamespaceContext : public RefCountedContext, public TemplateStructIntf @@ -527,9 +553,12 @@ class NestingNodeContext : public RefCountedContext, public TemplateStructIntf { public: static NestingNodeContext *alloc(const NestingNodeContext *parent,const Definition *def, - int index,int level,bool addClasses,bool inherit,bool hideSuper, + int index,int level, + bool useFullName, bool addClasses,bool addConcepts, + bool inherit,bool hideSuper, ClassDefSet &visitedClasses) - { return new NestingNodeContext(parent,def,index,level,addClasses,inherit,hideSuper,visitedClasses); } + { return new NestingNodeContext(parent,def,index,level,useFullName,addClasses,addConcepts, + inherit,hideSuper,visitedClasses); } QCString id() const; @@ -541,7 +570,9 @@ class NestingNodeContext : public RefCountedContext, public TemplateStructIntf private: NestingNodeContext(const NestingNodeContext *parent, - const Definition *,int index,int level,bool addClasses,bool inherit,bool hideSuper, + const Definition *,int index,int level, + bool useFullName, bool addClasses,bool addConcepts, + bool inherit,bool hideSuper, ClassDefSet &visitedClasses); ~NestingNodeContext(); class Private; @@ -554,8 +585,8 @@ class NestingContext : public RefCountedContext, public TemplateListIntf { public: - static NestingContext *alloc(const NestingNodeContext *parent,int level) - { return new NestingContext(parent,level); } + static NestingContext *alloc(const NestingNodeContext *parent,int level,bool useFullName) + { return new NestingContext(parent,level,useFullName); } // TemplateListIntf virtual uint count() const; @@ -564,10 +595,12 @@ class NestingContext : public RefCountedContext, public TemplateListIntf virtual int addRef() { return RefCountedContext::addRef(); } virtual int release() { return RefCountedContext::release(); } - void addNamespaces(const NamespaceLinkedMap &nsLinkedMap,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses); - void addNamespaces(const NamespaceLinkedRefMap &nsLinkedMap,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses); + void addNamespaces(const NamespaceLinkedMap &nsLinkedMap,bool rootOnly,bool addClasses,bool addConcepts,ClassDefSet &visitedClasses); + void addNamespaces(const NamespaceLinkedRefMap &nsLinkedMap,bool rootOnly,bool addClasses,bool addConcepts,ClassDefSet &visitedClasses); void addClasses(const ClassLinkedMap &clLinkedMap,bool rootOnly,ClassDefSet &visitedClasses); void addClasses(const ClassLinkedRefMap &clLinkedMap,bool rootOnly,ClassDefSet &visitedClasses); + void addConcepts(const ConceptLinkedMap &cnLinkedMap,bool rootOnly,ClassDefSet &visitedClasses); + void addConcepts(const ConceptLinkedRefMap &cnLinkedMap,bool rootOnly,ClassDefSet &visitedClasses); void addDirs(const DirLinkedMap &,ClassDefSet &visitedClasses); void addDirs(const DirList &,ClassDefSet &visitedClasses); void addFiles(const FileNameLinkedMap &,ClassDefSet &visitedClasses); @@ -581,7 +614,7 @@ class NestingContext : public RefCountedContext, public TemplateListIntf void addMembers(const MemberList *ml,ClassDefSet &visitedClasses); private: - NestingContext(const NestingNodeContext *parent,int level); + NestingContext(const NestingNodeContext *parent,int level,bool useFullName); ~NestingContext(); class Private; Private *p; @@ -609,6 +642,27 @@ class ClassTreeContext : public RefCountedContext, public TemplateStructIntf //---------------------------------------------------- +class ConceptListContext : public RefCountedContext, public TemplateListIntf +{ + public: + static ConceptListContext *alloc() { return new ConceptListContext; } + + // TemplateListIntf + virtual uint count() const; + virtual TemplateVariant at(uint index) const; + virtual TemplateListIntf::ConstIterator *createIterator() const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } + + private: + ConceptListContext(); + ~ConceptListContext(); + class Private; + Private *p; +}; + +//---------------------------------------------------- + class NamespaceListContext : public RefCountedContext, public TemplateListIntf { public: @@ -799,6 +853,26 @@ class ModuleListContext : public RefCountedContext, public TemplateListIntf //---------------------------------------------------- +class ConceptTreeContext : public RefCountedContext, public TemplateStructIntf +{ + public: + static ConceptTreeContext *alloc() { return new ConceptTreeContext(); } + + // TemplateStructIntf methods + virtual TemplateVariant get(const QCString &name) const; + virtual StringVector fields() const; + virtual int addRef() { return RefCountedContext::addRef(); } + virtual int release() { return RefCountedContext::release(); } + + private: + ConceptTreeContext(); + ~ConceptTreeContext(); + class Private; + Private *p; +}; + +//---------------------------------------------------- + class ModuleTreeContext : public RefCountedContext, public TemplateStructIntf { public: diff --git a/src/definition.cpp b/src/definition.cpp index a03a676..a825cec 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -1,17 +1,3 @@ -/****************************************************************************** - * - * Copyright (C) 1997-2021 by Dimitri van Heesch. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software - * for any purpose. It is provided "as is" without express or implied warranty. - * See the GNU General Public License for more details. - * - * Documents produced by Doxygen are derivative works derived from the - * input used in their production; they are not affected by this license. - * - */ #include #include diff --git a/src/doxygen.cpp b/src/doxygen.cpp index a54be26..9e434f2 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -1237,11 +1237,11 @@ static void addConceptToContext(const Entry *root) cd->setLanguage(root->lang); cd->setId(root->id); cd->setHidden(root->hidden); - cd->setInitializer(root->initializer.str().c_str()); if (tArgList) { cd->setTemplateArguments(*tArgList); } + cd->setInitializer(root->initializer.str().c_str()); // file definition containing the class cd cd->setBodySegment(root->startLine,root->bodyLine,root->endBodyLine); cd->setBodyDef(fd); diff --git a/src/index.cpp b/src/index.cpp index de50cc5..b49ee0d 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -3747,8 +3747,7 @@ static void writeGroupTreeNode(OutputList &ol, const GroupDef *gd, int level, FT /* Some groups should appear twice under different parent-groups. * That is why we should not check if it was visited */ - if (/*!gd->visited &&*/ (!gd->isASubGroup() || level>0) && - gd->isVisible() && + if ((!gd->isASubGroup() || level>0) && gd->isVisible() && (!gd->isReference() || Config_getBool(EXTERNAL_GROUPS)) // hide external groups by default ) { diff --git a/src/template.cpp b/src/template.cpp index e1d9c79..7b29251 100755 --- a/src/template.cpp +++ b/src/template.cpp @@ -676,6 +676,46 @@ class FilterRaw //----------------------------------------------------------------------------- +/** @brief The implementation of the "keep" filter */ +class FilterKeep +{ + public: + static TemplateVariant apply(const TemplateVariant &v,const TemplateVariant &args) + { + if (v.isValid() && v.type()==TemplateVariant::List && args.type()==TemplateVariant::String) + { + //printf("FilterKeep::apply: v=%s args=%s\n",qPrint(v.toString()),qPrint(args.toString())); + TemplateListIntf::ConstIterator *it = v.toList()->createIterator(); + + TemplateList *result = TemplateList::alloc(); + TemplateVariant item; + for (it->toFirst();(it->current(item));it->toNext()) + { + //printf("item type=%s\n",item.typeAsString()); + TemplateStructIntf *s = item.toStruct(); + if (s) + { + TemplateVariant value = s->get(args.toString()); + //printf("value type=%s\n",value.typeAsString()); + if (value.toBool()) + { + //printf("keeping it\n"); + result->append(item); + } + else + { + //printf("Dropping it\n"); + } + } + } + return result; + } + return v; + } +}; + +//----------------------------------------------------------------------------- + /** @brief The implementation of the "list" filter */ class FilterList { @@ -1438,6 +1478,7 @@ static TemplateFilterFactory::AutoRegister fAdd("add") static TemplateFilterFactory::AutoRegister fGet("get"); static TemplateFilterFactory::AutoRegister fHex("hex"); static TemplateFilterFactory::AutoRegister fRaw("raw"); +static TemplateFilterFactory::AutoRegister fKeep("keep"); static TemplateFilterFactory::AutoRegister fList("list"); static TemplateFilterFactory::AutoRegister fLower("lower"); static TemplateFilterFactory::AutoRegister fUpper("upper"); diff --git a/src/template.h b/src/template.h index 7d803a3..7ad2066 100644 --- a/src/template.h +++ b/src/template.h @@ -143,7 +143,7 @@ class TemplateVariant Type type() const { return m_type; } /** Return a string representation of the type of the value stored in the variant */ - QCString typeAsString() const + const char *typeAsString() const { switch (m_type) { diff --git a/templates/html/htmlannotated.tpl b/templates/html/htmlannotated.tpl index e3b8442..9c45157 100644 --- a/templates/html/htmlannotated.tpl +++ b/templates/html/htmlannotated.tpl @@ -4,7 +4,7 @@
{{ tr.classListDescription }}
-{% indexentry nav name=tr.classList file=page.fileName anchor='' isReference=False separateIndex=True %} +{% indexentry nav name=tr.classList file=page.fileName anchor='' isReference=False separateIndex=True addToIndex=True %} {% opensubindex nav %} {% with tree=classTree %} {% include 'htmldirtree.tpl' %} diff --git a/templates/html/htmlbase.tpl b/templates/html/htmlbase.tpl index 39bfa8a..4b1b369 100644 --- a/templates/html/htmlbase.tpl +++ b/templates/html/htmlbase.tpl @@ -186,9 +186,6 @@ $(function() { {% endblock %} -{% block navpath %} -{% endblock %} - {% block splitbar %} {% if config.GENERATE_TREEVIEW %} {% if not config.DISABLE_INDEX or not config.FULL_SIDEBAR %} @@ -229,10 +226,15 @@ $(document).ready(function(){initNavTree('{{ page.fileName }}{% if page_postfix {% endif %} {% endblock %} +{% block navpath %} +{% endblock %} +
{% block title %} -
-
{{ page.title }}
+{% if page.title %} +
+
{{ page.title }}
+{% endif %} {% endblock %}
diff --git a/templates/html/htmlclasses.tpl b/templates/html/htmlclasses.tpl index 3e556a2..ceb1b06 100644 --- a/templates/html/htmlclasses.tpl +++ b/templates/html/htmlclasses.tpl @@ -11,7 +11,7 @@ {% endif %} {% endfor %} - {% indexentry nav name=tr.classIndex file=page.fileName anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.classIndex file=page.fileName anchor='' isReference=False separateIndex=False addToIndex=True %} {# multi column index #}
{% for section in index %} diff --git a/templates/html/htmlconcept.tpl b/templates/html/htmlconcept.tpl new file mode 100644 index 0000000..a57262f --- /dev/null +++ b/templates/html/htmlconcept.tpl @@ -0,0 +1,65 @@ +{% extend 'htmlbase.tpl' %} +{% msg %}Generating HTML output for concept {{ compound.name }}{% endmsg %} + +{% block navpath %} +{% if not config.GENERATE_TREEVIEW %} + {% with navpath=compound.navigationPath %} + {% include 'htmlnavpath.tpl' %} + {% endwith %} +{% endif %} +{% endblock %} + +{% block title %} + {{ block.super }} +{% endblock %} + +{% block content %} +
+{# brief description #} + {% if compound.brief %} +

{{ compound.brief }} + {% if compound.hasDetails %} + {{ tr.more }} + {% endif %} +

+ {% endif %} +{# includes #} + {% if compound.includeInfo %} +

+ {% with ii=compound.includeInfo %} + {% include 'htmlinclude.tpl' %} + {% endwith %} +

+ {% endif %} +{# concept definition #} +

{{ tr.conceptDefinition }}

+
{{ compound.initializerAsCode }}
+{# detailed description #} +{% if compound.hasDetails %} + {% if compound.anchor %} + + {% else %} + + {% endif %} +

{{ tr.detailedDesc }}

+
+ {# brief description #} + {% if compound.brief and config.REPEAT_BRIEF %} +

+ {{ compound.brief }} +

+ {% endif %} + {{ compound.details }} +
+ {# source definition #} + {% if compound.sourceDef %} + {% markers obj in compound.sourceDef with tr.definedAtLineInSourceFile %} + {% with text=obj.text %} + {% include 'htmlobjlink.tpl' %} + {% endwith %} + {% endmarkers %} + {% endif %} +{% endif %} +
+{% endblock %} + diff --git a/templates/html/htmlconcepts.tpl b/templates/html/htmlconcepts.tpl new file mode 100644 index 0000000..7723a46 --- /dev/null +++ b/templates/html/htmlconcepts.tpl @@ -0,0 +1,15 @@ +{% extend 'htmlbase.tpl' %} +{% block content %} +
+
+{{ tr.conceptListDescription }} +
+{% indexentry nav name=tr.concepts file=page.fileName anchor='' isReference=False separateIndex=True addToIndex=True %} +{% opensubindex nav %} +{% with tree=conceptTree %} + {% include 'htmldirtree.tpl' %} +{% endwith %} +{% closesubindex nav %} +
+{% endblock %} + diff --git a/templates/html/htmldirtree.tpl b/templates/html/htmldirtree.tpl index f1b4fcf..c1cbd12 100644 --- a/templates/html/htmldirtree.tpl +++ b/templates/html/htmldirtree.tpl @@ -12,9 +12,9 @@ {% recursetree tree.tree %} {% if node.isLinkable %} - {% indexentry nav name=node.name file=node.fileName anchor=node.anchor isReference=node.isReference externalReference=node.externalReference separateIndex=True %} + {% indexentry nav name=node.name file=node.fileName anchor=node.anchor isReference=node.isReference externalReference=node.externalReference separateIndex=node.is_leaf_node==False addToIndex=node.partOfGroup==False %} {% else %} - {% indexentry nav name=node.name file='' anchor=node.anchor isReference=False separateIndex=False %} + {% indexentry nav name=node.name file='' anchor=node.anchor isReference=False separateIndex=False addToIndex=False %} {% endif %} {% if not node.member %} {% spaceless %} @@ -56,7 +56,7 @@ {% if node.members %} {% opensubindex nav %} {% for member in node.members %} - {% indexentry nav name=member.name file=member.fileName anchor=member.anchor isReference=member.isReference externalReference=member.externalReference separateIndex=False %} + {% indexentry nav name=member.name file=member.fileName anchor=member.anchor isReference=member.isReference externalReference=member.externalReference separateIndex=False addToIndex=member.partOfGroup==False %} {% endfor %} {% closesubindex nav %} {% endif %} diff --git a/templates/html/htmlexamples.tpl b/templates/html/htmlexamples.tpl index 18384e2..3fe7781 100644 --- a/templates/html/htmlexamples.tpl +++ b/templates/html/htmlexamples.tpl @@ -4,7 +4,7 @@
{{ tr.examplesDescription }}
-{% indexentry nav name=tr.examples file=page.fileName anchor='' isReference=False separateIndex=False %} +{% indexentry nav name=tr.examples file=page.fileName anchor='' isReference=False separateIndex=False addToIndex=True %} {% opensubindex nav %} {% with tree=exampleTree %} {% include 'htmldirtree.tpl' %} diff --git a/templates/html/htmlfiles.tpl b/templates/html/htmlfiles.tpl index 1c784dc..dca75d5 100644 --- a/templates/html/htmlfiles.tpl +++ b/templates/html/htmlfiles.tpl @@ -4,7 +4,7 @@
{{ tr.fileListDescription }}
-{% indexentry nav name=tr.fileList file=page.fileName anchor='' isReference=False separateIndex=True %} +{% indexentry nav name=tr.fileList file=page.fileName anchor='' isReference=False separateIndex=True addToIndex=True %} {% opensubindex nav %} {% with tree=fileTree %} {% include 'htmldirtree.tpl' %} diff --git a/templates/html/htmlhierarchy.tpl b/templates/html/htmlhierarchy.tpl index df01709..9a121ee 100644 --- a/templates/html/htmlhierarchy.tpl +++ b/templates/html/htmlhierarchy.tpl @@ -7,7 +7,7 @@

{{ tr.gotoGraphicalHierarchy }}

{% endif %} -{% indexentry nav name=tr.classHierarchy file=page.fileName anchor='' isReference=False separateIndex=True %} +{% indexentry nav name=tr.classHierarchy file=page.fileName anchor='' isReference=False separateIndex=True addToIndex=True %} {% opensubindex nav %} {% with tree=classHierarchy %} {% include 'htmldirtree.tpl' %} diff --git a/templates/html/htmlindexpages.tpl b/templates/html/htmlindexpages.tpl index eacf122..ba59b2f 100644 --- a/templates/html/htmlindexpages.tpl +++ b/templates/html/htmlindexpages.tpl @@ -9,7 +9,7 @@ {% for sect in index %} {% with letter=sect.letter %} {% set page_postfix=section|append:'_'|append:sect.label %} - {% indexentry nav name=letter file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=letter file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False addToIndex=True %} {# create index pages for all globals starting with a specific letter #} {% create page.fileName|append:page_postfix|append:config.HTML_FILE_EXTENSION from template %} {% endwith %} diff --git a/templates/html/htmljsmenudata.tpl b/templates/html/htmljsmenudata.tpl index 2d0a53e..879bccf 100644 --- a/templates/html/htmljsmenudata.tpl +++ b/templates/html/htmljsmenudata.tpl @@ -30,6 +30,9 @@ var menudata={children:[ {% if moduleTree.tree %} ,{text:"{{ tr.modules }}",url:"modules{{ config.HTML_FILE_EXTENSION }}"} {% endif %} +{% if conceptList %} +,{text:"{{ tr.concepts }}",url:"concepts{{ config.HTML_FILE_EXTENSION }}"} +{% endif %} {% if namespaceList %} ,{text:"{{ tr.namespaces }}",url:'namespaces{{ config.HTML_FILE_EXTENSION }}",children:[ {text:"{{ tr.namespaceList }}",url:'namespaces{{ config.HTML_FILE_EXTENSION }}"} diff --git a/templates/html/htmljsnavtree.tpl b/templates/html/htmljsnavtree.tpl index fef1819..30cfb2a 100644 --- a/templates/html/htmljsnavtree.tpl +++ b/templates/html/htmljsnavtree.tpl @@ -45,7 +45,7 @@ var NAVTREE = var NAVTREEINDEX = [ -{% with navlist=index.nav|flatten|listsort:config.HTML_FILE_EXTENSION|prepend:'{{file}}'|append:'#{{anchor}}' navpages=navlist|paginate:250 %} +{% with navlist=index.nav|flatten|keep:'addToIndex'|listsort:config.HTML_FILE_EXTENSION|prepend:'{{file}}'|append:'#{{anchor}}' navpages=navlist|paginate:250 %} {% for page in navpages %} "{{ page.0.file }}{{ config.HTML_FILE_EXTENSION }}{% if page.0.anchor %}#{{ page.0.anchor }}{% endif %}"{% if not forloop.last %},{%endif %} {% with idx=forloop.counter0 entries=page %} diff --git a/templates/html/htmllayout.tpl b/templates/html/htmllayout.tpl index f96de7e..02d4056 100644 --- a/templates/html/htmllayout.tpl +++ b/templates/html/htmllayout.tpl @@ -90,9 +90,9 @@ {# open the global navigation index #} {% if config.PROJECT_NAME %} - {% indexentry nav name=config.PROJECT_NAME file='index' anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=config.PROJECT_NAME file='index' anchor='' isReference=False separateIndex=False addToIndex=True %} {% else %} - {% indexentry nav name=tr.mainPage file='index' anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.mainPage file='index' anchor='' isReference=False separateIndex=False addToIndex=True %} {% endif %} {% opensubindex nav %} @@ -110,6 +110,13 @@ {% endwith %} {% endfor %} +{# write concept documentation pages #} +{% for compound in conceptList %} + {% with page=compound %} + {% create compound.fileName|append:config.HTML_FILE_EXTENSION from 'htmlconcept.tpl' %} + {% endwith %} +{% endfor %} + {# write class documentation pages #} {% for compound in classList %} {% with page=compound %} @@ -183,7 +190,7 @@ {# --- namespaces --- #} {% if namespaceList %} - {% indexentry nav name=tr.namespaces file='namespaces' anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.namespaces file='namespaces' anchor='' isReference=False separateIndex=False addToIndex=True %} {% opensubindex nav %} {% if namespaceTree.tree %} @@ -195,7 +202,7 @@ {# write symbol indices for namespace members #} {% if namespaceMembersIndex.all %} {% with page=namespaceMembersIndex scope='namespace' template='htmlnsmembers.tpl' %} - {% indexentry nav name=tr.namespaceMembers file=page.fileName anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.namespaceMembers file=page.fileName anchor='' isReference=False separateIndex=False addToIndex=True %} {% include 'htmlmembersindex.tpl' %} {% endwith %} {% endif %} @@ -203,9 +210,16 @@ {% closesubindex nav %} {% endif %} +{# --- concepts --- #} +{% if conceptTree.tree %} + {% with page=conceptTree %} + {% create conceptTree.fileName|append:config.HTML_FILE_EXTENSION from 'htmlconcepts.tpl' %} + {% endwith %} +{% endif %} + {# --- classes --- #} {% if classList %} - {% indexentry nav name=tr.classes file='annotated'|append:config.HTML_FILE_EXTENSION anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.classes file='annotated'|append:config.HTML_FILE_EXTENSION anchor='' isReference=False separateIndex=False addToIndex=False %} {% opensubindex nav %} {# write the annotated class list #} @@ -237,7 +251,7 @@ {# write symbol indices for class members #} {% if classMembersIndex.all %} {% with page=classMembersIndex scope='class' template='htmlclmembers.tpl' %} - {% indexentry nav name=tr.classMembers file=page.fileName anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.classMembers file=page.fileName anchor='' isReference=False separateIndex=False addToIndex=True %} {% include 'htmlmembersindex.tpl' %} {% endwith %} {% endif %} @@ -247,7 +261,7 @@ {# --- files --- #} {% if fileList %} - {% indexentry nav name=tr.files file='files' anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.files file='files' anchor='' isReference=False separateIndex=False addToIndex=False addToIndex=False %} {% opensubindex nav %} {# write the directory/file hierarchy #} @@ -260,7 +274,7 @@ {# write symbol indices for global namespace #} {% if globalsIndex.all %} {% with page=globalsIndex scope='file' template='htmlflmembers.tpl' %} - {% indexentry nav name=tr.fileMembers file=page.fileName anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.fileMembers file=page.fileName anchor='' isReference=False separateIndex=False addToIndex=True %} {% include 'htmlmembersindex.tpl' %} {% endwith %} {% endif %} diff --git a/templates/html/htmlmembersindex.tpl b/templates/html/htmlmembersindex.tpl index 46a3cfd..18f1134 100644 --- a/templates/html/htmlmembersindex.tpl +++ b/templates/html/htmlmembersindex.tpl @@ -2,13 +2,13 @@ {% opensubindex nav %} {# all members #} {% with list=page.all section='' %} - {% indexentry nav name=tr.all file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.all file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False addToIndex=True %} {% include 'htmlindexpages.tpl' %} {% endwith %} {# functions #} {% if page.functions %} {% set page_postfix='_func' %} - {% indexentry nav name=tr.functions file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.functions file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False addToIndex=True %} {% with list=page.functions section=page_postfix %} {% include 'htmlindexpages.tpl' %} {% endwith %} @@ -16,7 +16,7 @@ {# variables #} {% if page.variables %} {% set page_postfix='_vars' %} - {% indexentry nav name=tr.variables file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.variables file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False addToIndex=True %} {% with list=page.variables section=page_postfix %} {% include 'htmlindexpages.tpl' %} {% endwith %} @@ -24,7 +24,7 @@ {# typedefs #} {% if page.typedefs %} {% set page_postfix='_type' %} - {% indexentry nav name=tr.typedefs file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.typedefs file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False addToIndex=True %} {% with list=page.typedefs section=page_postfix %} {% include 'htmlindexpages.tpl' %} {% endwith %} @@ -32,7 +32,7 @@ {# enums #} {% if page.enums %} {% set page_postfix='_enum' %} - {% indexentry nav name=tr.enums file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.enums file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False addToIndex=True %} {% with list=page.enums section=page_postfix %} {% include 'htmlindexpages.tpl' %} {% endwith %} @@ -40,7 +40,7 @@ {# enumValues #} {% if page.enumValues %} {% set page_postfix='_eval' %} - {% indexentry nav name=tr.enumValues file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.enumValues file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False addToIndex=True %} {% with list=page.enumValues section=page_postfix %} {% include 'htmlindexpages.tpl' %} {% endwith %} @@ -48,7 +48,7 @@ {# macros #} {% if page.macros %} {% set page_postfix='_defs' %} - {% indexentry nav name=tr.macros file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.macros file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False addToIndex=True %} {% with list=page.macros section=page_postfix %} {% include 'htmlindexpages.tpl' %} {% endwith %} @@ -56,7 +56,7 @@ {# properties #} {% if page.properties %} {% set page_postfix='_prop' %} - {% indexentry nav name=tr.properties file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.properties file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False addToIndex=True %} {% with list=page.properties section=page_postfix %} {% include 'htmlindexpages.tpl' %} {% endwith %} @@ -64,7 +64,7 @@ {# events #} {% if page.events %} {% set page_postfix='_evnt' %} - {% indexentry nav name=tr.events file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.events file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False addToIndex=True %} {% with list=page.events section=page_postfix %} {% include 'htmlindexpages.tpl' %} {% endwith %} @@ -72,7 +72,7 @@ {# related #} {% if page.related %} {% set page_postfix='_rela' %} - {% indexentry nav name=tr.related file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False %} + {% indexentry nav name=tr.related file=page.fileName|append:page_postfix anchor='' isReference=False separateIndex=False addToIndex=True %} {% with list=page.related section=page_postfix %} {% include 'htmlindexpages.tpl' %} {% endwith %} diff --git a/templates/html/htmlmodules.tpl b/templates/html/htmlmodules.tpl index c4e84fd..2f211f3 100644 --- a/templates/html/htmlmodules.tpl +++ b/templates/html/htmlmodules.tpl @@ -4,7 +4,7 @@
{{ tr.modulesDescription }}
-{% indexentry nav name=tr.modules file=page.fileName anchor='' isReference=False separateIndex=False %} +{% indexentry nav name=tr.modules file=page.fileName anchor='' isReference=False separateIndex=True addToIndex=True %} {% opensubindex nav %} {% with tree=moduleTree %} {% include 'htmldirtree.tpl' %} diff --git a/templates/html/htmlnamespaces.tpl b/templates/html/htmlnamespaces.tpl index c3b8b3b..b54c44c 100644 --- a/templates/html/htmlnamespaces.tpl +++ b/templates/html/htmlnamespaces.tpl @@ -4,7 +4,7 @@
{{ tr.namespaceListDescription }}
-{% indexentry nav name=tr.namespaceList file=page.fileName anchor='' isReference=False separateIndex=False %} +{% indexentry nav name=tr.namespaceList file=page.fileName anchor='' isReference=False separateIndex=True addToIndex=True %} {% opensubindex nav %} {% with tree=namespaceTree %} {% include 'htmldirtree.tpl' %} diff --git a/templates/html/htmlpages.tpl b/templates/html/htmlpages.tpl index 0f12603..0c4c2fb 100644 --- a/templates/html/htmlpages.tpl +++ b/templates/html/htmlpages.tpl @@ -4,7 +4,7 @@
{{ tr.relatedPagesDesc }}
-{% indexentry nav name=tr.pages file=page.fileName anchor='' isReference=False separateIndex=False %} +{% indexentry nav name=tr.pages file=page.fileName anchor='' isReference=False separateIndex=False addToIndex=True %} {% opensubindex nav %} {% with tree=pageTree %} {% include 'htmldirtree.tpl' %} diff --git a/templates/html/htmltabs.tpl b/templates/html/htmltabs.tpl index 7ade5f1..36a65dc 100644 --- a/templates/html/htmltabs.tpl +++ b/templates/html/htmltabs.tpl @@ -15,6 +15,10 @@ {% if namespaceList %} {{ tr.namespaces|nowrap }} {% endif %} + {# concepts tab #} + {% if conceptList %} + {{ tr.concepts|nowrap }} + {% endif %} {# classes tab #} {% if classList %} {{ tr.classes|nowrap }} -- cgit v0.12