diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2020-04-06 17:19:07 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2020-04-06 17:19:07 (GMT) |
commit | 4bc2355373979726c7ed4e8351639123daf808cb (patch) | |
tree | 920279c4bfbff5531fd2e1b4eca1eb142a7b7fb6 /src/filedef.cpp | |
parent | b4b47b3919650d7350acc9fe59becaee4a3d5ff5 (diff) | |
download | Doxygen-4bc2355373979726c7ed4e8351639123daf808cb.zip Doxygen-4bc2355373979726c7ed4e8351639123daf808cb.tar.gz Doxygen-4bc2355373979726c7ed4e8351639123daf808cb.tar.bz2 |
Replaced FileNameDict/FileNameList by FileNameLinkedMap
Diffstat (limited to 'src/filedef.cpp')
-rw-r--r-- | src/filedef.cpp | 202 |
1 files changed, 99 insertions, 103 deletions
diff --git a/src/filedef.cpp b/src/filedef.cpp index a60f4d8..74612f1 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -1,12 +1,12 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2015 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -213,7 +213,7 @@ class DevNullCodeDocInterface : public CodeOutputInterface //--------------------------------------------------------------------------- -/*! create a new file definition, where \a p is the file path, +/*! create a new file definition, where \a p is the file path, \a nm the file name, and \a lref is an HTML anchor name if the file was read from a tag file or 0 otherwise */ @@ -231,16 +231,16 @@ FileDefImpl::FileDefImpl(const char *p,const char *nm, m_structSDict = 0; m_exceptionSDict = 0; m_includeList = 0; - m_includeDict = 0; + m_includeDict = 0; m_includedByList = 0; - m_includedByDict = 0; - m_namespaceSDict = 0; + m_includedByDict = 0; + m_namespaceSDict = 0; m_srcDefDict = 0; m_srcMemberDict = 0; m_usingDirList = 0; m_usingDeclList = 0; m_package = 0; - m_isSource = guessSection(nm)==Entry::SOURCE_SEC; + m_isSource = guessSection(nm)==Entry::SOURCE_SEC; m_docname = nm; m_dir = 0; m_visited = FALSE; @@ -289,7 +289,7 @@ void FileDefImpl::setDiskName(const QCString &name) } } -/*! Compute the HTML anchor names for all members in the class */ +/*! Compute the HTML anchor names for all members in the class */ void FileDefImpl::computeAnchors() { MemberList *ml = getMemberList(MemberListType_allMembersList); @@ -338,7 +338,7 @@ bool FileDefImpl::hasDetailedDescription() const { static bool repeatBrief = Config_getBool(REPEAT_BRIEF); static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); - return ((!briefDescription().isEmpty() && repeatBrief) || + return ((!briefDescription().isEmpty() && repeatBrief) || !documentation().stripWhiteSpace().isEmpty() || // avail empty section (sourceBrowser && getStartBodyLine()!=-1 && getBodyDef()) ); @@ -359,20 +359,20 @@ void FileDefImpl::writeTagFile(FTextStream &tagFile) if (!ii->indirect) { FileDef *fd=ii->fileDef; - if (fd && fd->isLinkable() && !fd->isReference()) + if (fd && fd->isLinkable() && !fd->isReference()) { bool isIDLorJava = FALSE; SrcLangExt lang = fd->getLanguage(); isIDLorJava = lang==SrcLangExt_IDL || lang==SrcLangExt_Java; const char *locStr = (ii->local || isIDLorJava) ? "yes" : "no"; const char *impStr = (ii->imported || isIDLorJava) ? "yes" : "no"; - tagFile << " <includes id=\"" + tagFile << " <includes id=\"" << convertToXML(fd->getOutputFileBase()) << "\" " << "name=\"" << convertToXML(fd->name()) << "\" " << "local=\"" << locStr << "\" " << "imported=\"" << impStr << "\">" << convertToXML(ii->includeName) - << "</includes>" + << "</includes>" << endl; } } @@ -467,7 +467,7 @@ void FileDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) ol.popGeneratorState(); ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - ol.writeAnchor(0,"details"); + ol.writeAnchor(0,"details"); ol.popGeneratorState(); ol.startGroupHeader(); ol.parseText(title); @@ -478,7 +478,7 @@ void FileDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) { ol.generateDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE); } - if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) && + if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) && !documentation().isEmpty()) { ol.pushGeneratorState(); @@ -496,20 +496,20 @@ void FileDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) ol.generateDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE); } //printf("Writing source ref for file %s\n",name().data()); - if (Config_getBool(SOURCE_BROWSER)) + if (Config_getBool(SOURCE_BROWSER)) { //if Latex enabled and LATEX_SOURCE_CODE isn't -> skip, bug_738548 ol.pushGeneratorState(); if (ol.isEnabled(OutputGenerator::Latex) && !Config_getBool(LATEX_SOURCE_CODE)) - { + { ol.disable(OutputGenerator::Latex); } if (ol.isEnabled(OutputGenerator::Docbook) && !Config_getBool(DOCBOOK_PROGRAMLISTING)) - { + { ol.disable(OutputGenerator::Docbook); } if (ol.isEnabled(OutputGenerator::RTF) && !Config_getBool(RTF_SOURCE_CODE)) - { + { ol.disable(OutputGenerator::RTF); } @@ -626,7 +626,7 @@ void FileDefImpl::writeIncludeFiles(OutputList &ol) ol.docify(ii->includeName); ol.enableAll(); ol.disableAllBut(OutputGenerator::Html); - + // Here we use the include file name as it appears in the file. // we could also we the name as it is used within doxygen, // then we should have used fd->docName() instead of ii->includeName @@ -640,13 +640,13 @@ void FileDefImpl::writeIncludeFiles(OutputList &ol) { ol.docify(ii->includeName); } - + ol.enableAll(); if (ii->local || isIDLorJava) ol.docify("\""); else ol.docify(">"); - if (isIDLorJava) + if (isIDLorJava) ol.docify(";"); ol.endTypewriter(); ol.lineBreak(); @@ -669,7 +669,7 @@ void FileDefImpl::writeIncludeGraph(OutputList &ol) } else if (!incDepGraph.isTrivial()) { - ol.startTextBlock(); + ol.startTextBlock(); ol.disable(OutputGenerator::Man); ol.startInclDepGraph(); ol.parseText(theTranslator->trInclDepGraph(name())); @@ -694,7 +694,7 @@ void FileDefImpl::writeIncludedByGraph(OutputList &ol) } else if (!incDepGraph.isTrivial()) { - ol.startTextBlock(); + ol.startTextBlock(); ol.disable(OutputGenerator::Man); ol.startInclDepGraph(); ol.parseText(theTranslator->trInclByDepGraph()); @@ -786,7 +786,7 @@ void FileDefImpl::writeMemberGroups(OutputList &ol) MemberGroup *mg; for (;(mg=mgli.current());++mgli) { - if ((!mg->allMembersInSameSection() || !m_subGrouping) + if ((!mg->allMembersInSameSection() || !m_subGrouping) && mg->header()!="[NOHEADER]") { mg->writeDeclarations(ol,0,0,this,0); @@ -872,13 +872,13 @@ void FileDefImpl::writeSummaryLinks(OutputList &ol) const } /*! Write the documentation page for this file to the file of output - generators \a ol. + generators \a ol. */ void FileDefImpl::writeDocumentation(OutputList &ol) { static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); //funcList->countDecMembers(); - + //QCString fn = name(); //if (Config_getBool(FULL_PATH_NAMES)) //{ @@ -886,7 +886,7 @@ void FileDefImpl::writeDocumentation(OutputList &ol) //} //printf("WriteDocumentation diskname=%s\n",diskname.data()); - + QCString versionTitle; if (!m_fileVersion.isEmpty()) { @@ -938,16 +938,16 @@ void FileDefImpl::writeDocumentation(OutputList &ol) ol.endProjectNumber(); ol.enableAll(); } - + if (Doxygen::searchIndex) { Doxygen::searchIndex->setCurrentDoc(this,anchor(),FALSE); Doxygen::searchIndex->addWord(localName(),TRUE); } - + //---------------------------------------- start flexible part ------------------------------- - + SrcLangExt lang = getLanguage(); QListIterator<LayoutDocEntry> eli( LayoutDocManager::instance().docEntries(LayoutDocManager::File)); @@ -956,12 +956,12 @@ void FileDefImpl::writeDocumentation(OutputList &ol) { switch (lde->kind()) { - case LayoutDocEntry::BriefDesc: + case LayoutDocEntry::BriefDesc: writeBriefDescription(ol); - break; - case LayoutDocEntry::MemberDeclStart: + break; + case LayoutDocEntry::MemberDeclStart: startMemberDeclarations(ol); - break; + break; case LayoutDocEntry::FileIncludes: writeIncludeFiles(ol); break; @@ -974,76 +974,76 @@ void FileDefImpl::writeDocumentation(OutputList &ol) case LayoutDocEntry::FileSourceLink: writeSourceLink(ol); break; - case LayoutDocEntry::FileClasses: + case LayoutDocEntry::FileClasses: { LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; writeClassDeclarations(ol,ls->title(lang),m_classSDict); } break; - case LayoutDocEntry::FileInterfaces: + case LayoutDocEntry::FileInterfaces: { LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; writeClassDeclarations(ol,ls->title(lang),m_interfaceSDict); } break; - case LayoutDocEntry::FileStructs: + case LayoutDocEntry::FileStructs: { LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; writeClassDeclarations(ol,ls->title(lang),m_structSDict); } break; - case LayoutDocEntry::FileExceptions: + case LayoutDocEntry::FileExceptions: { LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; writeClassDeclarations(ol,ls->title(lang),m_exceptionSDict); } break; - case LayoutDocEntry::FileNamespaces: + case LayoutDocEntry::FileNamespaces: { LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; writeNamespaceDeclarations(ol,ls->title(lang),false); } - break; + break; case LayoutDocEntry::FileConstantGroups: { LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; writeNamespaceDeclarations(ol,ls->title(lang),true); } break; - case LayoutDocEntry::MemberGroups: + case LayoutDocEntry::MemberGroups: writeMemberGroups(ol); - break; - case LayoutDocEntry::MemberDecl: + break; + case LayoutDocEntry::MemberDecl: { LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde; writeMemberDeclarations(ol,lmd->type,lmd->title(lang)); } - break; - case LayoutDocEntry::MemberDeclEnd: + break; + case LayoutDocEntry::MemberDeclEnd: endMemberDeclarations(ol); break; - case LayoutDocEntry::DetailedDesc: + case LayoutDocEntry::DetailedDesc: { LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; writeDetailedDescription(ol,ls->title(lang)); } break; - case LayoutDocEntry::MemberDefStart: + case LayoutDocEntry::MemberDefStart: startMemberDocumentation(ol); - break; + break; case LayoutDocEntry::FileInlineClasses: writeInlineClasses(ol); break; - case LayoutDocEntry::MemberDef: + case LayoutDocEntry::MemberDef: { LayoutDocEntryMemberDef *lmd = (LayoutDocEntryMemberDef*)lde; writeMemberDocumentation(ol,lmd->type,lmd->title(lang)); } break; - case LayoutDocEntry::MemberDefEnd: + case LayoutDocEntry::MemberDefEnd: endMemberDocumentation(ol); break; - case LayoutDocEntry::AuthorSection: + case LayoutDocEntry::AuthorSection: writeAuthorSection(ol); break; case LayoutDocEntry::ClassIncludes: @@ -1060,13 +1060,13 @@ void FileDefImpl::writeDocumentation(OutputList &ol) case LayoutDocEntry::NamespaceStructs: case LayoutDocEntry::NamespaceExceptions: case LayoutDocEntry::NamespaceInlineClasses: - case LayoutDocEntry::GroupClasses: - case LayoutDocEntry::GroupInlineClasses: + case LayoutDocEntry::GroupClasses: + case LayoutDocEntry::GroupInlineClasses: case LayoutDocEntry::GroupNamespaces: - case LayoutDocEntry::GroupDirs: - case LayoutDocEntry::GroupNestedGroups: + case LayoutDocEntry::GroupDirs: + case LayoutDocEntry::GroupNestedGroups: case LayoutDocEntry::GroupFiles: - case LayoutDocEntry::GroupGraph: + case LayoutDocEntry::GroupGraph: case LayoutDocEntry::GroupPageDocs: case LayoutDocEntry::DirSubDirs: case LayoutDocEntry::DirFiles: @@ -1095,7 +1095,7 @@ void FileDefImpl::writeMemberPages(OutputList &ol) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); - + QListIterator<MemberList> mli(m_memberLists); MemberList *ml; for (mli.toFirst();(ml=mli.current());++mli) @@ -1215,7 +1215,7 @@ void FileDefImpl::writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu (void)filesInSameTu; #if USE_LIBCLANG static bool clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING); - if (clangAssistedParsing && + if (clangAssistedParsing && (getLanguage()==SrcLangExt_Cpp || getLanguage()==SrcLangExt_ObjC)) { ol.startCodeFragment(); @@ -1236,7 +1236,7 @@ void FileDefImpl::writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu CodeParserInterface &intf = Doxygen::parserManager->getCodeParser(getDefFileExtension()); intf.resetCodeParserState(); ol.startCodeFragment(); - bool needs2PassParsing = + bool needs2PassParsing = Doxygen::parseSourcesNeeded && // we need to parse (filtered) sources for cross-references !filterSourceFiles && // but user wants to show sources as-is !getFileFilter(absFilePath(),TRUE).isEmpty(); // and there is a filter used while parsing @@ -1279,7 +1279,7 @@ void FileDefImpl::parseSource(bool sameTu,QStrList &filesInSameTu) (void)filesInSameTu; #if USE_LIBCLANG static bool clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING); - if (clangAssistedParsing && + if (clangAssistedParsing && (getLanguage()==SrcLangExt_Cpp || getLanguage()==SrcLangExt_ObjC)) { if (!sameTu) @@ -1351,7 +1351,7 @@ void FileDefImpl::insertMember(MemberDef *md) // name().data(),md->name().data(),md,allMemberList.count()); MemberList *allMemberList = getMemberList(MemberListType_allMembersList); if (allMemberList && allMemberList->findRef(md)!=-1) // TODO optimize the findRef! - { + { return; } @@ -1360,38 +1360,38 @@ void FileDefImpl::insertMember(MemberDef *md) allMemberList = new MemberList(MemberListType_allMembersList); m_memberLists.append(allMemberList); } - allMemberList->append(md); + allMemberList->append(md); //::addFileMemberNameToIndex(md); switch (md->memberType()) { - case MemberType_Variable: - case MemberType_Property: + case MemberType_Variable: + case MemberType_Property: addMemberToList(MemberListType_decVarMembers,md); addMemberToList(MemberListType_docVarMembers,md); break; - case MemberType_Function: + case MemberType_Function: addMemberToList(MemberListType_decFuncMembers,md); addMemberToList(MemberListType_docFuncMembers,md); break; - case MemberType_Typedef: + case MemberType_Typedef: addMemberToList(MemberListType_decTypedefMembers,md); addMemberToList(MemberListType_docTypedefMembers,md); break; - case MemberType_Sequence: + case MemberType_Sequence: addMemberToList(MemberListType_decSequenceMembers,md); addMemberToList(MemberListType_docSequenceMembers,md); break; - case MemberType_Dictionary: + case MemberType_Dictionary: addMemberToList(MemberListType_decDictionaryMembers,md); addMemberToList(MemberListType_docDictionaryMembers,md); break; - case MemberType_Enumeration: + case MemberType_Enumeration: addMemberToList(MemberListType_decEnumMembers,md); addMemberToList(MemberListType_docEnumMembers,md); break; case MemberType_EnumValue: // enum values are shown inside their enums break; - case MemberType_Define: + case MemberType_Define: addMemberToList(MemberListType_decDefineMembers,md); addMemberToList(MemberListType_docDefineMembers,md); break; @@ -1446,7 +1446,7 @@ void FileDefImpl::insertClass(ClassDef *cd) void FileDefImpl::insertNamespace(NamespaceDef *nd) { if (nd->isHidden()) return; - if (!nd->name().isEmpty() && + if (!nd->name().isEmpty() && (m_namespaceSDict==0 || m_namespaceSDict->find(nd->name())==0)) { if (m_namespaceSDict==0) @@ -1464,13 +1464,13 @@ void FileDefImpl::insertNamespace(NamespaceDef *nd) } } -QCString FileDefImpl::name() const -{ - if (Config_getBool(FULL_PATH_NAMES)) - return m_fileName; - else - return DefinitionImpl::name(); -} +QCString FileDefImpl::name() const +{ + if (Config_getBool(FULL_PATH_NAMES)) + return m_fileName; + else + return DefinitionImpl::name(); +} void FileDefImpl::addSourceRef(int line,Definition *d,MemberDef *md) { @@ -1522,10 +1522,10 @@ void FileDefImpl::addUsingDirective(const NamespaceDef *nd) //printf("%p: FileDefImpl::addUsingDirective: %s:%d\n",this,name().data(),usingDirList->count()); } -NamespaceSDict *FileDefImpl::getUsedNamespaces() const -{ +NamespaceSDict *FileDefImpl::getUsedNamespaces() const +{ //printf("%p: FileDefImpl::getUsedNamespace: %s:%d\n",this,name().data(),usingDirList?usingDirList->count():0); - return m_usingDirList; + return m_usingDirList; } void FileDefImpl::addUsingDeclaration(Definition *d) @@ -1667,13 +1667,13 @@ bool FileDefImpl::isIncluded(const QCString &name) const return m_includeDict!=0 && m_includeDict->find(name)!=0; } -bool FileDefImpl::generateSourceFile() const -{ +bool FileDefImpl::generateSourceFile() const +{ static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); static bool verbatimHeaders = Config_getBool(VERBATIM_HEADERS); - return !isReference() && - (sourceBrowser || - (verbatimHeaders && guessSection(name())==Entry::HEADER_SEC) + return !isReference() && + (sourceBrowser || + (verbatimHeaders && guessSection(name())==Entry::HEADER_SEC) ) && !isDocumentationFile(); } @@ -1754,7 +1754,7 @@ static Directory *findDirNode(Directory *root,const QCString &name) { // recurse into the directory return findDirNode(dir,name.mid(dirName.length()+1)); - } + } else // partial match => we need to split the path into three parts { QCString baseName =dirName.left(sp); @@ -1784,7 +1784,7 @@ static Directory *findDirNode(Directory *root,const QCString &name) // add new branch to the root if (!root->children().isEmpty()) { - root->children().getLast()->setLast(FALSE); + root->children().getLast()->setLast(FALSE); } root->addChild(base); return newBranch; @@ -1797,14 +1797,14 @@ static Directory *findDirNode(Directory *root,const QCString &name) { return root; // put the file under the root node. } - else // need to create a subdir + else // need to create a subdir { QCString baseName = name.left(si); //printf("new subdir %s\n",baseName.data()); Directory *newBranch = new Directory(root,baseName); if (!root->children().isEmpty()) { - root->children().getLast()->setLast(FALSE); + root->children().getLast()->setLast(FALSE); } root->addChild(newBranch); return newBranch; @@ -1818,7 +1818,7 @@ static void mergeFileDef(Directory *root,FileDef *fd) Directory *dirNode = findDirNode(root,filePath); if (!dirNode->children().isEmpty()) { - dirNode->children().getLast()->setLast(FALSE); + dirNode->children().getLast()->setLast(FALSE); } DirEntry *e=new DirEntry(dirNode,fd); dirNode->addChild(e); @@ -1912,7 +1912,7 @@ static void addDirsAsGroups(Directory *root,GroupDef *parent,int level) root->path(), // name root->name() // title ); - if (parent) + if (parent) { parent->addGroup(gd); gd->makePartOfGroup(parent); @@ -1937,15 +1937,11 @@ void generateFileTree() { Directory *root=new Directory(0,"root"); root->setLast(TRUE); - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - for (fnli.toFirst();(fn=fnli.current());++fnli) + for (const auto &fn : *Doxygen::inputNameLinkedMap) { - FileNameIterator fni(*fn); - FileDef *fd; - for (;(fd=fni.current());++fni) + for (const auto &fd : *fn) { - mergeFileDef(root,fd); + mergeFileDef(root,fd.get()); } } //t << "<div class=\"directory\">\n"; @@ -2058,8 +2054,8 @@ QCString FileDefImpl::getOutputFileBase() const } /*! Returns the name of the verbatim copy of this file (if any). */ -QCString FileDefImpl::includeName() const -{ +QCString FileDefImpl::includeName() const +{ return getSourceFileBase(); } @@ -2143,7 +2139,7 @@ void FileDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,const { static bool optVhdl = Config_getBool(OPTIMIZE_OUTPUT_VHDL); MemberList * ml = getMemberList(lt); - if (ml) + if (ml) { if (optVhdl) // use specific declarations function { |