diff options
Diffstat (limited to 'src/context.cpp')
-rw-r--r-- | src/context.cpp | 1468 |
1 files changed, 656 insertions, 812 deletions
diff --git a/src/context.cpp b/src/context.cpp index 5ee89cd..7f3a33e 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -180,14 +180,14 @@ class GenericNodeListContext : public TemplateListIntf } // TemplateListIntf methods - int count() const + uint count() const { - return (int)m_children.count(); + return m_children.count(); } - TemplateVariant at(int index) const + TemplateVariant at(uint index) const { TemplateVariant result; - if (index>=0 && index<count()) + if (index<count()) { result = *m_children.at(index); } @@ -298,18 +298,16 @@ class ConfigContext::Private public: Private() { m_cachedLists.setAutoDelete(TRUE); } virtual ~Private() { } - TemplateVariant fetchList(const QCString &name,const QStrList *list) + TemplateVariant fetchList(const QCString &name,const StringVector &list) { TemplateVariant *v = m_cachedLists.find(name); if (v==0) { TemplateList *tlist = TemplateList::alloc(); m_cachedLists.insert(name,new TemplateVariant(tlist)); - QStrListIterator li(*list); - char *s; - for (li.toFirst();(s=li.current());++li) + for (const auto &s : list) { - tlist->append(s); + tlist->append(s.c_str()); } return tlist; } @@ -345,23 +343,23 @@ TemplateVariant ConfigContext::get(const char *name) const { case ConfigValues::Info::Bool: { - bool b = ConfigValues::instance().*((ConfigValues::InfoBool*)option)->item; + bool b = ConfigValues::instance().*(option->value.b); return TemplateVariant(b); } case ConfigValues::Info::Int: { - int i = ConfigValues::instance().*((ConfigValues::InfoInt*)option)->item; + int i = ConfigValues::instance().*(option->value.i); return TemplateVariant(i); } case ConfigValues::Info::String: { - QCString s = ConfigValues::instance().*((ConfigValues::InfoString*)option)->item; + QCString s = ConfigValues::instance().*(option->value.s); return TemplateVariant(s); } case ConfigValues::Info::List: { - const QStrList &l = ConfigValues::instance().*((ConfigValues::InfoList*)option)->item; - return p->fetchList(name,&l); + const StringVector &l = ConfigValues::instance().*(option->value.l); + return p->fetchList(name,l); } default: break; @@ -380,7 +378,7 @@ class DoxygenContext::Private public: TemplateVariant version() const { - return getVersion(); + return getDoxygenVersion(); } TemplateVariant date() const { @@ -445,147 +443,147 @@ class TranslateContext::Private { public: - TemplateVariant handleGeneratedAt(const QValueList<TemplateVariant> &args) const + TemplateVariant handleGeneratedAt(const std::vector<TemplateVariant> &args) const { - if (args.count()==2) + if (args.size()==2) { return theTranslator->trGeneratedAt(args[0].toString(),args[1].toString()); } else { - err("tr.generateAt should take two arguments, got %d!\n",args.count()); + err("tr.generateAt should take two arguments, got %zu!\n",args.size()); } return TemplateVariant(); } - TemplateVariant handleInheritanceDiagramFor(const QValueList<TemplateVariant> &args) const + TemplateVariant handleInheritanceDiagramFor(const std::vector<TemplateVariant> &args) const { - if (args.count()==1) + if (args.size()==1) { return theTranslator->trClassDiagram(args[0].toString()); } else { - err("tr.inheritanceDiagramFor should take one argument, got %d!\n",args.count()); + err("tr.inheritanceDiagramFor should take one argument, got %zu!\n",args.size()); } return TemplateVariant(); } - TemplateVariant handleCollaborationDiagramFor(const QValueList<TemplateVariant> &args) const + TemplateVariant handleCollaborationDiagramFor(const std::vector<TemplateVariant> &args) const { - if (args.count()==1) + if (args.size()==1) { return theTranslator->trCollaborationDiagram(args[0].toString()); } else { - err("tr.collaborationDiagramFor should take one argument, got %d!\n",args.count()); + err("tr.collaborationDiagramFor should take one argument, got %zu!\n",args.size()); } return TemplateVariant(); } - TemplateVariant handleDirDependencyGraphFor(const QValueList<TemplateVariant> &args) const + TemplateVariant handleDirDependencyGraphFor(const std::vector<TemplateVariant> &args) const { - if (args.count()==1) + if (args.size()==1) { return theTranslator->trDirDepGraph(args[0].toString()); } else { - err("tr.dirDependencyGraphFor should take one argument, got %d!\n",args.count()); + err("tr.dirDependencyGraphFor should take one argument, got %zu!\n",args.size()); } return TemplateVariant(); } - TemplateVariant handleInheritsList(const QValueList<TemplateVariant> &args) const + TemplateVariant handleInheritsList(const std::vector<TemplateVariant> &args) const { - if (args.count()==1) + if (args.size()==1) { return theTranslator->trInheritsList(args[0].toInt()); } else { - err("tr.inheritsList should take one integer argument, got %d!\n",args.count()); + err("tr.inheritsList should take one integer argument, got %zu!\n",args.size()); } return TemplateVariant(); } - TemplateVariant handleInheritedByList(const QValueList<TemplateVariant> &args) const + TemplateVariant handleInheritedByList(const std::vector<TemplateVariant> &args) const { - if (args.count()==1) + if (args.size()==1) { return theTranslator->trInheritedByList(args[0].toInt()); } else { - err("tr.inheritedByList should take one integer argument, got %d!\n",args.count()); + err("tr.inheritedByList should take one integer argument, got %zu!\n",args.size()); } return TemplateVariant(); } - TemplateVariant handleWriteList(const QValueList<TemplateVariant> &args) const + TemplateVariant handleWriteList(const std::vector<TemplateVariant> &args) const { - if (args.count()==1) + if (args.size()==1) { return theTranslator->trWriteList(args[0].toInt()); } else { - err("tr.*List should take one integer argument, got %d!\n",args.count()); + err("tr.*List should take one integer argument, got %zu!\n",args.size()); } return TemplateVariant(); } - TemplateVariant handleImplementedBy(const QValueList<TemplateVariant> &args) const + TemplateVariant handleImplementedBy(const std::vector<TemplateVariant> &args) const { - if (args.count()==1) + if (args.size()==1) { return theTranslator->trImplementedInList(args[0].toInt()); } else { - err("tr.implementedBy should take one integer argument, got %d!\n",args.count()); + err("tr.implementedBy should take one integer argument, got %zu!\n",args.size()); } return TemplateVariant(); } - TemplateVariant handleReimplementedBy(const QValueList<TemplateVariant> &args) const + TemplateVariant handleReimplementedBy(const std::vector<TemplateVariant> &args) const { - if (args.count()==1) + if (args.size()==1) { return theTranslator->trReimplementedInList(args[0].toInt()); } else { - err("tr.reimplementedBy should take one integer argument, got %d!\n",args.count()); + err("tr.reimplementedBy should take one integer argument, got %zu!\n",args.size()); } return TemplateVariant(); } - TemplateVariant handleSourceRefs(const QValueList<TemplateVariant> &args) const + TemplateVariant handleSourceRefs(const std::vector<TemplateVariant> &args) const { - if (args.count()==1) + if (args.size()==1) { return theTranslator->trReferences()+" "+theTranslator->trWriteList(args[0].toInt())+"."; } else { - err("tr.sourceRefs should take one integer argument, got %d\n",args.count()); + err("tr.sourceRefs should take one integer argument, got %zu\n",args.size()); } return TemplateVariant(); } - TemplateVariant handleSourceRefBys(const QValueList<TemplateVariant> &args) const + TemplateVariant handleSourceRefBys(const std::vector<TemplateVariant> &args) const { - if (args.count()==1) + if (args.size()==1) { return theTranslator->trReferencedBy()+" "+theTranslator->trWriteList(args[0].toInt())+"."; } else { - err("tr.sourceRefBys should take one integer argument, got %d\n",args.count()); + err("tr.sourceRefBys should take one integer argument, got %zu\n",args.size()); } return TemplateVariant(); } - TemplateVariant handleIncludeDependencyGraph(const QValueList<TemplateVariant> &args) const + TemplateVariant handleIncludeDependencyGraph(const std::vector<TemplateVariant> &args) const { - if (args.count()==1) + if (args.size()==1) { return theTranslator->trInclDepGraph(args[0].toString()); } else { - err("tr.includeDependencyGraph should take one string argument, got %d\n",args.count()); + err("tr.includeDependencyGraph should take one string argument, got %zu\n",args.size()); } return TemplateVariant(); } @@ -1073,7 +1071,7 @@ class TranslateContext::Private s_inst.addProperty("namespaceList", &Private::namespaceList); //%% string namespaceMembers s_inst.addProperty("namespaceMembers", &Private::namespaceMembers); - //%% srting fileList + //%% string fileList s_inst.addProperty("fileList", &Private::fileList); //%% string fileMembers s_inst.addProperty("fileMembers", &Private::fileMembers); @@ -1264,7 +1262,8 @@ static TemplateVariant parseDoc(const Definition *def,const QCString &file,int l const QCString &relPath,const QCString &docStr,bool isBrief) { TemplateVariant result; - DocRoot *root = validatingParseDoc(file,line,def,0,docStr,TRUE,FALSE,0,isBrief,FALSE); + DocRoot *root = validatingParseDoc(file,line,def,0,docStr,TRUE,FALSE, + 0,isBrief,FALSE,Config_getBool(MARKDOWN_SUPPORT)); QGString docs; { FTextStream ts(&docs); @@ -1302,8 +1301,8 @@ static TemplateVariant parseDoc(const Definition *def,const QCString &file,int l static TemplateVariant parseCode(MemberDef *md,const QCString &scopeName,const QCString &relPath, const QCString &code,int startLine=-1,int endLine=-1,bool showLineNumbers=FALSE) { - CodeParserInterface &intf = Doxygen::parserManager->getCodeParser(md->getDefFileExtension()); - intf.resetCodeParserState(); + auto intf = Doxygen::parserManager->getCodeParser(md->getDefFileExtension()); + intf->resetCodeParserState(); QGString s; FTextStream t(&s); switch (g_globals.outputFormat) @@ -1311,14 +1310,14 @@ 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,0,md->getBodyDef(), + intf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,0,md->getBodyDef(), startLine,endLine,TRUE,md,showLineNumbers,md); } break; case ContextOutputFormat_Latex: { LatexCodeGenerator codeGen(t,relPath,md->docFile()); - intf.parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,0,md->getBodyDef(), + intf->parseCode(codeGen,scopeName,code,md->getLanguage(),FALSE,0,md->getBodyDef(), startLine,endLine,TRUE,md,showLineNumbers,md); } break; @@ -1333,8 +1332,8 @@ static TemplateVariant parseCode(MemberDef *md,const QCString &scopeName,const Q static TemplateVariant parseCode(const FileDef *fd,const QCString &relPath) { static bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES); - CodeParserInterface &intf = Doxygen::parserManager->getCodeParser(fd->getDefFileExtension()); - intf.resetCodeParserState(); + auto intf = Doxygen::parserManager->getCodeParser(fd->getDefFileExtension()); + intf->resetCodeParserState(); QGString s; FTextStream t(&s); switch (g_globals.outputFormat) @@ -1342,7 +1341,7 @@ static TemplateVariant parseCode(const FileDef *fd,const QCString &relPath) case ContextOutputFormat_Html: { HtmlCodeGenerator codeGen(t,relPath); - intf.parseCode(codeGen,0, + intf->parseCode(codeGen,0, fileToString(fd->absFilePath(),filterSourceFiles,TRUE), // the sources fd->getLanguage(), // lang FALSE, // isExampleBlock @@ -1361,7 +1360,7 @@ static TemplateVariant parseCode(const FileDef *fd,const QCString &relPath) case ContextOutputFormat_Latex: { LatexCodeGenerator codeGen(t,relPath,fd->docFile()); - intf.parseCode(codeGen,0, + intf->parseCode(codeGen,0, fileToString(fd->absFilePath(),filterSourceFiles,TRUE), // the sources fd->getLanguage(), // lang FALSE, // isExampleBlock @@ -1397,6 +1396,7 @@ class DefinitionContext { assert(d!=0); } + virtual ~DefinitionContext() {} void addBaseProperties(PropertyMapper<T> &inst) { //%% string name: the name of the symbol @@ -1544,7 +1544,6 @@ class DefinitionContext case SrcLangExt_VHDL: result="vhdl"; break; case SrcLangExt_XML: result="xml"; break; case SrcLangExt_SQL: result="sql"; break; - case SrcLangExt_Tcl: result="tcl"; break; case SrcLangExt_Markdown: result="markdown"; break; case SrcLangExt_Slice: result="slice"; break; } @@ -1555,16 +1554,14 @@ class DefinitionContext QCString result = "unspecified"; switch (m_def->definitionType()) { - case DefinitionIntf::TypeClass: result="class"; break; - case DefinitionIntf::TypeFile: result="file"; break; - case DefinitionIntf::TypeNamespace: result="namespace"; break; - case DefinitionIntf::TypeGroup: result="module"; break; - case DefinitionIntf::TypePackage: result="package"; break; - case DefinitionIntf::TypePage: result="page"; break; - case DefinitionIntf::TypeDir: result="dir"; break; - case DefinitionIntf::TypeMember: // fall through - case DefinitionIntf::TypeSymbolList: - break; + case Definition::TypeClass: result="class"; break; + case Definition::TypeFile: result="file"; break; + case Definition::TypeNamespace: result="namespace"; break; + case Definition::TypeGroup: result="module"; break; + case Definition::TypePackage: result="package"; break; + case Definition::TypePage: result="page"; break; + case Definition::TypeDir: result="dir"; break; + case Definition::TypeMember: break; } return result; } @@ -1588,9 +1585,9 @@ class DefinitionContext { fillPath(outerScope,list); } - else if (type==Definition::TypeFile && (dynamic_cast<const FileDef*>(def))->getDirDef()) + else if (type==Definition::TypeFile && (toFileDef(def))->getDirDef()) { - fillPath((dynamic_cast<const FileDef*>(def))->getDirDef(),list); + fillPath((toFileDef(def))->getDirDef(),list); } list->append(NavPathElemContext::alloc(def)); } @@ -1604,9 +1601,9 @@ class DefinitionContext { fillPath(m_def->getOuterScope(),list); } - else if (m_def->definitionType()==Definition::TypeFile && (dynamic_cast<const FileDef *>(m_def))->getDirDef()) + else if (m_def->definitionType()==Definition::TypeFile && (toFileDef(m_def))->getDirDef()) { - fillPath((dynamic_cast<const FileDef *>(m_def))->getDirDef(),list); + fillPath((toFileDef(m_def))->getDirDef(),list); } cache.navPath.reset(list); } @@ -1673,7 +1670,6 @@ class DefinitionContext SharedPtr<TemplateStruct> lineLink; }; - private: Cachable &getCache() const { @@ -1681,7 +1677,7 @@ class DefinitionContext assert(c!=0); return *c; } - const Definition *m_def; + const Definition *m_def; }; //%% } @@ -1775,10 +1771,7 @@ class IncludeInfoListContext::Private : public GenericNodeListContext IncludeInfo *ii; for (li.toFirst();(ii=li.current());++li) { - if (!ii->indirect) - { - append(IncludeInfoContext::alloc(ii,lang)); - } + append(IncludeInfoContext::alloc(ii,lang)); } } }; @@ -1794,12 +1787,12 @@ IncludeInfoListContext::~IncludeInfoListContext() } // TemplateListIntf -int IncludeInfoListContext::count() const +uint IncludeInfoListContext::count() const { return p->count(); } -TemplateVariant IncludeInfoListContext::at(int index) const +TemplateVariant IncludeInfoListContext::at(uint index) const { return p->at(index); } @@ -2007,7 +2000,6 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { case ContextOutputFormat_Html: { - QGString result; FTextStream tt(&result); QCString name = convertToHtml(m_classDef->displayName()); @@ -2136,7 +2128,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> return cache.inheritedByList.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool detailed=FALSE) const + MemberListType type,const char *title,bool=FALSE) const { if (!list) { @@ -2325,16 +2317,11 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> if (!cache.classes) { TemplateList *classList = TemplateList::alloc(); - if (m_classDef->getClassSDict()) + for (const auto &cd : m_classDef->getClasses()) { - ClassSDict::Iterator sdi(*m_classDef->getClassSDict()); - const ClassDef *cd; - for (sdi.toFirst();(cd=sdi.current());++sdi) + if (cd->visibleInParentsDeclList()) { - if (cd->visibleInParentsDeclList()) - { - classList->append(ClassContext::alloc(cd)); - } + classList->append(ClassContext::alloc(cd)); } } cache.classes.reset(classList); @@ -2347,20 +2334,15 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> if (!cache.innerClasses) { TemplateList *classList = TemplateList::alloc(); - if (m_classDef->getClassSDict()) + for (const auto &cd : m_classDef->getClasses()) { - ClassSDict::Iterator sdi(*m_classDef->getClassSDict()); - const ClassDef *cd; - for (sdi.toFirst();(cd=sdi.current());++sdi) + if (!cd->isAnonymous() && + cd->isLinkableInProject() && + cd->isEmbeddedInOuterScope() && + cd->partOfGroups().empty() + ) { - if (!cd->isAnonymous() && - cd->isLinkableInProject() && - cd->isEmbeddedInOuterScope() && - cd->partOfGroups()==0 - ) - { - classList->append(ClassContext::alloc(cd)); - } + classList->append(ClassContext::alloc(cd)); } } cache.innerClasses.reset(classList); @@ -2380,7 +2362,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { addTemplateDecls(parent,tl); } - const ClassDef *cd=dynamic_cast<const ClassDef *>(d); + const ClassDef *cd=toClassDef(d); if (!cd->templateArguments().empty()) { ArgumentListContext *al = ArgumentListContext::alloc(cd->templateArguments(),cd,relPathAsString()); @@ -2394,15 +2376,13 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { if (m_classDef->hasExamples()) { - ExampleSDict::Iterator it(*m_classDef->exampleList()); - Example *ex; - for (it.toFirst();(ex=it.current());++it) + for (const auto &ex : m_classDef->getExamples()) { TemplateStruct *s = TemplateStruct::alloc(); - s->set("text",ex->name); + s->set("text",ex.name); s->set("isLinkable",TRUE); - s->set("anchor",ex->anchor); - s->set("fileName",ex->file); + s->set("anchor",ex.anchor); + s->set("fileName",ex.file); s->set("isReference",FALSE); s->set("externalReference",""); list->append(s); @@ -2504,15 +2484,8 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> Cachable &cache = getCache(); if (!cache.allMembersList) { - if (m_classDef->memberNameInfoSDict()) - { - AllMembersListContext *ml = AllMembersListContext::alloc(m_classDef->memberNameInfoSDict()); - cache.allMembersList.reset(ml); - } - else - { - cache.allMembersList.reset(AllMembersListContext::alloc()); - } + AllMembersListContext *ml = AllMembersListContext::alloc(m_classDef->memberNameInfoLinkedMap()); + cache.allMembersList.reset(ml); } return cache.allMembersList.get(); } @@ -2525,9 +2498,9 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> Cachable &cache = getCache(); if (!cache.memberGroups) { - if (m_classDef->getMemberGroupSDict()) + if (!m_classDef->getMemberGroups().empty()) { - cache.memberGroups.reset(MemberGroupListContext::alloc(m_classDef,relPathAsString(),m_classDef->getMemberGroupSDict(),m_classDef->subGrouping())); + cache.memberGroups.reset(MemberGroupListContext::alloc(m_classDef,relPathAsString(),m_classDef->getMemberGroups(),m_classDef->subGrouping())); } else { @@ -2767,22 +2740,17 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri { static bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE); TemplateList *classList = TemplateList::alloc(); - if (m_namespaceDef->getClassSDict()) + for (const auto &cd : m_namespaceDef->getClasses()) { - ClassSDict::Iterator sdi(*m_namespaceDef->getClassSDict()); - const ClassDef *cd; - for (sdi.toFirst();(cd=sdi.current());++sdi) + if (sliceOpt && (cd->compoundType()==ClassDef::Struct || + cd->compoundType()==ClassDef::Interface || + cd->compoundType()==ClassDef::Exception)) { - if (sliceOpt && (cd->compoundType()==ClassDef::Struct || - cd->compoundType()==ClassDef::Interface || - cd->compoundType()==ClassDef::Exception)) - { - continue; // These types appear in their own sections. - } - if (cd->visibleInParentsDeclList()) - { - classList->append(ClassContext::alloc(cd)); - } + continue; // These types appear in their own sections. + } + if (cd->visibleInParentsDeclList()) + { + classList->append(ClassContext::alloc(cd)); } } cache.classes.reset(classList); @@ -2795,16 +2763,11 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri if (!cache.namespaces) { TemplateList *namespaceList = TemplateList::alloc(); - if (m_namespaceDef->getNamespaceSDict()) + for (const auto &nd : m_namespaceDef->getNamespaces()) { - NamespaceSDict::Iterator sdi(*m_namespaceDef->getNamespaceSDict()); - const NamespaceDef *nd; - for (sdi.toFirst();(nd=sdi.current());++sdi) + if (nd->isLinkable() && !nd->isConstantGroup()) { - if (nd->isLinkable() && !nd->isConstantGroup()) - { - namespaceList->append(NamespaceContext::alloc(nd)); - } + namespaceList->append(NamespaceContext::alloc(nd)); } } cache.namespaces.reset(namespaceList); @@ -2817,16 +2780,11 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri if (!cache.constantgroups) { TemplateList *namespaceList = TemplateList::alloc(); - if (m_namespaceDef->getNamespaceSDict()) + for (const auto &nd : m_namespaceDef->getNamespaces()) { - NamespaceSDict::Iterator sdi(*m_namespaceDef->getNamespaceSDict()); - const NamespaceDef *nd; - for (sdi.toFirst();(nd=sdi.current());++sdi) + if (nd->isLinkable() && nd->isConstantGroup()) { - if (nd->isLinkable() && nd->isConstantGroup()) - { - namespaceList->append(NamespaceContext::alloc(nd)); - } + namespaceList->append(NamespaceContext::alloc(nd)); } } cache.constantgroups.reset(namespaceList); @@ -2834,7 +2792,7 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri return cache.constantgroups.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool detailed=FALSE) const + MemberListType type,const char *title,bool=FALSE) const { if (!list) { @@ -2888,9 +2846,9 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri Cachable &cache = getCache(); if (!cache.memberGroups) { - if (m_namespaceDef->getMemberGroupSDict()) + if (!m_namespaceDef->getMemberGroups().empty()) { - cache.memberGroups.reset(MemberGroupListContext::alloc(m_namespaceDef,relPathAsString(),m_namespaceDef->getMemberGroupSDict(),m_namespaceDef->subGrouping())); + cache.memberGroups.reset(MemberGroupListContext::alloc(m_namespaceDef,relPathAsString(),m_namespaceDef->getMemberGroups(),m_namespaceDef->subGrouping())); } else { @@ -2935,19 +2893,14 @@ class NamespaceContext::Private : public DefinitionContext<NamespaceContext::Pri if (!cache.inlineClasses) { TemplateList *classList = TemplateList::alloc(); - if (m_namespaceDef->getClassSDict()) + for (const auto &cd : m_namespaceDef->getClasses()) { - ClassSDict::Iterator sdi(*m_namespaceDef->getClassSDict()); - const ClassDef *cd; - for (sdi.toFirst();(cd=sdi.current());++sdi) + if (!cd->isAnonymous() && + cd->isLinkableInProject() && + cd->isEmbeddedInOuterScope() && + cd->partOfGroups().empty()) { - if (!cd->isAnonymous() && - cd->isLinkableInProject() && - cd->isEmbeddedInOuterScope() && - cd->partOfGroups()==0) - { - classList->append(ClassContext::alloc(cd)); - } + classList->append(ClassContext::alloc(cd)); } } cache.inlineClasses.reset(classList); @@ -3232,16 +3185,11 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> if (!cache.classes) { TemplateList *classList = TemplateList::alloc(); - if (m_fileDef->getClassSDict()) + for (const auto &cd : m_fileDef->getClasses()) { - ClassSDict::Iterator sdi(*m_fileDef->getClassSDict()); - const ClassDef *cd; - for (sdi.toFirst();(cd=sdi.current());++sdi) + if (cd->visibleInParentsDeclList()) { - if (cd->visibleInParentsDeclList()) - { - classList->append(ClassContext::alloc(cd)); - } + classList->append(ClassContext::alloc(cd)); } } cache.classes.reset(classList); @@ -3254,16 +3202,11 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> if (!cache.namespaces) { TemplateList *namespaceList = TemplateList::alloc(); - if (m_fileDef->getNamespaceSDict()) + for (const auto &nd : m_fileDef->getNamespaces()) { - NamespaceSDict::Iterator sdi(*m_fileDef->getNamespaceSDict()); - const NamespaceDef *nd; - for (sdi.toFirst();(nd=sdi.current());++sdi) + if (nd->isLinkable() && !nd->isConstantGroup()) { - if (nd->isLinkable() && !nd->isConstantGroup()) - { - namespaceList->append(NamespaceContext::alloc(nd)); - } + namespaceList->append(NamespaceContext::alloc(nd)); } } cache.namespaces.reset(namespaceList); @@ -3276,16 +3219,11 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> if (!cache.constantgroups) { TemplateList *namespaceList = TemplateList::alloc(); - if (m_fileDef->getNamespaceSDict()) + for (const auto &nd : m_fileDef->getNamespaces()) { - NamespaceSDict::Iterator sdi(*m_fileDef->getNamespaceSDict()); - NamespaceDef *nd; - for (sdi.toFirst();(nd=sdi.current());++sdi) + if (nd->isLinkable() && nd->isConstantGroup()) { - if (nd->isLinkable() && nd->isConstantGroup()) - { - namespaceList->append(NamespaceContext::alloc(nd)); - } + namespaceList->append(NamespaceContext::alloc(nd)); } } cache.constantgroups.reset(namespaceList); @@ -3293,7 +3231,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> return cache.constantgroups.get(); } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool detailed=FALSE) const + MemberListType type,const char *title,bool=FALSE) const { if (!list) { @@ -3351,9 +3289,9 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> Cachable &cache = getCache(); if (!cache.memberGroups) { - if (m_fileDef->getMemberGroupSDict()) + if (!m_fileDef->getMemberGroups().empty()) { - cache.memberGroups.reset(MemberGroupListContext::alloc(m_fileDef,relPathAsString(),m_fileDef->getMemberGroupSDict(),m_fileDef->subGrouping())); + cache.memberGroups.reset(MemberGroupListContext::alloc(m_fileDef,relPathAsString(),m_fileDef->getMemberGroups(),m_fileDef->subGrouping())); } else { @@ -3399,19 +3337,14 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> if (!cache.inlineClasses) { TemplateList *classList = TemplateList::alloc(); - if (m_fileDef->getClassSDict()) + for (const auto &cd : m_fileDef->getClasses()) { - ClassSDict::Iterator sdi(*m_fileDef->getClassSDict()); - const ClassDef *cd; - for (sdi.toFirst();(cd=sdi.current());++sdi) + if (!cd->isAnonymous() && + cd->isLinkableInProject() && + cd->isEmbeddedInOuterScope() && + cd->partOfGroups().empty()) { - if (!cd->isAnonymous() && - cd->isLinkableInProject() && - cd->isEmbeddedInOuterScope() && - cd->partOfGroups()==0) - { - classList->append(ClassContext::alloc(cd)); - } + classList->append(ClassContext::alloc(cd)); } } cache.inlineClasses.reset(classList); @@ -3533,10 +3466,7 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> if (!cache.dirs) { cache.dirs.reset(TemplateList::alloc()); - const DirList &subDirs = m_dirDef->subDirs(); - QListIterator<DirDef> it(subDirs); - const DirDef *dd; - for (it.toFirst();(dd=it.current());++it) + for(const auto dd : m_dirDef->subDirs()) { DirContext *dc = new DirContext(dd); cache.dirs->append(dc); @@ -3820,6 +3750,7 @@ class TextGeneratorHtml : public TextGeneratorIntf : m_ts(ts), m_relPath(relPath) {} void writeString(const char *s,bool keepSpaces) const { + static const char *hex="0123456789ABCDEF"; if (s==0) return; if (keepSpaces) { @@ -3835,6 +3766,19 @@ class TextGeneratorHtml : public TextGeneratorIntf case '"': m_ts << """; break; case '&': m_ts << "&"; break; case ' ': m_ts << " "; break; + default: + { + uchar uc = static_cast<uchar>(c); + if (uc<32 && !isspace(c)) // non-printable control characters + { + m_ts << "$" << hex[uc>>4] << hex[uc&0xF] << ";"; + } + else + { + m_ts << c; + } + } + break; } } } @@ -3911,13 +3855,25 @@ class TextGeneratorLatex : public TextGeneratorIntf if (f && anchor) m_ts << "_"; if (anchor) m_ts << anchor; m_ts << "}{"; - filterLatexString(m_ts,text); + filterLatexString(m_ts,text, + false, // insideTabbing + false, // insidePre + false, // insideItem + false, // insideTable + false // keepSpaces + ); m_ts << "}}"; } else { m_ts << "\\textbf{ "; - filterLatexString(m_ts,text); + filterLatexString(m_ts,text, + false, // insideTabbing + false, // insidePre + false, // insideItem + false, // insideTable + false // keepSpaces + ); m_ts << "}"; } } @@ -3977,7 +3933,7 @@ TemplateVariant createLinkedText(const Definition *def,const QCString &relPath,c class MemberContext::Private : public DefinitionContext<MemberContext::Private> { public: - Private(MemberDef *md) : DefinitionContext<MemberContext::Private>(md) , m_memberDef(md) + Private(const MemberDef *md) : DefinitionContext<MemberContext::Private>(md) , m_memberDef(md) { static bool init=FALSE; if (!init) @@ -4106,7 +4062,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> s_inst.addProperty("nameWithContextFor", &Private::nameWithContextFor); init=TRUE; } - if (!md->cookie()) { md->setCookie(new MemberContext::Private::Cachable(md)); } + if (md && !md->cookie()) { md->setCookie(new MemberContext::Private::Cachable(md)); } Cachable &cache = getCache(); cache.propertyAttrs.reset(TemplateList::alloc()); @@ -4438,8 +4394,9 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { scopeName = m_memberDef->getNamespaceDef()->name(); } - cache.initializer = parseCode(m_memberDef,scopeName,relPathAsString(), - m_memberDef->initializer()); + cache.initializer = parseCode(const_cast<MemberDef*>(m_memberDef), + scopeName,relPathAsString(), + m_memberDef->initializer()); cache.initializerParsed = TRUE; } return cache.initializer; @@ -4671,27 +4628,27 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } TemplateVariant hasConstQualifier() const { - return getDefArgList().constSpecifier; + return getDefArgList().constSpecifier(); } TemplateVariant hasVolatileQualifier() const { - return getDefArgList().volatileSpecifier; + return getDefArgList().volatileSpecifier(); } TemplateVariant hasRefQualifierLValue() const { - return getDefArgList().refQualifier==RefQualifierLValue; + return getDefArgList().refQualifier()==RefQualifierLValue; } TemplateVariant hasRefQualifierRValue() const { - return getDefArgList().refQualifier==RefQualifierRValue; + return getDefArgList().refQualifier()==RefQualifierRValue; } TemplateVariant trailingReturnType() const { const ArgumentList &al = getDefArgList(); - if (!al.trailingReturnType.isEmpty()) + if (!al.trailingReturnType().isEmpty()) { return createLinkedText(m_memberDef,relPathAsString(), - al.trailingReturnType); + al.trailingReturnType()); } else { @@ -4776,12 +4733,13 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> if (m_memberDef->argumentList().hasDocumentation()) { QCString paramDocs; - for (Argument &a : m_memberDef->argumentList()) + for (const Argument &a : m_memberDef->argumentList()) { if (a.hasDocumentation()) { - QCString direction = extractDirection(a.docs); - paramDocs+="@param"+direction+" "+a.name+" "+a.docs; + QCString docs = a.docs; + QCString direction = extractDirection(docs); + paramDocs+="@param"+direction+" "+a.name+" "+docs; } } cache.paramDocs.reset(new TemplateVariant(parseDoc(m_memberDef, @@ -4885,15 +4843,13 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { if (m_memberDef->hasExamples()) { - ExampleSDict::Iterator it(*m_memberDef->getExamples()); - Example *ex; - for (it.toFirst();(ex=it.current());++it) + for (const auto &ex : m_memberDef->getExamples()) { TemplateStruct *s = TemplateStruct::alloc(); - s->set("text",ex->name); + s->set("text",ex.name); s->set("isLinkable",TRUE); - s->set("anchor",ex->anchor); - s->set("fileName",ex->file); + s->set("anchor",ex.anchor); + s->set("fileName",ex.file); s->set("isReference",FALSE); s->set("externalReference",""); list->append(s); @@ -4944,7 +4900,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> Cachable &cache = getCache(); if (!cache.sourceRefs) { - cache.sourceRefs.reset(MemberListContext::alloc(m_memberDef->getReferencesMembers(),TRUE)); + cache.sourceRefs.reset(MemberListContext::alloc(m_memberDef->getReferencesMembers())); } return cache.sourceRefs.get(); } @@ -4953,7 +4909,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> Cachable &cache = getCache(); if (!cache.sourceRefBys) { - cache.sourceRefBys.reset(MemberListContext::alloc(m_memberDef->getReferencedByMembers(),TRUE)); + cache.sourceRefBys.reset(MemberListContext::alloc(m_memberDef->getReferencedByMembers())); } return cache.sourceRefBys.get(); } @@ -4983,7 +4939,9 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { scopeName = m_memberDef->getNamespaceDef()->name(); } - cache.sourceCode = parseCode(m_memberDef,scopeName,relPathAsString(),codeFragment,startLine,endLine,TRUE); + cache.sourceCode = parseCode(const_cast<MemberDef*>(m_memberDef), + scopeName,relPathAsString(), + codeFragment,startLine,endLine,TRUE); cache.sourceCodeParsed = TRUE; } } @@ -5137,15 +5095,15 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { return m_memberDef->typeString(); } - TemplateVariant handleDetailsVisibleFor(const QValueList<TemplateVariant> &args) const + TemplateVariant handleDetailsVisibleFor(const std::vector<TemplateVariant> &args) const { - if (args.count()==1) + if (args.size()==1) { return m_memberDef->isDetailedSectionVisible(args[0].toString()=="module",args[0].toString()=="file"); } else { - err(".detailsVisibleFor should take one string argument, got %d\n",args.count()); + err(".detailsVisibleFor should take one string argument, got %zu\n",args.size()); } return TemplateVariant(); } @@ -5153,9 +5111,9 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> { return TemplateVariant::Delegate::fromMethod<Private,&Private::handleDetailsVisibleFor>(this); } - TemplateVariant handleNameWithContextFor(const QValueList<TemplateVariant> &args) const + TemplateVariant handleNameWithContextFor(const std::vector<TemplateVariant> &args) const { - if (args.count()==1) + if (args.size()==1) { SrcLangExt lang = m_memberDef->getLanguage(); QCString n = m_memberDef->name(); @@ -5177,7 +5135,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> } else { - err(".nameWithContextFor should take one string argument, got %d\n",args.count()); + err(".nameWithContextFor should take one string argument, got %zu\n",args.size()); } return TemplateVariant(); } @@ -5186,10 +5144,10 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> return TemplateVariant::Delegate::fromMethod<Private,&Private::handleNameWithContextFor>(this); } private: - MemberDef *m_memberDef; + const MemberDef *m_memberDef; struct Cachable : public DefinitionContext<MemberContext::Private>::Cachable { - Cachable(MemberDef *md) : DefinitionContext<MemberContext::Private>::Cachable(md), + Cachable(const MemberDef *md) : DefinitionContext<MemberContext::Private>::Cachable(md), initializerParsed(FALSE), sourceCodeParsed(FALSE), declArgsParsed(FALSE), declTypeParsed(FALSE) { } SharedPtr<ArgumentListContext> templateArgs; @@ -5239,7 +5197,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> PropertyMapper<MemberContext::Private> MemberContext::Private::s_inst; -MemberContext::MemberContext(MemberDef *md) : RefCountedContext("MemberContext") +MemberContext::MemberContext(const MemberDef *md) : RefCountedContext("MemberContext") { p = new Private(md); } @@ -5404,16 +5362,11 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> if (!cache.modules) { TemplateList *moduleList = TemplateList::alloc(); - if (m_groupDef->getSubGroups()) + for (const auto &gd : m_groupDef->getSubGroups()) { - GroupListIterator gli(*m_groupDef->getSubGroups()); - const GroupDef *gd; - for (gli.toFirst();(gd=gli.current());++gli) + if (gd->isVisible()) { - if (gd->isVisible()) - { - moduleList->append(ModuleContext::alloc(gd)); - } + moduleList->append(ModuleContext::alloc(gd)); } } cache.modules.reset(moduleList); @@ -5426,14 +5379,9 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> if (!cache.examples) { TemplateList *exampleList = TemplateList::alloc(); - if (m_groupDef->getExamples()) + for (const auto &ex : m_groupDef->getExamples()) { - PageSDict::Iterator eli(*m_groupDef->getExamples()); - const PageDef *ex; - for (eli.toFirst();(ex=eli.current());++eli) - { - exampleList->append(PageContext::alloc(ex,FALSE,TRUE)); - } + exampleList->append(PageContext::alloc(ex,FALSE,TRUE)); } cache.examples.reset(exampleList); } @@ -5445,14 +5393,9 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> if (!cache.pages) { TemplateList *pageList = TemplateList::alloc(); - if (m_groupDef->getExamples()) + for (const auto &ex : m_groupDef->getPages()) { - PageSDict::Iterator eli(*m_groupDef->getPages()); - const PageDef *ex; - for (eli.toFirst();(ex=eli.current());++eli) - { - pageList->append(PageContext::alloc(ex,FALSE,TRUE)); - } + pageList->append(PageContext::alloc(ex,FALSE,TRUE)); } cache.pages.reset(pageList); } @@ -5464,14 +5407,9 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> if (!cache.dirs) { TemplateList *dirList = TemplateList::alloc(); - if (m_groupDef->getDirs()) + for(const auto dd : m_groupDef->getDirs()) { - QListIterator<DirDef> it(*m_groupDef->getDirs()); - const DirDef *dd; - for (it.toFirst();(dd=it.current());++it) - { - dirList->append(DirContext::alloc(dd)); - } + dirList->append(DirContext::alloc(dd)); } cache.dirs.reset(dirList); } @@ -5502,16 +5440,11 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> if (!cache.classes) { TemplateList *classList = TemplateList::alloc(); - if (m_groupDef->getClasses()) + for (const auto &cd : m_groupDef->getClasses()) { - ClassSDict::Iterator sdi(*m_groupDef->getClasses()); - const ClassDef *cd; - for (sdi.toFirst();(cd=sdi.current());++sdi) + if (cd->visibleInParentsDeclList()) { - if (cd->visibleInParentsDeclList()) - { - classList->append(ClassContext::alloc(cd)); - } + classList->append(ClassContext::alloc(cd)); } } cache.classes.reset(classList); @@ -5524,16 +5457,11 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> if (!cache.namespaces) { TemplateList *namespaceList = TemplateList::alloc(); - if (m_groupDef->getNamespaces()) + for (const auto &nd : m_groupDef->getNamespaces()) { - NamespaceSDict::Iterator sdi(*m_groupDef->getNamespaces()); - const NamespaceDef *nd; - for (sdi.toFirst();(nd=sdi.current());++sdi) + if (nd->isLinkable() && !nd->isConstantGroup()) { - if (nd->isLinkable() && !nd->isConstantGroup()) - { - namespaceList->append(NamespaceContext::alloc(nd)); - } + namespaceList->append(NamespaceContext::alloc(nd)); } } cache.namespaces.reset(namespaceList); @@ -5546,16 +5474,11 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> if (!cache.constantgroups) { TemplateList *namespaceList = TemplateList::alloc(); - if (m_groupDef->getNamespaces()) + for (const auto &nd : m_groupDef->getNamespaces()) { - NamespaceSDict::Iterator sdi(*m_groupDef->getNamespaces()); - NamespaceDef *nd; - for (sdi.toFirst();(nd=sdi.current());++sdi) + if (nd->isLinkable() && nd->isConstantGroup()) { - if (nd->isLinkable() && nd->isConstantGroup()) - { - namespaceList->append(NamespaceContext::alloc(nd)); - } + namespaceList->append(NamespaceContext::alloc(nd)); } } cache.constantgroups.reset(namespaceList); @@ -5564,7 +5487,7 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> } TemplateVariant getMemberList(SharedPtr<MemberListInfoContext> &list, - MemberListType type,const char *title,bool detailed=FALSE) const + MemberListType type,const char *title,bool=FALSE) const { if (!list) { @@ -5646,9 +5569,9 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> Cachable &cache = getCache(); if (!cache.memberGroups) { - if (m_groupDef->getMemberGroupSDict()) + if (!m_groupDef->getMemberGroups().empty()) { - cache.memberGroups.reset(MemberGroupListContext::alloc(m_groupDef,relPathAsString(),m_groupDef->getMemberGroupSDict(),m_groupDef->subGrouping())); + cache.memberGroups.reset(MemberGroupListContext::alloc(m_groupDef,relPathAsString(),m_groupDef->getMemberGroups(),m_groupDef->subGrouping())); } else { @@ -5718,19 +5641,14 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private> if (!cache.inlineClasses) { TemplateList *classList = TemplateList::alloc(); - if (m_groupDef->getClasses()) + for (const auto &cd : m_groupDef->getClasses()) { - ClassSDict::Iterator sdi(*m_groupDef->getClasses()); - const ClassDef *cd; - for (sdi.toFirst();(cd=sdi.current());++sdi) + if (!cd->isAnonymous() && + cd->isLinkableInProject() && + cd->isEmbeddedInOuterScope() && + cd->partOfGroups().empty()) { - if (!cd->isAnonymous() && - cd->isLinkableInProject() && - cd->isEmbeddedInOuterScope() && - cd->partOfGroups()==0) - { - classList->append(ClassContext::alloc(cd)); - } + classList->append(ClassContext::alloc(cd)); } } cache.inlineClasses.reset(classList); @@ -5817,11 +5735,9 @@ TemplateVariant ModuleContext::get(const char *n) const class ClassListContext::Private : public GenericNodeListContext { public: - void addClasses(const ClassSDict &classSDict) + void addClasses(const ClassLinkedMap &classLinkedMap) { - ClassSDict::Iterator cli(classSDict); - const ClassDef *cd; - for (cli.toFirst() ; (cd=cli.current()) ; ++cli ) + for (const auto &cd : classLinkedMap) { if (cd->getLanguage()==SrcLangExt_VHDL && ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKAGECLASS || @@ -5833,7 +5749,7 @@ class ClassListContext::Private : public GenericNodeListContext if (cd->isLinkableInProject() && cd->templateMaster()==0 && !cd->isHidden() && !cd->isEmbeddedInOuterScope()) { - append(ClassContext::alloc(cd)); + append(ClassContext::alloc(cd.get())); } } } @@ -5842,8 +5758,8 @@ class ClassListContext::Private : public GenericNodeListContext ClassListContext::ClassListContext() : RefCountedContext("ClassListContext") { p = new Private; - p->addClasses(*Doxygen::classSDict); - p->addClasses(*Doxygen::hiddenClasses); + p->addClasses(*Doxygen::classLinkedMap); + p->addClasses(*Doxygen::hiddenClassLinkedMap); } ClassListContext::~ClassListContext() @@ -5852,12 +5768,12 @@ ClassListContext::~ClassListContext() } // TemplateListIntf -int ClassListContext::count() const +uint ClassListContext::count() const { return p->count(); } -TemplateVariant ClassListContext::at(int index) const +TemplateVariant ClassListContext::at(uint index) const { return p->at(index); } @@ -5896,11 +5812,9 @@ class ClassIndexContext::Private if (!m_cache.classes) { TemplateList *classList = TemplateList::alloc(); - if (Doxygen::classSDict) + if (Doxygen::classLinkedMap) { - ClassSDict::Iterator cli(*Doxygen::classSDict); - const ClassDef *cd; - for (cli.toFirst() ; (cd=cli.current()) ; ++cli ) + for (const auto &cd : *Doxygen::classLinkedMap) { if (cd->getLanguage()==SrcLangExt_VHDL && ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKAGECLASS || @@ -5911,7 +5825,7 @@ class ClassIndexContext::Private } if (cd->isLinkableInProject() && cd->templateMaster()==0) { - classList->append(ClassContext::alloc(cd)); + classList->append(ClassContext::alloc(cd.get())); } } } @@ -6062,10 +5976,9 @@ class ClassHierarchyContext::Private Private() { m_classTree.reset(NestingContext::alloc(0,0)); - initClassHierarchy(Doxygen::classSDict); - initClassHierarchy(Doxygen::hiddenClasses); - m_classTree->addClassHierarchy(*Doxygen::classSDict,TRUE); - m_classTree->addClassHierarchy(*Doxygen::hiddenClasses,TRUE); + ClassDefSet visitedClasses; + m_classTree->addClassHierarchy(*Doxygen::classLinkedMap,visitedClasses); + m_classTree->addClassHierarchy(*Doxygen::hiddenClassLinkedMap,visitedClasses); //%% ClassInheritance tree static bool init=FALSE; if (!init) @@ -6120,15 +6033,10 @@ class ClassHierarchyContext::Private { TemplateList *diagrams = TemplateList::alloc(); DotGfxHierarchyTable *hierarchy = getHierarchy(); - if (hierarchy->subGraphs()) + int id=0; + for (auto n : hierarchy->subGraphs()) { - int id=0; - QListIterator<DotNode> li(*hierarchy->subGraphs()); - DotNode *n; - for (li.toFirst();(n=li.current());++li) - { - diagrams->append(InheritanceGraphContext::alloc(hierarchy,n,id++)); - } + diagrams->append(InheritanceGraphContext::alloc(hierarchy,n,id++)); } m_cache.diagrams.reset(diagrams); } @@ -6207,7 +6115,8 @@ 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 addCls,bool inherit, bool hideSuper, + ClassDefSet &visitedClasses) : m_parent(parent), m_def(d), m_level(level), m_index(index) { m_children.reset(NestingContext::alloc(thisNode,level+1)); @@ -6247,11 +6156,11 @@ class NestingNodeContext::Private init=TRUE; } - addNamespaces(addCls); - addClasses(inherit,hideSuper); - addDirFiles(); - addPages(); - addModules(); + addNamespaces(addCls,visitedClasses); + addClasses(inherit,hideSuper,visitedClasses); + addDirFiles(visitedClasses); + addPages(visitedClasses); + addModules(visitedClasses); } TemplateVariant get(const char *n) const { @@ -6269,7 +6178,7 @@ class NestingNodeContext::Private { if (!m_cache.classContext && m_def->definitionType()==Definition::TypeClass) { - m_cache.classContext.reset(ClassContext::alloc(dynamic_cast<const ClassDef*>(m_def))); + m_cache.classContext.reset(ClassContext::alloc(toClassDef(m_def))); } if (m_cache.classContext) { @@ -6284,7 +6193,7 @@ class NestingNodeContext::Private { if (!m_cache.namespaceContext && m_def->definitionType()==Definition::TypeNamespace) { - m_cache.namespaceContext.reset(NamespaceContext::alloc(dynamic_cast<const NamespaceDef*>(m_def))); + m_cache.namespaceContext.reset(NamespaceContext::alloc(toNamespaceDef(m_def))); } if (m_cache.namespaceContext) { @@ -6299,7 +6208,7 @@ class NestingNodeContext::Private { if (!m_cache.dirContext && m_def->definitionType()==Definition::TypeDir) { - m_cache.dirContext.reset(DirContext::alloc(dynamic_cast<const DirDef*>(m_def))); + m_cache.dirContext.reset(DirContext::alloc(toDirDef(m_def))); } if (m_cache.dirContext) { @@ -6314,7 +6223,7 @@ class NestingNodeContext::Private { if (!m_cache.fileContext && m_def->definitionType()==Definition::TypeFile) { - m_cache.fileContext.reset(FileContext::alloc(dynamic_cast<const FileDef*>(m_def))); + m_cache.fileContext.reset(FileContext::alloc(toFileDef(m_def))); } if (m_cache.fileContext) { @@ -6329,7 +6238,7 @@ class NestingNodeContext::Private { if (!m_cache.pageContext && m_def->definitionType()==Definition::TypePage) { - m_cache.pageContext.reset(PageContext::alloc(dynamic_cast<const PageDef*>(m_def),FALSE,FALSE)); + m_cache.pageContext.reset(PageContext::alloc(toPageDef(m_def),FALSE,FALSE)); } if (m_cache.pageContext) { @@ -6344,7 +6253,7 @@ class NestingNodeContext::Private { if (!m_cache.moduleContext && m_def->definitionType()==Definition::TypeGroup) { - m_cache.moduleContext.reset(ModuleContext::alloc(dynamic_cast<const GroupDef*>(m_def))); + m_cache.moduleContext.reset(ModuleContext::alloc(toGroupDef(m_def))); } if (m_cache.moduleContext) { @@ -6414,72 +6323,72 @@ class NestingNodeContext::Private //------------------------------------------------------------------ - void addClasses(bool inherit, bool hideSuper) + void addClasses(bool inherit, bool hideSuper,ClassDefSet &visitedClasses) { - const ClassDef *cd = dynamic_cast<const ClassDef*>(m_def); + const ClassDef *cd = toClassDef(m_def); if (cd && inherit) { - bool hasChildren = !cd->isVisited() && !hideSuper && classHasVisibleChildren(cd); + bool hasChildren = visitedClasses.find(cd)==visitedClasses.end() && + !hideSuper && classHasVisibleChildren(cd); if (hasChildren) { - bool wasVisited=cd->isVisited(); - cd->setVisited(TRUE); + visitedClasses.insert(cd); if (cd->getLanguage()==SrcLangExt_VHDL) { - m_children->addDerivedClasses(cd->baseClasses(),wasVisited); + m_children->addDerivedClasses(cd->baseClasses(),false,visitedClasses); } else { - m_children->addDerivedClasses(cd->subClasses(),wasVisited); + m_children->addDerivedClasses(cd->subClasses(),false,visitedClasses); } } } else { - if (cd && cd->getClassSDict()) + if (cd) { - m_children->addClasses(*cd->getClassSDict(),FALSE); + m_children->addClasses(cd->getClasses(),FALSE,visitedClasses); } } } - void addNamespaces(bool addClasses) + void addNamespaces(bool addClasses,ClassDefSet &visitedClasses) { - const NamespaceDef *nd = dynamic_cast<const NamespaceDef*>(m_def); - if (nd && nd->getNamespaceSDict()) + const NamespaceDef *nd = toNamespaceDef(m_def); + if (nd && !nd->getNamespaces().empty()) { - m_children->addNamespaces(*nd->getNamespaceSDict(),FALSE,addClasses); + m_children->addNamespaces(nd->getNamespaces(),FALSE,addClasses,visitedClasses); } - if (addClasses && nd && nd->getClassSDict()) + if (addClasses && nd) { - m_children->addClasses(*nd->getClassSDict(),FALSE); + m_children->addClasses(nd->getClasses(),FALSE,visitedClasses); } } - void addDirFiles() + void addDirFiles(ClassDefSet &visitedClasses) { - const DirDef *dd = dynamic_cast<const DirDef*>(m_def); + const DirDef *dd = toDirDef(m_def); if (dd) { - m_children->addDirs(dd->subDirs()); + m_children->addDirs(dd->subDirs(),visitedClasses); if (dd && dd->getFiles()) { - m_children->addFiles(*dd->getFiles()); + m_children->addFiles(*dd->getFiles(),visitedClasses); } } } - void addPages() + void addPages(ClassDefSet &visitedClasses) { - const PageDef *pd = dynamic_cast<const PageDef*>(m_def); - if (pd && pd->getSubPages()) + const PageDef *pd = toPageDef(m_def); + if (pd && !pd->getSubPages().empty()) { - m_children->addPages(*pd->getSubPages(),FALSE); + m_children->addPages(pd->getSubPages(),FALSE,visitedClasses); } } - void addModules() + void addModules(ClassDefSet &visitedClasses) { - const GroupDef *gd = dynamic_cast<const GroupDef*>(m_def); - if (gd && gd->getSubGroups()) + const GroupDef *gd = toGroupDef(m_def); + if (gd && !gd->getSubGroups().empty()) { - m_children->addModules(*gd->getSubGroups()); + m_children->addModules(gd->getSubGroups(),visitedClasses); } } private: @@ -6506,10 +6415,11 @@ class NestingNodeContext::Private PropertyMapper<NestingNodeContext::Private> 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 addClass,bool inherit,bool hideSuper, + ClassDefSet &visitedClasses) : RefCountedContext("NestingNodeContext") { - p = new Private(parent,this,d,index,level,addClass,inherit,hideSuper); + p = new Private(parent,this,d,index,level,addClass,inherit,hideSuper,visitedClasses); } NestingNodeContext::~NestingNodeContext() @@ -6536,158 +6446,170 @@ class NestingContext::Private : public GenericNodeListContext Private(const NestingNodeContext *parent,int level) : m_parent(parent), m_level(level), m_index(0) {} - void addNamespaces(const NamespaceSDict &nsDict,bool rootOnly,bool addClasses) + void addNamespace(const NamespaceDef *nd,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses) { - NamespaceSDict::Iterator nli(nsDict); - const NamespaceDef *nd; - for (nli.toFirst();(nd=nli.current());++nli) + if (!nd->isAnonymous() && + (!rootOnly || nd->getOuterScope()==Doxygen::globalScope)) { - if (!nd->isAnonymous() && - (!rootOnly || nd->getOuterScope()==Doxygen::globalScope)) + bool hasChildren = namespaceHasNestedNamespace(nd); + bool isLinkable = nd->isLinkableInProject(); + if (isLinkable || hasChildren) { - bool hasChildren = namespaceHasVisibleChild(nd,addClasses,false,ClassDef::Class); - bool isLinkable = nd->isLinkableInProject(); - if (isLinkable || hasChildren) - { - NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,nd,m_index,m_level,addClasses,FALSE,FALSE); - append(nnc); - m_index++; - } + NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,nd,m_index,m_level,addClasses,FALSE,FALSE,visitedClasses); + append(nnc); + m_index++; } } } - void addClasses(const ClassSDict &clDict,bool rootOnly) + void addNamespaces(const NamespaceLinkedMap &nsLinkedMap,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses) { - ClassSDict::Iterator cli(clDict); - const ClassDef *cd; - for (;(cd=cli.current());++cli) + for (const auto &nd : nsLinkedMap) { - if (cd->getLanguage()==SrcLangExt_VHDL) + addNamespace(nd.get(),rootOnly,addClasses,visitedClasses); + } + } + void addNamespaces(const NamespaceLinkedRefMap &nsLinkedMap,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses) + { + for (const auto &nd : nsLinkedMap) + { + addNamespace(nd,rootOnly,addClasses,visitedClasses); + } + } + void addClass(const ClassDef *cd,bool rootOnly,ClassDefSet &visitedClasses) + { + if (cd->getLanguage()==SrcLangExt_VHDL) + { + if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKAGECLASS || + (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS + )// no architecture { - if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKAGECLASS || - (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS - )// no architecture - { - continue; - } + return; } - if (!rootOnly || - cd->getOuterScope()==0 || - cd->getOuterScope()==Doxygen::globalScope - ) + } + if (!rootOnly || + cd->getOuterScope()==0 || + cd->getOuterScope()==Doxygen::globalScope + ) + { + if (classVisibleInIndex(cd) && cd->templateMaster()==0) { - if (classVisibleInIndex(cd) && cd->templateMaster()==0) - { - NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,cd,m_index,m_level,TRUE,FALSE,FALSE); - append(nnc); - m_index++; - } + NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,cd,m_index,m_level,TRUE,FALSE,FALSE,visitedClasses); + append(nnc); + m_index++; } } } - void addDirs(const DirSDict &dirDict) + void addClasses(const ClassLinkedRefMap &clLinkedMap,bool rootOnly,ClassDefSet &visitedClasses) + { + for (const auto &cd : clLinkedMap) + { + addClass(cd,rootOnly,visitedClasses); + } + } + void addClasses(const ClassLinkedMap &clLinkedMap,bool rootOnly,ClassDefSet &visitedClasses) + { + for (const auto &cd : clLinkedMap) + { + addClass(cd.get(),rootOnly,visitedClasses); + } + } + void addDirs(const DirLinkedMap &dirLinkedMap,ClassDefSet &visitedClasses) { - SDict<DirDef>::Iterator dli(dirDict); - const DirDef *dd; - for (dli.toFirst();(dd=dli.current());++dli) + for (const auto &dd : dirLinkedMap) { if (dd->getOuterScope()==Doxygen::globalScope) { - append(NestingNodeContext::alloc(m_parent,dd,m_index,m_level,FALSE,FALSE,FALSE)); + append(NestingNodeContext::alloc(m_parent,dd.get(),m_index,m_level,FALSE,FALSE,FALSE,visitedClasses)); m_index++; } } } - void addDirs(const DirList &dirList) + void addDirs(const DirList &dirList,ClassDefSet &visitedClasses) { - QListIterator<DirDef> li(dirList); - const DirDef *dd; - for (li.toFirst();(dd=li.current());++li) + for(const auto dd : dirList) { - append(NestingNodeContext::alloc(m_parent,dd,m_index,m_level,FALSE,FALSE,FALSE)); + append(NestingNodeContext::alloc(m_parent,dd,m_index,m_level,FALSE,FALSE,FALSE,visitedClasses)); m_index++; } } - void addFiles(const FileNameList &fnList) + void addFiles(const FileNameLinkedMap &fnList,ClassDefSet &visitedClasses) { - FileNameListIterator fnli(fnList); - FileName *fn; - for (fnli.toFirst();(fn=fnli.current());++fnli) + for (const FileNameLinkedMap::Ptr &fn : fnList) { - FileNameIterator fni(*fn); - const FileDef *fd; - for (;(fd=fni.current());++fni) + for (const auto &fd : *fn) { if (fd->getDirDef()==0) // top level file { - append(NestingNodeContext::alloc(m_parent,fd,m_index,m_level,FALSE,FALSE,FALSE)); + append(NestingNodeContext::alloc(m_parent,fd.get(),m_index,m_level,FALSE,FALSE,FALSE,visitedClasses)); m_index++; } } } } - void addFiles(const FileList &fList) + void addFiles(const FileList &fList,ClassDefSet &visitedClasses) { QListIterator<FileDef> li(fList); const FileDef *fd; for (li.toFirst();(fd=li.current());++li) { - append(NestingNodeContext::alloc(m_parent,fd,m_index,m_level,FALSE,FALSE,FALSE)); + append(NestingNodeContext::alloc(m_parent,fd,m_index,m_level,FALSE,FALSE,FALSE,visitedClasses)); m_index++; } } - void addPages(const PageSDict &pages,bool rootOnly) + void addPage(const PageDef *pd,bool rootOnly,ClassDefSet &visitedClasses) { - SDict<PageDef>::Iterator pli(pages); - const PageDef *pd; - for (pli.toFirst();(pd=pli.current());++pli) + if (!rootOnly || + pd->getOuterScope()==0 || + pd->getOuterScope()->definitionType()!=Definition::TypePage) { - if (!rootOnly || - pd->getOuterScope()==0 || - pd->getOuterScope()->definitionType()!=Definition::TypePage) - { - append(NestingNodeContext::alloc(m_parent,pd,m_index,m_level,FALSE,FALSE,FALSE)); - m_index++; - } + append(NestingNodeContext::alloc(m_parent,pd,m_index,m_level,FALSE,FALSE,FALSE,visitedClasses)); + m_index++; + } + } + void addPages(const PageLinkedMap &pages,bool rootOnly,ClassDefSet &visitedClasses) + { + for (const auto &pd : pages) + { + addPage(pd.get(),rootOnly,visitedClasses); + } + } + void addPages(const PageLinkedRefMap &pages,bool rootOnly,ClassDefSet &visitedClasses) + { + for (const auto &pd : pages) + { + addPage(pd,rootOnly,visitedClasses); } } - void addModules(const GroupSDict &groups) + void addModules(const GroupLinkedMap &groups,ClassDefSet &visitedClasses) { - GroupSDict::Iterator gli(groups); - const GroupDef *gd; - for (gli.toFirst();(gd=gli.current());++gli) + for (const auto &gd : groups) { - static bool externalGroups = Config_getBool(EXTERNAL_GROUPS); + bool externalGroups = Config_getBool(EXTERNAL_GROUPS); if (!gd->isASubGroup() && gd->isVisible() && - (!gd->isReference() || externalGroups) + (!gd->isReference() || externalGroups) ) { - append(NestingNodeContext::alloc(m_parent,gd,m_index,m_level,FALSE,FALSE,FALSE)); + append(NestingNodeContext::alloc(m_parent,gd.get(),m_index,m_level,FALSE,FALSE,FALSE,visitedClasses)); m_index++; } } } - void addModules(const GroupList &list) + void addModules(const GroupList &groups,ClassDefSet &visitedClasses) { - GroupListIterator gli(list); - const GroupDef *gd; - for (gli.toFirst();(gd=gli.current());++gli) + for (const auto &gd : groups) { if (gd->isVisible()) { - append(NestingNodeContext::alloc(m_parent,gd,m_index,m_level,FALSE,FALSE,FALSE)); + append(NestingNodeContext::alloc(m_parent,gd,m_index,m_level,FALSE,FALSE,FALSE,visitedClasses)); m_index++; } } } - void addDerivedClasses(const BaseClassList *bcl,bool hideSuper) + void addDerivedClasses(const BaseClassList &bcl,bool hideSuper,ClassDefSet &visitedClasses) { - if (bcl==0) return; - BaseClassListIterator bcli(*bcl); - BaseClassDef *bcd; - for (bcli.toFirst() ; (bcd=bcli.current()) ; ++bcli) + for (const auto &bcd : bcl) { - const ClassDef *cd=bcd->classDef; + const ClassDef *cd=bcd.classDef; if (cd->getLanguage()==SrcLangExt_VHDL && (VhdlDocGen::VhdlClasses)cd->protection()!=VhdlDocGen::ENTITYCLASS) { continue; @@ -6705,17 +6627,15 @@ class NestingContext::Private : public GenericNodeListContext if (cd->isVisibleInHierarchy() && b) { - NestingNodeContext *tnc = NestingNodeContext::alloc(m_parent,cd,m_index,m_level,TRUE,TRUE,hideSuper); + NestingNodeContext *tnc = NestingNodeContext::alloc(m_parent,cd,m_index,m_level,TRUE,TRUE,hideSuper,visitedClasses); append(tnc); m_index++; } } } - void addClassHierarchy(const ClassSDict &classSDict,bool) + void addClassHierarchy(const ClassLinkedMap &classLinkedMap,ClassDefSet &visitedClasses) { - ClassSDict::Iterator cli(classSDict); - const ClassDef *cd; - for (cli.toFirst();(cd=cli.current());++cli) + for (const auto &cd : classLinkedMap) { bool b; if (cd->getLanguage()==SrcLangExt_VHDL) @@ -6735,7 +6655,7 @@ class NestingContext::Private : public GenericNodeListContext if (cd->isVisibleInHierarchy()) // should it be visible { // new root level class - NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,cd,m_index,m_level,TRUE,TRUE,cd->isVisited()); + NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,cd.get(),m_index,m_level,TRUE,TRUE,FALSE,visitedClasses); append(nnc); m_index++; } @@ -6760,12 +6680,12 @@ NestingContext::~NestingContext() } // TemplateListIntf -int NestingContext::count() const +uint NestingContext::count() const { return p->count(); } -TemplateVariant NestingContext::at(int index) const +TemplateVariant NestingContext::at(uint index) const { return p->at(index); } @@ -6775,59 +6695,74 @@ TemplateListIntf::ConstIterator *NestingContext::createIterator() const return p->createIterator(); } -void NestingContext::addClasses(const ClassSDict &clDict,bool rootOnly) +void NestingContext::addClasses(const ClassLinkedRefMap &clLinkedRefMap,bool rootOnly,ClassDefSet &visitedClasses) { - p->addClasses(clDict,rootOnly); + p->addClasses(clLinkedRefMap,rootOnly,visitedClasses); } -void NestingContext::addNamespaces(const NamespaceSDict &nsDict,bool rootOnly,bool addClasses) +void NestingContext::addClasses(const ClassLinkedMap &clLinkedMap,bool rootOnly,ClassDefSet &visitedClasses) { - p->addNamespaces(nsDict,rootOnly,addClasses); + p->addClasses(clLinkedMap,rootOnly,visitedClasses); } -void NestingContext::addDirs(const DirSDict &dirs) +void NestingContext::addNamespaces(const NamespaceLinkedMap &nsLinkedMap,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses) { - p->addDirs(dirs); + p->addNamespaces(nsLinkedMap,rootOnly,addClasses,visitedClasses); } -void NestingContext::addDirs(const DirList &dirs) +void NestingContext::addNamespaces(const NamespaceLinkedRefMap &nsLinkedRefMap,bool rootOnly,bool addClasses,ClassDefSet &visitedClasses) { - p->addDirs(dirs); + p->addNamespaces(nsLinkedRefMap,rootOnly,addClasses,visitedClasses); } -void NestingContext::addFiles(const FileNameList &files) +void NestingContext::addDirs(const DirLinkedMap &dirs,ClassDefSet &visitedClasses) { - p->addFiles(files); + p->addDirs(dirs,visitedClasses); } -void NestingContext::addFiles(const FileList &files) +void NestingContext::addDirs(const DirList &dirs,ClassDefSet &visitedClasses) { - p->addFiles(files); + p->addDirs(dirs,visitedClasses); } -void NestingContext::addPages(const PageSDict &pages,bool rootOnly) +void NestingContext::addFiles(const FileNameLinkedMap &files,ClassDefSet &visitedClasses) { - p->addPages(pages,rootOnly); + p->addFiles(files,visitedClasses); } -void NestingContext::addModules(const GroupSDict &modules) +void NestingContext::addFiles(const FileList &files,ClassDefSet &visitedClasses) { - p->addModules(modules); + p->addFiles(files,visitedClasses); } -void NestingContext::addModules(const GroupList &modules) +void NestingContext::addPages(const PageLinkedMap &pages,bool rootOnly,ClassDefSet &visitedClasses) { - p->addModules(modules); + p->addPages(pages,rootOnly,visitedClasses); } -void NestingContext::addClassHierarchy(const ClassSDict &classSDict,bool rootOnly) +void NestingContext::addPages(const PageLinkedRefMap &pages,bool rootOnly,ClassDefSet &visitedClasses) { - p->addClassHierarchy(classSDict,rootOnly); + p->addPages(pages,rootOnly,visitedClasses); } -void NestingContext::addDerivedClasses(const BaseClassList *bcl,bool hideSuper) +void NestingContext::addModules(const GroupLinkedMap &modules,ClassDefSet &visitedClasses) { - p->addDerivedClasses(bcl,hideSuper); + p->addModules(modules,visitedClasses); +} + +void NestingContext::addModules(const GroupList &modules,ClassDefSet &visitedClasses) +{ + p->addModules(modules,visitedClasses); +} + +void NestingContext::addClassHierarchy(const ClassLinkedMap &classLinkedMap,ClassDefSet &visitedClasses) +{ + p->addClassHierarchy(classLinkedMap,visitedClasses); +} + +void NestingContext::addDerivedClasses(const BaseClassList &bcl,bool hideSuper,ClassDefSet &visitedClasses) +{ + p->addDerivedClasses(bcl,hideSuper,visitedClasses); } //------------------------------------------------------------------------ @@ -6840,14 +6775,9 @@ class ClassTreeContext::Private Private() { m_classTree.reset(NestingContext::alloc(0,0)); - if (Doxygen::namespaceSDict) - { - m_classTree->addNamespaces(*Doxygen::namespaceSDict,TRUE,TRUE); - } - if (Doxygen::classSDict) - { - m_classTree->addClasses(*Doxygen::classSDict,TRUE); - } + ClassDefSet visitedClasses; + m_classTree->addNamespaces(*Doxygen::namespaceLinkedMap,TRUE,TRUE,visitedClasses); + m_classTree->addClasses(*Doxygen::classLinkedMap,TRUE,visitedClasses); //%% Nesting tree static bool init=FALSE; if (!init) @@ -6961,15 +6891,13 @@ TemplateVariant ClassTreeContext::get(const char *name) const class NamespaceListContext::Private : public GenericNodeListContext { public: - void addNamespaces(const NamespaceSDict &nsDict) + void addNamespaces(const NamespaceLinkedMap &nsLinkedMap) { - NamespaceSDict::Iterator nli(nsDict); - const NamespaceDef *nd; - for (nli.toFirst();(nd=nli.current());++nli) + for (const auto &nd : nsLinkedMap) { if (nd->isLinkableInProject()) { - append(NamespaceContext::alloc(nd)); + append(NamespaceContext::alloc(nd.get())); } } } @@ -6978,7 +6906,7 @@ class NamespaceListContext::Private : public GenericNodeListContext NamespaceListContext::NamespaceListContext() : RefCountedContext("NamespaceListContext") { p = new Private; - p->addNamespaces(*Doxygen::namespaceSDict); + p->addNamespaces(*Doxygen::namespaceLinkedMap); } NamespaceListContext::~NamespaceListContext() @@ -6987,12 +6915,12 @@ NamespaceListContext::~NamespaceListContext() } // TemplateListIntf -int NamespaceListContext::count() const +uint NamespaceListContext::count() const { return p->count(); } -TemplateVariant NamespaceListContext::at(int index) const +TemplateVariant NamespaceListContext::at(uint index) const { return p->at(index); } @@ -7012,10 +6940,8 @@ class NamespaceTreeContext::Private Private() { m_namespaceTree.reset(NestingContext::alloc(0,0)); - if (Doxygen::namespaceSDict) - { - m_namespaceTree->addNamespaces(*Doxygen::namespaceSDict,TRUE,FALSE); - } + ClassDefSet visitedClasses; + m_namespaceTree->addNamespaces(*Doxygen::namespaceLinkedMap,TRUE,FALSE,visitedClasses); //%% Nesting tree static bool init=FALSE; if (!init) @@ -7131,23 +7057,19 @@ TemplateVariant NamespaceTreeContext::get(const char *name) const class FileListContext::Private : public GenericNodeListContext { public: - void addFiles(const FileNameList &fnList) + void addFiles(const FileNameLinkedMap &fnMap) { // TODO: if FULL_PATH_NAMES is enabled, the ordering should be dir+file - FileNameListIterator fnli(fnList); - FileName *fn; - for (fnli.toFirst();(fn=fnli.current());++fnli) + for (const auto &fn : fnMap) { - FileNameIterator fni(*fn); - const FileDef *fd; - for (fni.toFirst();(fd=fni.current());++fni) + for (const auto &fd : *fn) { bool doc = fd->isLinkableInProject(); bool src = fd->generateSourceFile(); bool nameOk = !fd->isDocumentationFile(); if (nameOk && (doc || src) && !fd->isReference()) { - append(FileContext::alloc(fd)); + append(FileContext::alloc(fd.get())); } } } @@ -7157,7 +7079,7 @@ class FileListContext::Private : public GenericNodeListContext FileListContext::FileListContext() : RefCountedContext("FileListContext") { p = new Private; - if (Doxygen::inputNameList) p->addFiles(*Doxygen::inputNameList); + if (Doxygen::inputNameLinkedMap) p->addFiles(*Doxygen::inputNameLinkedMap); } FileListContext::~FileListContext() @@ -7166,12 +7088,12 @@ FileListContext::~FileListContext() } // TemplateListIntf -int FileListContext::count() const +uint FileListContext::count() const { return p->count(); } -TemplateVariant FileListContext::at(int index) const +TemplateVariant FileListContext::at(uint index) const { return p->at(index); } @@ -7189,11 +7111,9 @@ class DirListContext::Private : public GenericNodeListContext public: Private() { - const DirDef *dir; - DirSDict::Iterator sdi(*Doxygen::directories); - for (sdi.toFirst();(dir=sdi.current());++sdi) + for (const auto &dir : *Doxygen::dirLinkedMap) { - append(DirContext::alloc(dir)); + append(DirContext::alloc(dir.get())); } } }; @@ -7209,12 +7129,12 @@ DirListContext::~DirListContext() } // TemplateListIntf -int DirListContext::count() const +uint DirListContext::count() const { return p->count(); } -TemplateVariant DirListContext::at(int index) const +TemplateVariant DirListContext::at(uint index) const { return p->at(index); } @@ -7257,12 +7177,12 @@ UsedFilesContext::~UsedFilesContext() } // TemplateListIntf -int UsedFilesContext::count() const +uint UsedFilesContext::count() const { return p->count(); } -TemplateVariant UsedFilesContext::at(int index) const +TemplateVariant UsedFilesContext::at(uint index) const { return p->at(index); } @@ -7288,13 +7208,11 @@ class FileTreeContext::Private { // Add dirs tree m_dirFileTree.reset(NestingContext::alloc(0,0)); - if (Doxygen::directories) - { - m_dirFileTree->addDirs(*Doxygen::directories); - } - if (Doxygen::inputNameList) + ClassDefSet visitedClasses; + m_dirFileTree->addDirs(*Doxygen::dirLinkedMap,visitedClasses); + if (Doxygen::inputNameLinkedMap) { - m_dirFileTree->addFiles(*Doxygen::inputNameList); + m_dirFileTree->addFiles(*Doxygen::inputNameLinkedMap,visitedClasses); } //%% DirFile tree: static bool init=FALSE; @@ -7397,14 +7315,12 @@ TemplateVariant FileTreeContext::get(const char *name) const class PageTreeContext::Private { public: - Private(const PageSDict *pages) + Private(const PageLinkedMap &pages) { m_pageTree.reset(NestingContext::alloc(0,0)); + ClassDefSet visitedClasses; // Add pages - if (pages) - { - m_pageTree->addPages(*pages,TRUE); - } + m_pageTree->addPages(pages,TRUE,visitedClasses); //%% PageNodeList tree: static bool init=FALSE; @@ -7485,7 +7401,7 @@ class PageTreeContext::Private PropertyMapper<PageTreeContext::Private> PageTreeContext::Private::s_inst; -PageTreeContext::PageTreeContext(const PageSDict *pages) : RefCountedContext("PageTreeContext") +PageTreeContext::PageTreeContext(const PageLinkedMap &pages) : RefCountedContext("PageTreeContext") { p = new Private(pages); } @@ -7506,24 +7422,22 @@ TemplateVariant PageTreeContext::get(const char *name) const class PageListContext::Private : public GenericNodeListContext { public: - void addPages(const PageSDict &pages) + void addPages(const PageLinkedMap &pages) { - PageSDict::Iterator pdi(pages); - const PageDef *pd=0; - for (pdi.toFirst();(pd=pdi.current());++pdi) + for (const auto &pd : pages) { if (!pd->getGroupDef() && !pd->isReference()) { - append(PageContext::alloc(pd,FALSE,FALSE)); + append(PageContext::alloc(pd.get(),FALSE,FALSE)); } } } }; -PageListContext::PageListContext(const PageSDict *pages) : RefCountedContext("PageListContext") +PageListContext::PageListContext(const PageLinkedMap &pages) : RefCountedContext("PageListContext") { p = new Private; - if (pages) p->addPages(*pages); + p->addPages(pages); } PageListContext::~PageListContext() @@ -7532,12 +7446,12 @@ PageListContext::~PageListContext() } // TemplateListIntf -int PageListContext::count() const +uint PageListContext::count() const { return p->count(); } -TemplateVariant PageListContext::at(int index) const +TemplateVariant PageListContext::at(uint index) const { return p->at(index); } @@ -7555,16 +7469,11 @@ class ExampleListContext::Private : public GenericNodeListContext public: Private() { - if (Doxygen::exampleSDict) + for (const auto &pd : *Doxygen::exampleLinkedMap) { - PageSDict::Iterator pdi(*Doxygen::exampleSDict); - const PageDef *pd=0; - for (pdi.toFirst();(pd=pdi.current());++pdi) + if (!pd->getGroupDef() && !pd->isReference()) { - if (!pd->getGroupDef() && !pd->isReference()) - { - append(PageContext::alloc(pd,FALSE,TRUE)); - } + append(PageContext::alloc(pd.get(),FALSE,TRUE)); } } } @@ -7581,12 +7490,12 @@ ExampleListContext::~ExampleListContext() } // TemplateListIntf -int ExampleListContext::count() const +uint ExampleListContext::count() const { return p->count(); } -TemplateVariant ExampleListContext::at(int index) const +TemplateVariant ExampleListContext::at(uint index) const { return p->at(index); } @@ -7604,13 +7513,11 @@ class ModuleListContext::Private : public GenericNodeListContext public: void addModules() { - GroupSDict::Iterator gli(*Doxygen::groupSDict); - const GroupDef *gd; - for (gli.toFirst();(gd=gli.current());++gli) + for (const auto &gd : *Doxygen::groupLinkedMap) { if (!gd->isReference()) { - append(ModuleContext::alloc(gd)); + append(ModuleContext::alloc(gd.get())); } } } @@ -7628,12 +7535,12 @@ ModuleListContext::~ModuleListContext() } // TemplateListIntf -int ModuleListContext::count() const +uint ModuleListContext::count() const { return p->count(); } -TemplateVariant ModuleListContext::at(int index) const +TemplateVariant ModuleListContext::at(uint index) const { return p->at(index); } @@ -7653,11 +7560,9 @@ class ModuleTreeContext::Private Private() { m_moduleTree.reset(NestingContext::alloc(0,0)); + ClassDefSet visitedClasses; // Add modules - if (Doxygen::groupSDict) - { - m_moduleTree->addModules(*Doxygen::groupSDict); - } + m_moduleTree->addModules(*Doxygen::groupLinkedMap,visitedClasses); //%% ModuleList tree: static bool init=FALSE; @@ -7796,11 +7701,11 @@ class NavPathElemContext::Private QCString text = m_def->localName(); if (type==Definition::TypeGroup) { - text = (dynamic_cast<const GroupDef*>(m_def))->groupTitle(); + text = (toGroupDef(m_def))->groupTitle(); } - else if (type==Definition::TypePage && ((dynamic_cast<const PageDef*>(m_def))->hasTitle())) + else if (type==Definition::TypePage && ((toPageDef(m_def))->hasTitle())) { - text = (dynamic_cast<const PageDef*>(m_def))->title(); + text = (toPageDef(m_def))->title(); } else if (type==Definition::TypeClass) { @@ -7858,11 +7763,9 @@ class ExampleTreeContext::Private Private() { m_exampleTree.reset(NestingContext::alloc(0,0)); + ClassDefSet visitedClasses; // Add pages - if (Doxygen::exampleSDict) - { - m_exampleTree->addPages(*Doxygen::exampleSDict,TRUE); - } + m_exampleTree->addPages(*Doxygen::exampleLinkedMap,TRUE,visitedClasses); static bool init=FALSE; if (!init) @@ -7997,21 +7900,17 @@ class GlobalsIndexContext::Private if (!listRef) { TemplateList *list = TemplateList::alloc(); - MemberName *mn; - MemberNameSDict::Iterator fnli(*Doxygen::functionNameSDict); - for (fnli.toFirst();(mn=fnli.current());++fnli) + for (const auto &mn : *Doxygen::functionNameLinkedMap) { - MemberDef *md; - MemberNameIterator mni(*mn); - for (mni.toFirst();(md=mni.current());++mni) + for (const auto &md : *mn) { const FileDef *fd=md->getFileDef(); if (fd && fd->isLinkableInProject() && !md->name().isEmpty() && !md->getNamespaceDef() && md->isLinkableInProject()) { - if (filter==0 || (md->*filter)()) + if (filter==0 || (md.get()->*filter)()) { - list->append(MemberContext::alloc(md)); + list->append(MemberContext::alloc(md.get())); } } } @@ -8154,21 +8053,17 @@ class ClassMembersIndexContext::Private if (!listRef) { TemplateList *list = TemplateList::alloc(); - MemberName *mn; - MemberNameSDict::Iterator mnli(*Doxygen::memberNameSDict); - for (mnli.toFirst();(mn=mnli.current());++mnli) + for (const auto &mn : *Doxygen::memberNameLinkedMap) { - MemberDef *md; - MemberNameIterator mni(*mn); - for (mni.toFirst();(md=mni.current());++mni) + for (const auto &md : *mn) { const ClassDef *cd = md->getClassDef(); if (cd && cd->isLinkableInProject() && cd->templateMaster()==0 && md->isLinkableInProject() && !md->name().isEmpty()) { - if (filter==0 || (md->*filter)()) + if (filter==0 || (md.get()->*filter)()) { - list->append(MemberContext::alloc(md)); + list->append(MemberContext::alloc(md.get())); } } } @@ -8313,21 +8208,17 @@ class NamespaceMembersIndexContext::Private if (!listRef) { TemplateList *list = TemplateList::alloc(); - MemberName *mn; - MemberNameSDict::Iterator fnli(*Doxygen::functionNameSDict); - for (fnli.toFirst();(mn=fnli.current());++fnli) + for (const auto &mn : *Doxygen::functionNameLinkedMap) { - MemberDef *md; - MemberNameIterator mni(*mn); - for (mni.toFirst();(md=mni.current());++mni) + for (const auto &md : *mn) { const NamespaceDef *nd=md->getNamespaceDef(); if (nd && nd->isLinkableInProject() && !md->name().isEmpty() && md->isLinkableInProject()) { - if (filter==0 || (md->*filter)()) + if (filter==0 || (md.get()->*filter)()) { - list->append(MemberContext::alloc(md)); + list->append(MemberContext::alloc(md.get())); } } } @@ -8562,29 +8453,24 @@ class InheritanceListContext::Private : public GenericNodeListContext } }; -InheritanceListContext::InheritanceListContext(const BaseClassList *list, bool baseClasses) : RefCountedContext("InheritanceListContext") +InheritanceListContext::InheritanceListContext(const BaseClassList &list, bool baseClasses) : RefCountedContext("InheritanceListContext") { p = new Private; - if (list) + for (const auto &bcd : list) { - BaseClassListIterator li(*list); - BaseClassDef *bcd; - for (li.toFirst();(bcd=li.current());++li) + const ClassDef *cd=bcd.classDef; + QCString name; + if (baseClasses) { - const ClassDef *cd=bcd->classDef; - QCString name; - if (baseClasses) - { - name = insertTemplateSpecifierInScope( - cd->displayName(),bcd->templSpecifiers); - } - else - { - name = cd->displayName(); - } - //printf("InheritanceListContext: adding %s baseClass=%d\n",name.data(),baseClasses); - p->addClass(cd,name); + name = insertTemplateSpecifierInScope( + cd->displayName(),bcd.templSpecifiers); } + else + { + name = cd->displayName(); + } + //printf("InheritanceListContext: adding %s baseClass=%d\n",name.data(),baseClasses); + p->addClass(cd,name); } } @@ -8594,12 +8480,12 @@ InheritanceListContext::~InheritanceListContext() } // TemplateListIntf -int InheritanceListContext::count() const +uint InheritanceListContext::count() const { return p->count(); } -TemplateVariant InheritanceListContext::at(int index) const +TemplateVariant InheritanceListContext::at(uint index) const { return p->at(index); } @@ -8615,7 +8501,7 @@ TemplateListIntf::ConstIterator *InheritanceListContext::createIterator() const class MemberListContext::Private : public GenericNodeListContext { public: - void addMember(MemberDef *md) + void addMember(const MemberDef *md) { append(MemberContext::alloc(md)); } @@ -8646,22 +8532,14 @@ MemberListContext::MemberListContext(const MemberList *list) : RefCountedContext } } -MemberListContext::MemberListContext(MemberSDict *list,bool doSort) : RefCountedContext("MemberListContext") +MemberListContext::MemberListContext(std::vector<const MemberDef *> &&ml) : RefCountedContext("MemberListContext") { p = new Private; - if (list) + for (const auto &md : ml) { - if (doSort) - { - list->sort(); - } - MemberSDict::Iterator it(*list); - MemberDef *md; - for (it.toFirst();(md=it.current());++it) - { - p->addMember(md); - } + p->addMember(md); } + ml.clear(); } MemberListContext::~MemberListContext() @@ -8670,12 +8548,12 @@ MemberListContext::~MemberListContext() } // TemplateListIntf -int MemberListContext::count() const +uint MemberListContext::count() const { return p->count(); } -TemplateVariant MemberListContext::at(int index) const +TemplateVariant MemberListContext::at(uint index) const { return p->at(index); } @@ -8714,7 +8592,7 @@ class MemberInfoContext::Private } TemplateVariant protection() const { - switch (m_memberInfo->prot) + switch (m_memberInfo->prot()) { case ::Public: return "public"; case ::Protected: return "protected"; @@ -8725,7 +8603,7 @@ class MemberInfoContext::Private } TemplateVariant virtualness() const { - switch (m_memberInfo->virt) + switch (m_memberInfo->virt()) { case ::Normal: return "normal"; case ::Virtual: return "virtual"; @@ -8735,13 +8613,13 @@ class MemberInfoContext::Private } TemplateVariant ambiguityScope() const { - return m_memberInfo->ambiguityResolutionScope; + return m_memberInfo->ambiguityResolutionScope(); } TemplateVariant member() const { - if (!m_member && m_memberInfo->memberDef) + if (!m_member && m_memberInfo->memberDef()) { - m_member.reset(MemberContext::alloc(m_memberInfo->memberDef)); + m_member.reset(MemberContext::alloc(m_memberInfo->memberDef())); } if (m_member) { @@ -8783,31 +8661,24 @@ TemplateVariant MemberInfoContext::get(const char *name) const class AllMembersListContext::Private : public GenericNodeListContext { public: - Private(const MemberNameInfoSDict *ml) + Private(const MemberNameInfoLinkedMap &ml) { - if (ml) + static bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS); + for (auto &mni : ml) { - static bool hideUndocMembers = Config_getBool(HIDE_UNDOC_MEMBERS); - MemberNameInfoSDict::Iterator mnii(*ml); - MemberNameInfo *mni; - for (mnii.toFirst();(mni=mnii.current());++mnii) + for (auto &mi : *mni) { - MemberNameInfoIterator mnii2(*mni); - MemberInfo *mi; - for (mnii2.toFirst();(mi=mnii2.current());++mnii2) + const MemberDef *md=mi->memberDef(); + const ClassDef *cd=md->getClassDef(); + if (cd && !md->isAnonymous()) { - MemberDef *md=mi->memberDef; - const ClassDef *cd=md->getClassDef(); - if (cd && !md->isAnonymous()) + if ((cd->isLinkable() && md->isLinkable()) || + (!cd->isArtificial() && !hideUndocMembers && + (protectionLevelVisible(md->protection()) || md->isFriend()) + ) + ) { - if ((cd->isLinkable() && md->isLinkable()) || - (!cd->isArtificial() && !hideUndocMembers && - (protectionLevelVisible(md->protection()) || md->isFriend()) - ) - ) - { - append(MemberInfoContext::alloc(mi)); - } + append(MemberInfoContext::alloc(mi.get())); } } } @@ -8815,12 +8686,8 @@ class AllMembersListContext::Private : public GenericNodeListContext } }; -AllMembersListContext::AllMembersListContext() : RefCountedContext("AllMembersListContext") -{ - p = new Private(0); -} - -AllMembersListContext::AllMembersListContext(const MemberNameInfoSDict *ml) : RefCountedContext("AllMembersListContext") +AllMembersListContext::AllMembersListContext(const MemberNameInfoLinkedMap &ml) + : RefCountedContext("AllMembersListContext") { p = new Private(ml); } @@ -8831,12 +8698,12 @@ AllMembersListContext::~AllMembersListContext() } // TemplateListIntf -int AllMembersListContext::count() const +uint AllMembersListContext::count() const { return p->count(); } -TemplateVariant AllMembersListContext::at(int index) const +TemplateVariant AllMembersListContext::at(uint index) const { return p->at(index); } @@ -8899,7 +8766,7 @@ class MemberGroupInfoContext::Private { if (!m_cache.memberGroups) { - m_cache.memberGroups.reset(MemberGroupListContext::alloc(m_def,m_relPath,0)); + m_cache.memberGroups.reset(MemberGroupListContext::alloc()); } return m_cache.memberGroups.get(); } @@ -8976,33 +8843,23 @@ MemberGroupListContext::MemberGroupListContext() : RefCountedContext("MemberGrou p = new Private; } -MemberGroupListContext::MemberGroupListContext(const Definition *def,const QCString &relPath,const MemberGroupList *list) : RefCountedContext("MemberGroupListContext") +MemberGroupListContext::MemberGroupListContext(const Definition *def,const QCString &relPath,const MemberGroupRefList &list) : RefCountedContext("MemberGroupListContext") { p = new Private; - if (list) + for (const auto &mg : list) { - MemberGroupListIterator mgli(*list); - MemberGroup *mg; - for (;(mg=mgli.current());++mgli) - { - p->addMemberGroup(def,relPath,mg); - } + p->addMemberGroup(def,relPath,mg); } } -MemberGroupListContext::MemberGroupListContext(const Definition *def,const QCString &relPath,const MemberGroupSDict *dict,bool subGrouping) : RefCountedContext("MemberGroupListContext") +MemberGroupListContext::MemberGroupListContext(const Definition *def,const QCString &relPath,const MemberGroupList &list,bool subGrouping) : RefCountedContext("MemberGroupListContext") { p = new Private; - if (dict) + for (const auto &mg : list) { - MemberGroupSDict::Iterator di(*dict); - const MemberGroup *mg; - for (di.toFirst();(mg=di.current());++di) + if (!mg->allMembersInSameSection() || !subGrouping) { - if (!mg->allMembersInSameSection() || !subGrouping) - { - p->addMemberGroup(def,relPath,mg); - } + p->addMemberGroup(def,relPath,mg.get()); } } } @@ -9013,12 +8870,12 @@ MemberGroupListContext::~MemberGroupListContext() } // TemplateListIntf -int MemberGroupListContext::count() const +uint MemberGroupListContext::count() const { return p->count(); } -TemplateVariant MemberGroupListContext::at(int index) const +TemplateVariant MemberGroupListContext::at(uint index) const { return p->at(index); } @@ -9093,7 +8950,7 @@ class MemberListInfoContext::Private m_def->definitionType()==Definition::TypeClass) { InheritedMemberInfoListContext *ctx = InheritedMemberInfoListContext::alloc(); - ctx->addMemberList(dynamic_cast<const ClassDef*>(m_def),m_memberList->listType(),m_title,FALSE); + ctx->addMemberList(toClassDef(m_def),m_memberList->listType(),m_title,FALSE); m_cache.inherited.reset(ctx); } if (m_cache.inherited) @@ -9261,38 +9118,30 @@ class InheritedMemberInfoListContext::Private : public GenericNodeListContext if (ml) { addMemberList(inheritedFrom,ml,combinedList); - if (ml->getMemberGroupList()) + for (const auto *mg : ml->getMemberGroupList()) { - MemberGroupListIterator mgli(*ml->getMemberGroupList()); - MemberGroup *mg; - for (mgli.toFirst();(mg=mgli.current());++mgli) - { - addMemberList(inheritedFrom,mg->members(),combinedList); - } + addMemberList(inheritedFrom,mg->members(),combinedList); } } } void addMemberGroupsOfClass(const ClassDef *inheritedFrom, const ClassDef *cd,MemberListType lt,MemberList *combinedList) { - if (cd->getMemberGroupSDict()) + // TODO: why this there no addMemberGroupsOfNamespace, addMembersGroupsOfFile, + // addMemberGroupsOfGroup? + for (const auto &mg: cd->getMemberGroups()) { - MemberGroupSDict::Iterator mgli(*cd->getMemberGroupSDict()); - MemberGroup *mg; - for (;(mg=mgli.current());++mgli) + if (mg->members() && (!mg->allMembersInSameSection() || !cd->subGrouping())) // group is in its own section { - if (mg->members() && (!mg->allMembersInSameSection() || !cd->subGrouping())) // group is in its own section + MemberListIterator li(*mg->members()); + MemberDef *md; + for (li.toFirst();(md=li.current());++li) { - MemberListIterator li(*mg->members()); - MemberDef *md; - for (li.toFirst();(md=li.current());++li) + if (lt==md->getSectionList(mg->container())->listType() && + !md->isReimplementedBy(inheritedFrom) && + md->isBriefSectionVisible()) { - if (lt==md->getSectionList()->listType() && - !md->isReimplementedBy(inheritedFrom) && - md->isBriefSectionVisible()) - { - combinedList->append(md); - } + combinedList->append(md); } } } @@ -9319,31 +9168,26 @@ class InheritedMemberInfoListContext::Private : public GenericNodeListContext int lt2, const QCString &title,bool additionalList, QPtrDict<void> *visitedClasses) { - if (cd->baseClasses()) + for (const auto &ibcd : cd->baseClasses()) { - BaseClassListIterator it(*cd->baseClasses()); - BaseClassDef *ibcd; - for (it.toFirst();(ibcd=it.current());++it) + ClassDef *icd=ibcd.classDef; + if (icd->isLinkable()) { - ClassDef *icd=ibcd->classDef; - if (icd->isLinkable()) + int lt1,lt3; + convertProtectionLevel(lt,ibcd.prot,<1,<3); + if (lt2==-1 && lt3!=-1) { - int lt1,lt3; - convertProtectionLevel(lt,ibcd->prot,<1,<3); - if (lt2==-1 && lt3!=-1) - { - lt2=lt3; - } - if (visitedClasses->find(icd)==0) + lt2=lt3; + } + if (visitedClasses->find(icd)==0) + { + visitedClasses->insert(icd,icd); // guard for multiple virtual inheritance + if (lt1!=-1) { - visitedClasses->insert(icd,icd); // guard for multiple virtual inheritance - if (lt1!=-1) - { - // add member info for members of cd with list type lt - addInheritedMembers(inheritedFrom,icd,lt,(MemberListType)lt1,lt2,title,additionalList); - // recurse down the inheritance tree - findInheritedMembers(inheritedFrom,icd,(MemberListType)lt1,lt2,title,additionalList,visitedClasses); - } + // add member info for members of cd with list type lt + addInheritedMembers(inheritedFrom,icd,lt,(MemberListType)lt1,lt2,title,additionalList); + // recurse down the inheritance tree + findInheritedMembers(inheritedFrom,icd,(MemberListType)lt1,lt2,title,additionalList,visitedClasses); } } } @@ -9376,12 +9220,12 @@ InheritedMemberInfoListContext::~InheritedMemberInfoListContext() } // TemplateListIntf -int InheritedMemberInfoListContext::count() const +uint InheritedMemberInfoListContext::count() const { return p->count(); } -TemplateVariant InheritedMemberInfoListContext::at(int index) const +TemplateVariant InheritedMemberInfoListContext::at(uint index) const { return p->at(index); } @@ -9458,7 +9302,7 @@ class ArgumentContext::Private TemplateVariant namePart() const { QCString result = m_argument.attrib; - int l = result.length(); + uint l = result.length(); if (l>2 && result.at(0)=='[' && result.at(l-1)==']') { result = result.mid(1,l-2); @@ -9467,7 +9311,7 @@ class ArgumentContext::Private return result; } private: - const Argument &m_argument; + Argument m_argument; const Definition *m_def; QCString m_relPath; struct Cachable @@ -9529,12 +9373,12 @@ ArgumentListContext::~ArgumentListContext() } // TemplateListIntf -int ArgumentListContext::count() const +uint ArgumentListContext::count() const { return p->count(); } -TemplateVariant ArgumentListContext::at(int index) const +TemplateVariant ArgumentListContext::at(uint index) const { return p->at(index); } @@ -9600,7 +9444,7 @@ class SymbolContext::Private const Definition *prev = m_prevDef; const Definition *nextScope = next ? next->getOuterScope() : 0; const Definition *prevScope = prev ? prev->getOuterScope() : 0; - const MemberDef *md = dynamic_cast<const MemberDef*>(m_def); + const MemberDef *md = toMemberDef(m_def); bool isFunctionLike = md && (md->isFunction() || md->isSlot() || md->isSignal()); bool overloadedFunction = isFunctionLike && ((prevScope!=0 && scope==prevScope) || (scope && scope==nextScope)); @@ -9696,25 +9540,26 @@ TemplateVariant SymbolContext::get(const char *name) const class SymbolListContext::Private : public GenericNodeListContext { public: - Private(const SearchDefinitionList *sdl) + Private(const SearchIndexList::const_iterator &start, + const SearchIndexList::const_iterator &end) { - QListIterator<Definition> li(*sdl); - const Definition *def; const Definition *prev = 0; - for (li.toFirst();(def=li.current());) + for (auto it = start; it!=end;) { - ++li; - const Definition *next = li.current(); + const Definition *def = *it; + ++it; + const Definition *next = it!=end ? *it : 0; append(SymbolContext::alloc(def,prev,next)); prev = def; } } }; -SymbolListContext::SymbolListContext(const SearchDefinitionList *sdl) +SymbolListContext::SymbolListContext(const SearchIndexList::const_iterator &start, + const SearchIndexList::const_iterator &end) : RefCountedContext("SymbolListContext") { - p = new Private(sdl); + p = new Private(start,end); } SymbolListContext::~SymbolListContext() @@ -9723,12 +9568,12 @@ SymbolListContext::~SymbolListContext() } // TemplateListIntf -int SymbolListContext::count() const +uint SymbolListContext::count() const { return p->count(); } -TemplateVariant SymbolListContext::at(int index) const +TemplateVariant SymbolListContext::at(uint index) const { return p->at(index); } @@ -9745,7 +9590,8 @@ TemplateListIntf::ConstIterator *SymbolListContext::createIterator() const class SymbolGroupContext::Private { public: - Private(const SearchDefinitionList *sdl) : m_sdl(sdl) + Private(const SearchIndexList::const_iterator &start, + const SearchIndexList::const_iterator &end) : m_start(start), m_end(end) { static bool init=FALSE; if (!init) @@ -9762,22 +9608,23 @@ class SymbolGroupContext::Private } TemplateVariant id() const { - return m_sdl->id(); + return searchId(*m_start); } TemplateVariant name() const { - return m_sdl->name(); + return searchName(*m_start); } TemplateVariant symbolList() const { if (!m_cache.symbolList) { - m_cache.symbolList.reset(SymbolListContext::alloc(m_sdl)); + m_cache.symbolList.reset(SymbolListContext::alloc(m_start,m_end)); } return m_cache.symbolList.get(); } private: - const SearchDefinitionList *m_sdl; + SearchIndexList::const_iterator m_start; + SearchIndexList::const_iterator m_end; struct Cachable { SharedPtr<SymbolListContext> symbolList; @@ -9789,10 +9636,11 @@ class SymbolGroupContext::Private PropertyMapper<SymbolGroupContext::Private> SymbolGroupContext::Private::s_inst; -SymbolGroupContext::SymbolGroupContext(const SearchDefinitionList *sdl) +SymbolGroupContext::SymbolGroupContext(const SearchIndexList::const_iterator &start, + const SearchIndexList::const_iterator &end) : RefCountedContext("SymbolGroupContext") { - p = new Private(sdl); + p = new Private(start,end); } SymbolGroupContext::~SymbolGroupContext() @@ -9811,18 +9659,30 @@ TemplateVariant SymbolGroupContext::get(const char *name) const class SymbolGroupListContext::Private : public GenericNodeListContext { public: - Private(const SearchIndexList *sil) + Private(const SearchIndexList &sil) { - SDict<SearchDefinitionList>::Iterator li(*sil); - SearchDefinitionList *dl; - for (li.toFirst();(dl=li.current());++li) + QCString lastName; + auto it = sil.begin(); + auto it_begin = it; + while (it!=sil.end()) { - append(SymbolGroupContext::alloc(dl)); + QCString name = searchName(*it); + if (name!=lastName) + { + append(SymbolGroupContext::alloc(it_begin,it)); + it_begin = it; + lastName = name; + } + ++it; + } + if (it_begin!=sil.end()) + { + append(SymbolGroupContext::alloc(it_begin,sil.end())); } } }; -SymbolGroupListContext::SymbolGroupListContext(const SearchIndexList *sil) +SymbolGroupListContext::SymbolGroupListContext(const SearchIndexList &sil) : RefCountedContext("SymbolGroupListContext") { p = new Private(sil); @@ -9834,12 +9694,12 @@ SymbolGroupListContext::~SymbolGroupListContext() } // TemplateListIntf -int SymbolGroupListContext::count() const +uint SymbolGroupListContext::count() const { return p->count(); } -TemplateVariant SymbolGroupListContext::at(int index) const +TemplateVariant SymbolGroupListContext::at(uint index) const { return p->at(index); } @@ -9856,7 +9716,9 @@ TemplateListIntf::ConstIterator *SymbolGroupListContext::createIterator() const class SymbolIndexContext::Private { public: - Private(const SearchIndexList *sl,const QCString &name) : m_searchList(sl), m_name(name) + Private(const std::string &letter, + const SearchIndexList &sl, + const QCString &name) : m_letter(letter), m_searchList(sl), m_name(name) { static bool init=FALSE; if (!init) @@ -9877,7 +9739,7 @@ class SymbolIndexContext::Private } TemplateVariant letter() const { - return QString(QChar(m_searchList->letter())).utf8(); + return m_letter; } TemplateVariant symbolGroups() const { @@ -9888,7 +9750,8 @@ class SymbolIndexContext::Private return m_cache.symbolGroups.get(); } private: - const SearchIndexList *m_searchList; + QCString m_letter; + const SearchIndexList &m_searchList; QCString m_name; struct Cachable { @@ -9901,10 +9764,10 @@ class SymbolIndexContext::Private PropertyMapper<SymbolIndexContext::Private> SymbolIndexContext::Private::s_inst; -SymbolIndexContext::SymbolIndexContext(const SearchIndexList *sl,const QCString &name) +SymbolIndexContext::SymbolIndexContext(const std::string &letter,const SearchIndexList &sl,const QCString &name) : RefCountedContext("SymbolIndexContext") { - p = new Private(sl,name); + p = new Private(letter,sl,name); } SymbolIndexContext::~SymbolIndexContext() @@ -9923,19 +9786,17 @@ TemplateVariant SymbolIndexContext::get(const char *name) const class SymbolIndicesContext::Private : public GenericNodeListContext { public: - Private(const SearchIndexInfo *info) + Private(const SearchIndexInfo &info) { // use info->symbolList to populate the list - SIntDict<SearchIndexList>::Iterator it(info->symbolList); - const SearchIndexList *sl; - for (it.toFirst();(sl=it.current());++it) // for each letter + for (const auto &kv : info.symbolMap) { - append(SymbolIndexContext::alloc(sl,info->name)); + append(SymbolIndexContext::alloc(kv.first,kv.second,info.name)); } } }; -SymbolIndicesContext::SymbolIndicesContext(const SearchIndexInfo *info) : RefCountedContext("SymbolIndicesContext") +SymbolIndicesContext::SymbolIndicesContext(const SearchIndexInfo &info) : RefCountedContext("SymbolIndicesContext") { p = new Private(info); } @@ -9946,12 +9807,12 @@ SymbolIndicesContext::~SymbolIndicesContext() } // TemplateListIntf -int SymbolIndicesContext::count() const +uint SymbolIndicesContext::count() const { return p->count(); } -TemplateVariant SymbolIndicesContext::at(int index) const +TemplateVariant SymbolIndicesContext::at(uint index) const { return p->at(index); } @@ -9968,7 +9829,7 @@ TemplateListIntf::ConstIterator *SymbolIndicesContext::createIterator() const class SearchIndexContext::Private { public: - Private(const SearchIndexInfo *info) : m_info(info) + Private(const SearchIndexInfo &info) : m_info(info) { static bool init=FALSE; if (!init) @@ -9985,11 +9846,11 @@ class SearchIndexContext::Private } TemplateVariant name() const { - return m_info->name; + return m_info.name; } TemplateVariant text() const { - return m_info->text; + return m_info.getText(); } TemplateVariant symbolIndices() const { @@ -10000,7 +9861,7 @@ class SearchIndexContext::Private return m_cache.symbolIndices.get(); } private: - const SearchIndexInfo *m_info; + const SearchIndexInfo &m_info; struct Cachable { SharedPtr<SymbolIndicesContext> symbolIndices; @@ -10012,7 +9873,7 @@ class SearchIndexContext::Private PropertyMapper<SearchIndexContext::Private> SearchIndexContext::Private::s_inst; -SearchIndexContext::SearchIndexContext(const SearchIndexInfo *info) +SearchIndexContext::SearchIndexContext(const SearchIndexInfo &info) : RefCountedContext("SearchIndexContext") { p = new Private(info); @@ -10036,10 +9897,9 @@ class SearchIndicesContext::Private : public GenericNodeListContext public: Private() { - const SearchIndexInfo *indices = getSearchIndices(); - for (int i=0;i<NUM_SEARCH_INDICES;i++) + for (const auto &si : getSearchIndices()) { - append(SearchIndexContext::alloc(&indices[i])); + append(SearchIndexContext::alloc(si)); } } }; @@ -10055,12 +9915,12 @@ SearchIndicesContext::~SearchIndicesContext() } // TemplateListIntf -int SearchIndicesContext::count() const +uint SearchIndicesContext::count() const { return p->count(); } -TemplateVariant SearchIndicesContext::at(int index) const +TemplateVariant SearchIndicesContext::at(uint index) const { return p->at(index); } @@ -10229,8 +10089,8 @@ void generateOutputViaTemplate() SharedPtr<DirListContext> dirList (DirListContext::alloc()); SharedPtr<FileListContext> fileList (FileListContext::alloc()); SharedPtr<FileTreeContext> fileTree (FileTreeContext::alloc()); - SharedPtr<PageTreeContext> pageTree (PageTreeContext::alloc(Doxygen::pageSDict)); - SharedPtr<PageListContext> pageList (PageListContext::alloc(Doxygen::pageSDict)); + SharedPtr<PageTreeContext> pageTree (PageTreeContext::alloc(*Doxygen::pageLinkedMap)); + SharedPtr<PageListContext> pageList (PageListContext::alloc(*Doxygen::pageLinkedMap)); SharedPtr<ExampleTreeContext> exampleTree (ExampleTreeContext::alloc()); SharedPtr<ExampleListContext> exampleList (ExampleListContext::alloc()); SharedPtr<ModuleTreeContext> moduleTree (ModuleTreeContext::alloc()); @@ -10279,15 +10139,15 @@ void generateOutputViaTemplate() //%% Page mainPage if (Doxygen::mainPage) { - SharedPtr<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage,TRUE,FALSE)); + SharedPtr<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage.get(),TRUE,FALSE)); ctx->set("mainPage",mainPage.get()); } else { // TODO: for LaTeX output index should be main... => solve in template - Doxygen::mainPage = createPageDef("[generated]",1,"index","",theTranslator->trMainPage()); + Doxygen::mainPage.reset(createPageDef("[generated]",1,"index","",theTranslator->trMainPage())); Doxygen::mainPage->setFileName("index"); - SharedPtr<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage,TRUE,FALSE)); + SharedPtr<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage.get(),TRUE,FALSE)); ctx->set("mainPage",mainPage.get()); } //%% GlobalsIndex globalsIndex: @@ -10349,25 +10209,9 @@ void generateOutputViaTemplate() } // clear all cached data in Definition objects. - QDictIterator<DefinitionIntf> di(*Doxygen::symbolMap); - const DefinitionIntf *intf; - for (;(intf=di.current());++di) + for (const auto &kv : Doxygen::symbolMap) { - if (intf->definitionType()==DefinitionIntf::TypeSymbolList) // list of symbols - { - DefinitionListIterator dli(*dynamic_cast<const DefinitionList*>(intf)); - const Definition *d; - // for each symbol - for (dli.toFirst();(d=dli.current());++dli) - { - d->setCookie(0); - } - } - else // single symbol - { - const Definition *d = dynamic_cast<const Definition *>(intf); - d->setCookie(0); - } + kv.second->setCookie(0); } e.destroyContext(ctx); @@ -10390,7 +10234,7 @@ void generateTemplateFiles(const char *templateDir) QCString outDir = QCString(templateDir)+"/html"; if (!thisDir.exists(outDir) && !thisDir.mkdir(outDir)) { - err("Failed to create output directory '%s'\n",templateDir); + err("Failed to create output directory '%s'\n",outDir.data()); return; } ResourceMgr::instance().writeCategory("html",outDir); |