diff options
-rw-r--r-- | addon/doxyapp/doxyapp.cpp | 40 | ||||
-rw-r--r-- | addon/doxyparse/doxyparse.cpp | 33 | ||||
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/clangparser.cpp | 70 | ||||
-rw-r--r-- | src/code.l | 19 | ||||
-rw-r--r-- | src/context.cpp | 34 | ||||
-rw-r--r-- | src/context.h | 4 | ||||
-rw-r--r-- | src/defgen.cpp | 26 | ||||
-rw-r--r-- | src/dirdef.cpp | 95 | ||||
-rw-r--r-- | src/docbookgen.cpp | 10 | ||||
-rw-r--r-- | src/docbookvisitor.cpp | 116 | ||||
-rw-r--r-- | src/docparser.cpp | 30 | ||||
-rw-r--r-- | src/doxygen.cpp | 395 | ||||
-rw-r--r-- | src/doxygen.h | 24 | ||||
-rw-r--r-- | src/filedef.cpp | 202 | ||||
-rw-r--r-- | src/filename.cpp | 154 | ||||
-rw-r--r-- | src/filename.h | 64 | ||||
-rw-r--r-- | src/index.cpp | 48 | ||||
-rw-r--r-- | src/latexgen.cpp | 204 | ||||
-rw-r--r-- | src/linkedmap.h | 3 | ||||
-rw-r--r-- | src/markdown.cpp | 114 | ||||
-rw-r--r-- | src/message.cpp | 2 | ||||
-rw-r--r-- | src/perlmodgen.cpp | 116 | ||||
-rw-r--r-- | src/pre.l | 8 | ||||
-rw-r--r-- | src/rtfgen.cpp | 104 | ||||
-rw-r--r-- | src/searchindex.cpp | 12 | ||||
-rw-r--r-- | src/sqlite3gen.cpp | 22 | ||||
-rw-r--r-- | src/tagreader.cpp | 30 | ||||
-rw-r--r-- | src/util.cpp | 38 | ||||
-rw-r--r-- | src/util.h | 6 | ||||
-rw-r--r-- | src/vhdldocgen.cpp | 38 | ||||
-rw-r--r-- | src/vhdldocgen.h | 39 | ||||
-rw-r--r-- | src/xmldocvisitor.cpp | 189 | ||||
-rw-r--r-- | src/xmlgen.cpp | 164 |
34 files changed, 1049 insertions, 1405 deletions
diff --git a/addon/doxyapp/doxyapp.cpp b/addon/doxyapp/doxyapp.cpp index edd39e3..1153ce3 100644 --- a/addon/doxyapp/doxyapp.cpp +++ b/addon/doxyapp/doxyapp.cpp @@ -3,8 +3,8 @@ * 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. * @@ -19,7 +19,7 @@ * This example shows how to configure and run doxygen programmatically from * within an application without generating the usual output. * The example should work on any Unix like OS (including Linux and Mac OS X). - * + * * This example shows how to use to code parser to get cross-references information * and it also shows how to look up symbols in a program parsed by doxygen and * show some information about them. @@ -51,7 +51,7 @@ class XRefDummyCodeGenerator : public CodeOutputInterface void writeCodeLink(const char *,const char *,const char *,const char *,const char *) {} void writeLineNumber(const char *,const char *,const char *,int) {} virtual void writeTooltip(const char *,const DocLinkInfo &, - const char *,const char *,const SourceLinkInfo &, + const char *,const char *,const SourceLinkInfo &, const SourceLinkInfo &) {} void startCodeLine(bool) {} void endCodeLine() {} @@ -64,7 +64,7 @@ class XRefDummyCodeGenerator : public CodeOutputInterface void addWord(const char *,bool) {} // here we are presented with the symbols found by the code parser - void linkableSymbol(int l, const char *sym,Definition *symDef,Definition *context) + void linkableSymbol(int l, const char *sym,Definition *symDef,Definition *context) { QCString ctx; if (context) // the context of the symbol is known @@ -117,7 +117,7 @@ static void findXRefSymbols(FileDef *fd) // reset the parsers state intf.resetCodeParserState(); - // create a new backend object + // create a new backend object XRefDummyCodeGenerator *xrefGen = new XRefDummyCodeGenerator(fd); // parse the source code @@ -137,7 +137,7 @@ static void listSymbol(Definition *d) { if (d!=Doxygen::globalScope && // skip the global namespace symbol d->name().at(0)!='@' // skip anonymous stuff - ) + ) { printf("%s\n", d->name().data()); @@ -172,7 +172,7 @@ static void lookupSymbol(Definition *d) { if (d!=Doxygen::globalScope && // skip the global namespace symbol d->name().at(0)!='@' // skip anonymous stuff - ) + ) { printf("Symbol info\n"); printf("-----------\n"); @@ -256,7 +256,7 @@ int main(int argc,char **argv) exit(1); } - // initialize data structures + // initialize data structures initDoxygen(); // setup the non-default configuration options @@ -264,7 +264,7 @@ int main(int argc,char **argv) checkConfiguration(); adjustConfiguration(); // we need a place to put intermediate files - Config_getString(OUTPUT_DIRECTORY)="/tmp/doxygen"; + Config_getString(OUTPUT_DIRECTORY)="/tmp/doxygen"; // disable html output Config_getBool(GENERATE_HTML)=FALSE; // disable latex output @@ -280,7 +280,7 @@ int main(int argc,char **argv) Config_getBool(EXTRACT_STATIC)=TRUE; Config_getBool(EXTRACT_PRIVATE)=TRUE; Config_getBool(EXTRACT_LOCAL_METHODS)=TRUE; - // Extract source browse information, needed + // Extract source browse information, needed // to make doxygen gather the cross reference info Config_getBool(SOURCE_BROWSER)=TRUE; // In case of a directory take all files on directory and its subdirectories @@ -294,18 +294,12 @@ int main(int argc,char **argv) parseInput(); // iterate over the input files - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - // foreach file with a certain name - for (fnli.toFirst();(fn=fnli.current());++fnli) + for (const auto &fn : *Doxygen::inputNameLinkedMap) { - FileNameIterator fni(*fn); - FileDef *fd; - // for each file definition - for (;(fd=fni.current());++fni) + for (const auto &fd : *fn) { // get the references (linked and unlinked) found in this file - findXRefSymbols(fd); + findXRefSymbols(fd.get()); } } @@ -321,11 +315,11 @@ int main(int argc,char **argv) fgets(cmd,256,stdin); QCString s(cmd); if (s.at(s.length()-1)=='\n') s=s.left(s.length()-1); // strip trailing \n - if (s==".list") + if (s==".list") listSymbols(); - else if (s==".quit") + else if (s==".quit") exit(0); - else + else lookupSymbols(s); } } diff --git a/addon/doxyparse/doxyparse.cpp b/addon/doxyparse/doxyparse.cpp index d0b43d5..2fcf9ac 100644 --- a/addon/doxyparse/doxyparse.cpp +++ b/addon/doxyparse/doxyparse.cpp @@ -291,7 +291,7 @@ void functionInformation(MemberDef* md) { if (!argList.empty()) { temp = argumentData(argList.front()); -// TODO: This is a workaround; better not include "void" in argList, in the first place. +// TODO: This is a workaround; better not include "void" in argList, in the first place. if (temp!="void") { printNumberOfArguments(argList.size()); @@ -385,9 +385,8 @@ static bool checkLanguage(std::string& filename, std::string extension) { /* Detects the programming language of the project. Actually, we only care * about whether it is a C project or not. */ -static void detectProgrammingLanguage(FileNameListIterator& fnli) { - FileName* fn; - for (fnli.toFirst(); (fn=fnli.current()); ++fnli) { +static void detectProgrammingLanguage(FileNameLinkedMap &fnli) { + for (const auto &fn : fnli) { std::string filename = fn->fileName(); if ( checkLanguage(filename, ".cc") || @@ -404,17 +403,11 @@ static void detectProgrammingLanguage(FileNameListIterator& fnli) { } static void listSymbols() { - // iterate over the input files - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - - detectProgrammingLanguage(fnli); + detectProgrammingLanguage(*Doxygen::inputNameLinkedMap); - // for each file - for (fnli.toFirst(); (fn=fnli.current()); ++fnli) { - FileNameIterator fni(*fn); - FileDef *fd; - for (; (fd=fni.current()); ++fni) { + // iterate over the input files + for (const auto &fn : *Doxygen::inputNameLinkedMap) { + for (const auto &fd : *fn) { printFile(fd->absFilePath().data()); MemberList *ml = fd->getMemberList(MemberListType_allMembersList); if (ml && ml->count() > 0) { @@ -529,16 +522,10 @@ int main(int argc,char **argv) { parseInput(); // iterate over the input files - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - // for each file with a certain name - for (fnli.toFirst();(fn=fnli.current());++fnli) { - FileNameIterator fni(*fn); - FileDef *fd; - // for each file definition - for (;(fd=fni.current());++fni) { + for (const auto &fn : *Doxygen::inputNameLinkedMap) { + for (const auto &fd : *fn) { // get the references (linked and unlinked) found in this file - findXRefSymbols(fd); + findXRefSymbols(fd.get()); } } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0a7a3ef..9b452a4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -232,7 +232,6 @@ add_library(_doxygen STATIC emoji.cpp entry.cpp filedef.cpp - filename.cpp fileparser.cpp formula.cpp ftextstream.cpp diff --git a/src/clangparser.cpp b/src/clangparser.cpp index f6020dd..aece641 100644 --- a/src/clangparser.cpp +++ b/src/clangparser.cpp @@ -44,7 +44,7 @@ class ClangParser::Private { public: enum DetectedLang { Detected_Cpp, Detected_ObjC, Detected_ObjCpp }; - Private() : tu(0), tokens(0), numTokens(0), cursors(0), + Private() : tu(0), tokens(0), numTokens(0), cursors(0), ufs(0), sources(0), numFiles(0), fileMapping(257), detectedLang(Detected_Cpp) { fileMapping.setAutoDelete(TRUE); } @@ -84,7 +84,7 @@ static QCString detab(const QCString &s) int stop = tabSize - (col%tabSize); //printf("expand at %d stop=%d\n",col,stop); col+=stop; - while (stop--) out.addChar(' '); + while (stop--) out.addChar(' '); } break; case '\n': // reset column counter @@ -134,7 +134,7 @@ static void inclusionVisitor(CXFile includedFile, /** filter the \a files and only keep those that are found as include files * within the current translation unit. * @param[in,out] files The list of files to filter. - */ + */ void ClangParser::determineInputFilesInSameTu(QStrList &files) { // put the files in this translation unit in a dictionary @@ -241,7 +241,7 @@ void ClangParser::start(const char *fileName,QStrList &filesInTranslationUnit) if (lang==SrcLangExt_ObjC || p->detectedLang!=ClangParser::Private::Detected_Cpp) { QCString fn = fileName; - if (p->detectedLang==ClangParser::Private::Detected_Cpp && + if (p->detectedLang==ClangParser::Private::Detected_Cpp && (fn.right(4).lower()==".cpp" || fn.right(4).lower()==".cxx" || fn.right(3).lower()==".cc" || fn.right(2).lower()==".c")) { // fall back to C/C++ once we see an extension that indicates this @@ -258,14 +258,14 @@ void ClangParser::start(const char *fileName,QStrList &filesInTranslationUnit) } switch(p->detectedLang) { - case ClangParser::Private::Detected_Cpp: - argv[argc++]=qstrdup("c++"); + case ClangParser::Private::Detected_Cpp: + argv[argc++]=qstrdup("c++"); break; - case ClangParser::Private::Detected_ObjC: - argv[argc++]=qstrdup("objective-c"); + case ClangParser::Private::Detected_ObjC: + argv[argc++]=qstrdup("objective-c"); break; - case ClangParser::Private::Detected_ObjCpp: - argv[argc++]=qstrdup("objective-c++"); + case ClangParser::Private::Detected_ObjCpp: + argv[argc++]=qstrdup("objective-c++"); break; } @@ -297,7 +297,7 @@ void ClangParser::start(const char *fileName,QStrList &filesInTranslationUnit) // let libclang do the actual parsing p->tu = clang_parseTranslationUnit(p->index, 0, - argv, argc, p->ufs, numUnsavedFiles, + argv, argc, p->ufs, numUnsavedFiles, CXTranslationUnit_DetailedPreprocessingRecord); // free arguments for (int i=0;i<argc;++i) @@ -312,11 +312,11 @@ void ClangParser::start(const char *fileName,QStrList &filesInTranslationUnit) determineInputFilesInSameTu(filesInTranslationUnit); // show any warnings that the compiler produced - for (uint i=0, n=clang_getNumDiagnostics(p->tu); i!=n; ++i) + for (uint i=0, n=clang_getNumDiagnostics(p->tu); i!=n; ++i) { - CXDiagnostic diag = clang_getDiagnostic(p->tu, i); + CXDiagnostic diag = clang_getDiagnostic(p->tu, i); CXString string = clang_formatDiagnostic(diag, - clang_defaultDiagnosticDisplayOptions()); + clang_defaultDiagnosticDisplayOptions()); err("%s [clang]\n",clang_getCString(string)); clang_disposeString(string); clang_disposeDiagnostic(diag); @@ -436,7 +436,7 @@ QCString ClangParser::lookup(uint line,const char *symbol) p->curToken--; // linear search to start of the line l = p->getCurrentTokenLine(); } - else + else { p->curToken/=2; // binary search backward l = p->getCurrentTokenLine(); @@ -702,17 +702,19 @@ void ClangParser::linkInclude(CodeOutputInterface &ol,FileDef *fd, FileDef *ifd=0; if (!incName.isEmpty()) { - FileName *fn = Doxygen::inputNameDict->find(incName); + FileName *fn = Doxygen::inputNameLinkedMap->find(incName); if (fn) { - bool found=false; - FileNameIterator fni(*fn); - // for each include name - for (fni.toFirst();!found && (ifd=fni.current());++fni) + // see if this source file actually includes the file + auto it = std::find_if(fn->begin(), + fn->end(), + [&fd](const auto &ifd) + { return fd->isIncluded(ifd->absFilePath()); }); + bool found = it!=fn->end(); + if (found) { - // see if this source file actually includes the file - found = fd->isIncluded(ifd->absFilePath()); - //printf(" include file %s found=%d\n",ifd->absFilePath().data(),found); + //printf(" include file %s found=%d\n",(*it)->absFilePath().data(),found); + ifd = it->get(); } } } @@ -759,7 +761,7 @@ void ClangParser::linkIdentifier(CodeOutputInterface &ol,FileDef *fd, CXCursor t = clang_getSpecializedCursorTemplate(c); if (!clang_Cursor_isNull(t) && !clang_equalCursors(t,c)) { - c=t; // link to template + c=t; // link to template } CXString usr = clang_getCursorUSR(c); const char *usrStr = clang_getCString(usr); @@ -779,7 +781,7 @@ void ClangParser::linkIdentifier(CodeOutputInterface &ol,FileDef *fd, if (d && d->isLinkable()) { if (g_insideBody && - g_currentMemberDef && d->definitionType()==Definition::TypeMember && + g_currentMemberDef && d->definitionType()==Definition::TypeMember && (g_currentMemberDef!=d || g_currentLine<line)) // avoid self-reference { addDocCrossReference(g_currentMemberDef,dynamic_cast<MemberDef *>(d)); @@ -843,13 +845,13 @@ void ClangParser::writeSources(CodeOutputInterface &ol,FileDef *fd) unsigned int l, c; clang_getSpellingLocation(start, 0, &l, &c, 0); if (l > line) column = 1; - while (line<l) - { - line++; + while (line<l) + { + line++; ol.endCodeLine(); ol.startCodeLine(TRUE); writeLineNumber(ol,fd,line); - } + } while (column<c) { ol.codify(" "); column++; } CXString tokenString = clang_getTokenSpelling(p->tu, p->tokens[i]); char const *s = clang_getCString(tokenString); @@ -858,7 +860,7 @@ void ClangParser::writeSources(CodeOutputInterface &ol,FileDef *fd) //printf("%d:%d %s cursorKind=%d tokenKind=%d\n",line,column,s,cursorKind,tokenKind); switch (tokenKind) { - case CXToken_Keyword: + case CXToken_Keyword: if (strcmp(s,"operator")==0) { linkIdentifier(ol,fd,line,column,s,i); @@ -870,21 +872,21 @@ void ClangParser::writeSources(CodeOutputInterface &ol,FileDef *fd) keywordToType(s)); } break; - case CXToken_Literal: + case CXToken_Literal: if (cursorKind==CXCursor_InclusionDirective) { linkInclude(ol,fd,line,column,s); } - else if (s[0]=='"' || s[0]=='\'') + else if (s[0]=='"' || s[0]=='\'') { codifyLines(ol,fd,s,line,column,"stringliteral"); } - else + else { codifyLines(ol,fd,s,line,column); } break; - case CXToken_Comment: + case CXToken_Comment: codifyLines(ol,fd,s,line,column,"comment"); break; default: // CXToken_Punctuation or CXToken_Identifier @@ -567,7 +567,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" // absPath = QDir::cleanDirPath(yyextra->sourceFileDef->getPath()+"/"+absPath); //} - FileDef *fd=findFileDef(Doxygen::inputNameDict,yytext,ambig); + FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,yytext,ambig); //printf("looking for include %s -> %s fd=%p\n",yytext,absPath.data(),fd); if (fd && fd->isLinkable()) { @@ -577,17 +577,16 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" QCString name = QDir::cleanDirPath(yytext).utf8(); if (!name.isEmpty() && yyextra->sourceFileDef) { - FileName *fn = Doxygen::inputNameDict->find(name); + FileName *fn = Doxygen::inputNameLinkedMap->find(name); if (fn) { - FileNameIterator fni(*fn); - // for each include name - for (fni.toFirst();!found && (fd=fni.current());++fni) - { - // see if this source file actually includes the file - found = yyextra->sourceFileDef->isIncluded(fd->absFilePath()); - //printf(" include file %s found=%d\n",fd->absFilePath().data(),found); - } + // see if this source file actually includes the file + auto it = std::find_if(fn->begin(), + fn->end(), + [&sfd=yyextra->sourceFileDef] + (const auto &fd) + { return sfd->isIncluded(fd->absFilePath()); }); + found = it!=fn->end(); } } } diff --git a/src/context.cpp b/src/context.cpp index badcf22..bc1bbc0 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -6607,19 +6607,15 @@ class NestingContext::Private : public GenericNodeListContext m_index++; } } - void addFiles(const FileNameList &fnList) + void addFiles(const FileNameLinkedMap &fnList) { - 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)); m_index++; } } @@ -6794,7 +6790,7 @@ void NestingContext::addDirs(const DirList &dirs) p->addDirs(dirs); } -void NestingContext::addFiles(const FileNameList &files) +void NestingContext::addFiles(const FileNameLinkedMap &files) { p->addFiles(files); } @@ -7130,23 +7126,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())); } } } @@ -7156,7 +7148,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() @@ -7291,9 +7283,9 @@ class FileTreeContext::Private { m_dirFileTree->addDirs(*Doxygen::directories); } - if (Doxygen::inputNameList) + if (Doxygen::inputNameLinkedMap) { - m_dirFileTree->addFiles(*Doxygen::inputNameList); + m_dirFileTree->addFiles(*Doxygen::inputNameLinkedMap); } //%% DirFile tree: static bool init=FALSE; @@ -9821,7 +9813,7 @@ class SymbolGroupListContext::Private : public GenericNodeListContext } }; -SymbolGroupListContext::SymbolGroupListContext(const SearchIndexList *sil) +SymbolGroupListContext::SymbolGroupListContext(const SearchIndexList *sil) : RefCountedContext("SymbolGroupListContext") { p = new Private(sil); diff --git a/src/context.h b/src/context.h index 278cf05..8af74f8 100644 --- a/src/context.h +++ b/src/context.h @@ -32,7 +32,7 @@ class BaseClassList; class NamespaceSDict; class FileDef; class FileList; -class FileNameList; +class FileNameLinkedMap; class DirSDict; class DirList; class DirDef; @@ -547,7 +547,7 @@ class NestingContext : public RefCountedContext, public TemplateListIntf void addClasses(const ClassSDict &clDict,bool rootOnly); void addDirs(const DirSDict &); void addDirs(const DirList &); - void addFiles(const FileNameList &); + void addFiles(const FileNameLinkedMap &); void addFiles(const FileList &); void addPages(const PageSDict &pages,bool rootOnly); void addModules(const GroupSDict &modules); diff --git a/src/defgen.cpp b/src/defgen.cpp index cc3d5af..96f9da3 100644 --- a/src/defgen.cpp +++ b/src/defgen.cpp @@ -1,13 +1,13 @@ /****************************************************************************** * - * + * * * * 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. * @@ -71,14 +71,14 @@ void generateDEFForMember(MemberDef *md, // + source definition // - source references // - source referenced by - // - include code + // - include code if (md->memberType()==MemberType_EnumValue) return; QCString scopeName; - if (md->getClassDef()) + if (md->getClassDef()) scopeName=md->getClassDef()->name(); - else if (md->getNamespaceDef()) + else if (md->getNamespaceDef()) scopeName=md->getNamespaceDef()->name(); t << " " << Prefix << "-member = {" << endl; @@ -185,7 +185,7 @@ void generateDEFForMember(MemberDef *md, if (!a.array.isEmpty()) { t << fcnPrefix << "array = "; - writeDEFString(t,a.array); + writeDEFString(t,a.array); t << ';' << endl; } if (!a.defval.isEmpty()) @@ -612,7 +612,7 @@ void generateDEF() FTextStream t(&f); t << "AutoGen Definitions dummy;" << endl; - if (Doxygen::classSDict->count()+Doxygen::inputNameList->count()>0) + if (Doxygen::classSDict->count()+Doxygen::inputNameLinkedMap->size()>0) { ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd; @@ -620,15 +620,11 @@ void generateDEF() { generateDEFForClass(cd,t); } - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - for (;(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) { - generateDEFForFile(fd,t); + generateDEFForFile(fd.get(),t); } } } diff --git a/src/dirdef.cpp b/src/dirdef.cpp index 81245e3..70ca3c0 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -14,6 +14,7 @@ #include "config.h" #include "docparser.h" #include "definitionimpl.h" +#include "filedef.h" //---------------------------------------------------------------------- @@ -103,7 +104,7 @@ DirDefImpl::DirDefImpl(const char *path) : DefinitionImpl(path,1,1,path) m_shortName = m_shortName.left(m_shortName.length()-1); } int pi=m_shortName.findRev('/'); - if (pi!=-1) + if (pi!=-1) { // remove everything till the last / m_shortName = m_shortName.mid(pi+1); } @@ -113,7 +114,7 @@ DirDefImpl::DirDefImpl(const char *path) : DefinitionImpl(path,1,1,path) { // strip trailing / m_dispName = m_dispName.left(m_dispName.length()-1); } - + m_fileList = new FileList; m_usedDirs = new QDict<UsedDir>(257); m_usedDirs->setAutoDelete(TRUE); @@ -128,14 +129,14 @@ DirDefImpl::~DirDefImpl() delete m_usedDirs; } -bool DirDefImpl::isLinkableInProject() const -{ - return !isReference(); +bool DirDefImpl::isLinkableInProject() const +{ + return !isReference(); } -bool DirDefImpl::isLinkable() const -{ - return isReference() || isLinkableInProject(); +bool DirDefImpl::isLinkable() const +{ + return isReference() || isLinkableInProject(); } void DirDefImpl::addSubDir(DirDef *subdir) @@ -203,7 +204,7 @@ QCString DirDefImpl::getOutputFileBase() const void DirDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) { - if ((!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) || + if ((!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) || !documentation().isEmpty()) { ol.pushGeneratorState(); @@ -224,7 +225,7 @@ void DirDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) ol.generateDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE); } // separator between brief and details - if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) && + if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) && !documentation().isEmpty()) { ol.pushGeneratorState(); @@ -495,7 +496,7 @@ void DirDefImpl::writeDocumentation(OutputList &ol) { static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); ol.pushGeneratorState(); - + QCString title=theTranslator->trDirReference(m_dispName); startFile(ol,getOutputFileBase(),name(),title,HLI_Files,!generateTreeView); @@ -527,25 +528,25 @@ void DirDefImpl::writeDocumentation(OutputList &ol) { switch (lde->kind()) { - case LayoutDocEntry::BriefDesc: + case LayoutDocEntry::BriefDesc: writeBriefDescription(ol); - break; - case LayoutDocEntry::DirGraph: + break; + case LayoutDocEntry::DirGraph: writeDirectoryGraph(ol); - break; - case LayoutDocEntry::MemberDeclStart: + break; + case LayoutDocEntry::MemberDeclStart: startMemberDeclarations(ol); - break; - case LayoutDocEntry::DirSubDirs: + break; + case LayoutDocEntry::DirSubDirs: writeSubDirList(ol); - break; - case LayoutDocEntry::DirFiles: + break; + case LayoutDocEntry::DirFiles: writeFileList(ol); - 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)); @@ -573,16 +574,16 @@ void DirDefImpl::writeDocumentation(OutputList &ol) case LayoutDocEntry::FileConstantGroups: case LayoutDocEntry::FileIncludes: case LayoutDocEntry::FileIncludeGraph: - case LayoutDocEntry::FileIncludedByGraph: + case LayoutDocEntry::FileIncludedByGraph: case LayoutDocEntry::FileSourceLink: case LayoutDocEntry::FileInlineClasses: - 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::AuthorSection: case LayoutDocEntry::MemberGroups: @@ -624,7 +625,7 @@ void DirDefImpl::setLevel() /** Add as "uses" dependency between \a this dir and \a dir, * that was caused by a dependency on file \a fd. - */ + */ void DirDefImpl::addUsesDependency(DirDef *dir,FileDef *srcFd, FileDef *dstFd,bool inherited) { @@ -646,7 +647,7 @@ void DirDefImpl::addUsesDependency(DirDef *dir,FileDef *srcFd, if (usedPair==0) // new file dependency { //printf(" => new file\n"); - usedDir->addFileDep(srcFd,dstFd); + usedDir->addFileDep(srcFd,dstFd); added=TRUE; } else @@ -658,7 +659,7 @@ void DirDefImpl::addUsesDependency(DirDef *dir,FileDef *srcFd, { //printf(" => new file\n"); usedDir = new UsedDir(dir,inherited); - usedDir->addFileDep(srcFd,dstFd); + usedDir->addFileDep(srcFd,dstFd); m_usedDirs->insert(dir->getOutputFileBase(),usedDir); added=TRUE; } @@ -682,7 +683,7 @@ void DirDefImpl::addUsesDependency(DirDef *dir,FileDef *srcFd, void DirDefImpl::computeDependencies() { FileList *fl = m_fileList; - if (fl) + if (fl) { QListIterator<FileDef> fli(*fl); FileDef *fd; @@ -693,7 +694,7 @@ void DirDefImpl::computeDependencies() QList<IncludeInfo> *ifl = fd->includeFileList(); if (ifl) { - QListIterator<IncludeInfo> ifli(*ifl); + QListIterator<IncludeInfo> ifli(*ifl); IncludeInfo *ii; for (ifli.toFirst();(ii=ifli.current());++ifli) // foreach include file { @@ -727,10 +728,10 @@ void DirDefImpl::computeDependencies() bool DirDefImpl::isParentOf(const DirDef *dir) const { - if (dir->parent()==this) // this is a parent of dir + if (dir->parent()==this) // this is a parent of dir return TRUE; else if (dir->parent()) // repeat for the parent of dir - return isParentOf(dir->parent()); + return isParentOf(dir->parent()); else return FALSE; } @@ -822,7 +823,7 @@ DirDef *DirDefImpl::mergeDirectoryInTree(const QCString &path) QCString part=path.left(i+1); if (!matchPath(part,Config_getList(STRIP_FROM_PATH)) && (part!="/" && part!="//")) { - dir=createNewDir(part); + dir=createNewDir(part); } p=i+1; } @@ -833,7 +834,7 @@ DirDef *DirDefImpl::mergeDirectoryInTree(const QCString &path) static void writePartialDirPath(OutputList &ol,const DirDef *root,const DirDef *target) { - if (target->parent()!=root) + if (target->parent()!=root) { writePartialDirPath(ol,root,target->parent()); ol.writeString(" / "); @@ -910,7 +911,7 @@ void DirRelation::writeDocumentation(OutputList &ol) ol.writeString("</table>"); ol.endContents(); - + endFileWithNavPath(m_src,ol); ol.popGeneratorState(); @@ -936,7 +937,7 @@ static void computeCommonDirPrefix() int i=path.findRev('/',(int)path.length()-2); path=path.left(i+1); bool done=FALSE; - if (i==-1) + if (i==-1) { path=""; } @@ -1003,13 +1004,9 @@ static void computeCommonDirPrefix() void buildDirectories() { // for each input file - 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) { //printf("buildDirectories %s\n",fd->name().data()); if (fd->getReference().isEmpty()) @@ -1019,7 +1016,7 @@ void buildDirectories() { dir = DirDefImpl::mergeDirectoryInTree(fd->getPath()); } - if (dir && !fd->isDocumentationFile()) dir->addFile(fd); + if (dir && !fd->isDocumentationFile()) dir->addFile(fd.get()); } else { @@ -1040,9 +1037,9 @@ void buildDirectories() { DirDef *parent = Doxygen::directories->find(name.left(i+1)); //if (parent==0) parent=root; - if (parent) + if (parent) { - parent->addSubDir(dir); + parent->addSubDir(dir); //printf("DirDefImpl::addSubdir(): Adding subdir\n%s to\n%s\n", // dir->displayName().data(), parent->displayName().data()); } diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index 1b32787..53b2957 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -572,13 +572,9 @@ DB_GEN_C2("IndexSections " << is) { t << "</title>" << endl; bool isFirst=TRUE; - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - for (fnli.toFirst();(fn=fnli.current());++fnli) + for (const auto &fn : *Doxygen::inputNameLinkedMap) { - FileNameIterator fni(*fn); - const FileDef *fd; - for (;(fd=fni.current());++fni) + for (const auto &fd : *fn) { if (fd->isLinkableInProject()) { @@ -913,7 +909,7 @@ DB_GEN_C t << " <informalfigure>" << endl; t << " <mediaobject>" << endl; t << " <imageobject>" << endl; - t << " <imagedata width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" + t << " <imagedata width=\"50%\" align=\"center\" valign=\"middle\" scalefit=\"0\" fileref=\"" << relPath << fileName << ".png\">" << "</imagedata>" << endl; t << " </imageobject>" << endl; d.writeImage(t,m_dir,relPath,fileName,FALSE); diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index b9bd6aa..78af6e0 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -326,17 +326,17 @@ DB_VIS_C filter(s->text()); m_t << "</computeroutput></literallayout>"; break; - case DocVerbatim::HtmlOnly: + case DocVerbatim::HtmlOnly: break; - case DocVerbatim::RtfOnly: + case DocVerbatim::RtfOnly: break; - case DocVerbatim::ManOnly: + case DocVerbatim::ManOnly: break; - case DocVerbatim::LatexOnly: + case DocVerbatim::LatexOnly: break; - case DocVerbatim::XmlOnly: + case DocVerbatim::XmlOnly: break; - case DocVerbatim::DocbookOnly: + case DocVerbatim::DocbookOnly: m_t << s->text(); break; case DocVerbatim::Dot: @@ -484,7 +484,7 @@ DB_VIS_C extractBlock(inc->text(),inc->blockId()), langExt, inc->isExample(), - inc->exampleFile(), + inc->exampleFile(), fd, lineBlock(inc->text(),inc->blockId()), -1, // endLine @@ -496,8 +496,8 @@ DB_VIS_C m_t << "</computeroutput></literallayout>"; } break; - case DocInclude::SnippetDoc: - case DocInclude::IncludeDoc: + case DocInclude::SnippetDoc: + case DocInclude::IncludeDoc: err("Internal inconsistency: found switch SnippetDoc / IncludeDoc in file: %s" "Please create a bug report\n",__FILE__); break; @@ -678,152 +678,152 @@ DB_VIS_C switch(s->type()) { case DocSimpleSect::See: - if (m_insidePre) + if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trSeeAlso() << "</title>" << endl; - } - else + } + else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trSeeAlso()) << "</title>" << endl; } break; case DocSimpleSect::Return: - if (m_insidePre) + if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trReturns()<< "</title>" << endl; - } - else + } + else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trReturns()) << "</title>" << endl; } break; case DocSimpleSect::Author: - if (m_insidePre) + if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trAuthor(TRUE, TRUE) << "</title>" << endl; - } - else + } + else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trAuthor(TRUE, TRUE)) << "</title>" << endl; } break; case DocSimpleSect::Authors: - if (m_insidePre) + if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trAuthor(TRUE, FALSE) << "</title>" << endl; - } - else + } + else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trAuthor(TRUE, FALSE)) << "</title>" << endl; } break; case DocSimpleSect::Version: - if (m_insidePre) + if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trVersion() << "</title>" << endl; - } - else + } + else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trVersion()) << "</title>" << endl; } break; case DocSimpleSect::Since: - if (m_insidePre) + if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trSince() << "</title>" << endl; - } - else + } + else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trSince()) << "</title>" << endl; } break; case DocSimpleSect::Date: - if (m_insidePre) + if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trDate() << "</title>" << endl; - } - else + } + else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trDate()) << "</title>" << endl; } break; case DocSimpleSect::Note: - if (m_insidePre) + if (m_insidePre) { m_t << "<note><title>" << theTranslator->trNote() << "</title>" << endl; - } - else + } + else { m_t << "<note><title>" << convertToDocBook(theTranslator->trNote()) << "</title>" << endl; } break; case DocSimpleSect::Warning: - if (m_insidePre) + if (m_insidePre) { m_t << "<warning><title>" << theTranslator->trWarning() << "</title>" << endl; - } - else + } + else { m_t << "<warning><title>" << convertToDocBook(theTranslator->trWarning()) << "</title>" << endl; } break; case DocSimpleSect::Pre: - if (m_insidePre) + if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trPrecondition() << "</title>" << endl; - } - else + } + else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trPrecondition()) << "</title>" << endl; } break; case DocSimpleSect::Post: - if (m_insidePre) + if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trPostcondition() << "</title>" << endl; - } - else + } + else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trPostcondition()) << "</title>" << endl; } break; case DocSimpleSect::Copyright: - if (m_insidePre) + if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trCopyright() << "</title>" << endl; - } - else + } + else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trCopyright()) << "</title>" << endl; } break; case DocSimpleSect::Invar: - if (m_insidePre) + if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trInvariant() << "</title>" << endl; - } - else + } + else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trInvariant()) << "</title>" << endl; } break; case DocSimpleSect::Remark: // <remark> is miising the <title> possibility - if (m_insidePre) + if (m_insidePre) { m_t << "<formalpara><title>" << theTranslator->trRemarks() << "</title>" << endl; - } - else + } + else { m_t << "<formalpara><title>" << convertToDocBook(theTranslator->trRemarks()) << "</title>" << endl; } break; case DocSimpleSect::Attention: - if (m_insidePre) + if (m_insidePre) { m_t << "<caution><title>" << theTranslator->trAttention() << "</title>" << endl; - } - else + } + else { m_t << "<caution><title>" << convertToDocBook(theTranslator->trAttention()) << "</title>" << endl; } @@ -1229,8 +1229,8 @@ DB_VIS_C } QCString m_file; bool ambig; - FileDef *fd=findFileDef(Doxygen::imageNameDict, baseName, ambig); - if (fd) + FileDef *fd=findFileDef(Doxygen::imageNameLinkedMap, baseName, ambig); + if (fd) { m_file=fd->absFilePath(); } @@ -1247,8 +1247,8 @@ DB_VIS_C delete[] buffer; } } - } - else + } + else { popEnabled(); } diff --git a/src/docparser.cpp b/src/docparser.cpp index a9be280..7ece3ef 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -281,7 +281,7 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool { QCString result; bool ambig; - FileDef *fd = findFileDef(Doxygen::imageNameDict,fileName,ambig); + FileDef *fd = findFileDef(Doxygen::imageNameLinkedMap,fileName,ambig); //printf("Search for %s\n",fileName); if (fd) { @@ -290,7 +290,7 @@ static QCString findAndCopyImage(const char *fileName,DocImage::Type type, bool QCString text; text.sprintf("image file name %s is ambiguous.\n",qPrint(fileName)); text+="Possible candidates:\n"; - text+=showFileDefMatches(Doxygen::imageNameDict,fileName); + text+=showFileDefMatches(Doxygen::imageNameLinkedMap,fileName); warn_doc_error(g_fileName,doctokenizerYYlineno,"%s", text.data()); } @@ -773,7 +773,7 @@ static bool findDocsForMemberOrCompound(const char *commandName, return TRUE; } bool ambig; - fd = findFileDef(Doxygen::inputNameDict,cmdArg,ambig); + fd = findFileDef(Doxygen::inputNameLinkedMap,cmdArg,ambig); if (fd && !ambig) // file { *pDoc=fd->documentation(); @@ -1060,7 +1060,7 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children,bool ignor uint len = g_token->name.length(); ClassDef *cd=0; bool ambig; - FileDef *fd = findFileDef(Doxygen::inputNameDict,g_fileName,ambig); + FileDef *fd = findFileDef(Doxygen::inputNameLinkedMap,g_fileName,ambig); //printf("handleLinkedWord(%s) g_context=%s\n",g_token->name.data(),g_context.data()); if (!g_insideHtmlLink && (resolveRef(g_context,g_token->name,g_inSeeBlock,&compound,&member,TRUE,fd,TRUE) @@ -1857,7 +1857,7 @@ static void readTextFileByName(const QCString &file,QCString &text) // as a fallback we also look in the exampleNameDict bool ambig; - FileDef *fd = findFileDef(Doxygen::exampleNameDict,file,ambig); + FileDef *fd = findFileDef(Doxygen::exampleNameLinkedMap,file,ambig); if (fd) { text = fileToString(fd->absFilePath(),Config_getBool(FILTER_SOURCE_FILES)); @@ -1865,7 +1865,7 @@ static void readTextFileByName(const QCString &file,QCString &text) { warn_doc_error(g_fileName,doctokenizerYYlineno,"included file name %s is ambiguous" "Possible candidates:\n%s",qPrint(file), - qPrint(showFileDefMatches(Doxygen::exampleNameDict,file)) + qPrint(showFileDefMatches(Doxygen::exampleNameLinkedMap,file)) ); } } @@ -2752,10 +2752,10 @@ bool DocDotFile::parse() defaultHandleTitleAndSize(CMD_DOTFILE,this,m_children,m_width,m_height); bool ambig; - FileDef *fd = findFileDef(Doxygen::dotFileNameDict,m_name,ambig); + FileDef *fd = findFileDef(Doxygen::dotFileNameLinkedMap,m_name,ambig); if (fd==0 && m_name.right(4)!=".dot") // try with .dot extension as well { - fd = findFileDef(Doxygen::dotFileNameDict,m_name+".dot",ambig); + fd = findFileDef(Doxygen::dotFileNameLinkedMap,m_name+".dot",ambig); } if (fd) { @@ -2765,7 +2765,7 @@ bool DocDotFile::parse() { warn_doc_error(g_fileName,doctokenizerYYlineno,"included dot file name %s is ambiguous.\n" "Possible candidates:\n%s",qPrint(m_name), - qPrint(showFileDefMatches(Doxygen::dotFileNameDict,m_name)) + qPrint(showFileDefMatches(Doxygen::dotFileNameLinkedMap,m_name)) ); } } @@ -2789,10 +2789,10 @@ bool DocMscFile::parse() defaultHandleTitleAndSize(CMD_MSCFILE,this,m_children,m_width,m_height); bool ambig; - FileDef *fd = findFileDef(Doxygen::mscFileNameDict,m_name,ambig); + FileDef *fd = findFileDef(Doxygen::mscFileNameLinkedMap,m_name,ambig); if (fd==0 && m_name.right(4)!=".msc") // try with .msc extension as well { - fd = findFileDef(Doxygen::mscFileNameDict,m_name+".msc",ambig); + fd = findFileDef(Doxygen::mscFileNameLinkedMap,m_name+".msc",ambig); } if (fd) { @@ -2802,7 +2802,7 @@ bool DocMscFile::parse() { warn_doc_error(g_fileName,doctokenizerYYlineno,"included msc file name %s is ambiguous.\n" "Possible candidates:\n%s",qPrint(m_name), - qPrint(showFileDefMatches(Doxygen::mscFileNameDict,m_name)) + qPrint(showFileDefMatches(Doxygen::mscFileNameLinkedMap,m_name)) ); } } @@ -2828,10 +2828,10 @@ bool DocDiaFile::parse() defaultHandleTitleAndSize(CMD_DIAFILE,this,m_children,m_width,m_height); bool ambig; - FileDef *fd = findFileDef(Doxygen::diaFileNameDict,m_name,ambig); + FileDef *fd = findFileDef(Doxygen::diaFileNameLinkedMap,m_name,ambig); if (fd==0 && m_name.right(4)!=".dia") // try with .dia extension as well { - fd = findFileDef(Doxygen::diaFileNameDict,m_name+".dia",ambig); + fd = findFileDef(Doxygen::diaFileNameLinkedMap,m_name+".dia",ambig); } if (fd) { @@ -2841,7 +2841,7 @@ bool DocDiaFile::parse() { warn_doc_error(g_fileName,doctokenizerYYlineno,"included dia file name %s is ambiguous.\n" "Possible candidates:\n%s",qPrint(m_name), - qPrint(showFileDefMatches(Doxygen::diaFileNameDict,m_name)) + qPrint(showFileDefMatches(Doxygen::diaFileNameLinkedMap,m_name)) ); } } diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 19c7f2c..2b0d11f 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -121,19 +121,18 @@ ClassSDict *Doxygen::hiddenClasses = 0; NamespaceSDict *Doxygen::namespaceSDict = 0; MemberNameSDict *Doxygen::memberNameSDict = 0; MemberNameSDict *Doxygen::functionNameSDict = 0; -FileNameList *Doxygen::inputNameList = 0; // all input files -FileNameDict *Doxygen::inputNameDict = 0; +FileNameLinkedMap *Doxygen::inputNameLinkedMap = 0; GroupSDict *Doxygen::groupSDict = 0; PageSDict *Doxygen::pageSDict = 0; PageSDict *Doxygen::exampleSDict = 0; StringDict Doxygen::aliasDict(257); // aliases QDict<void> Doxygen::inputPaths(1009); -FileNameDict *Doxygen::includeNameDict = 0; // include names -FileNameDict *Doxygen::exampleNameDict = 0; // examples -FileNameDict *Doxygen::imageNameDict = 0; // images -FileNameDict *Doxygen::dotFileNameDict = 0; // dot files -FileNameDict *Doxygen::mscFileNameDict = 0; // msc files -FileNameDict *Doxygen::diaFileNameDict = 0; // dia files +FileNameLinkedMap *Doxygen::includeNameLinkedMap = 0; // include names +FileNameLinkedMap *Doxygen::exampleNameLinkedMap = 0; // examples +FileNameLinkedMap *Doxygen::imageNameLinkedMap = 0; // images +FileNameLinkedMap *Doxygen::dotFileNameLinkedMap = 0; // dot files +FileNameLinkedMap *Doxygen::mscFileNameLinkedMap = 0; // msc files +FileNameLinkedMap *Doxygen::diaFileNameLinkedMap = 0; // dia files StringDict Doxygen::namespaceAliasDict(257); // all namespace aliases StringDict Doxygen::tagDestinationDict(257); // all tag locations QDict<void> Doxygen::expandAsDefinedDict(257); // all macros that should be expanded @@ -187,14 +186,13 @@ void clearAll() Doxygen::namespaceSDict->clear(); Doxygen::pageSDict->clear(); Doxygen::exampleSDict->clear(); - Doxygen::inputNameList->clear(); - Doxygen::inputNameDict->clear(); - Doxygen::includeNameDict->clear(); - Doxygen::exampleNameDict->clear(); - Doxygen::imageNameDict->clear(); - Doxygen::dotFileNameDict->clear(); - Doxygen::mscFileNameDict->clear(); - Doxygen::diaFileNameDict->clear(); + Doxygen::inputNameLinkedMap->clear(); + Doxygen::includeNameLinkedMap->clear(); + Doxygen::exampleNameLinkedMap->clear(); + Doxygen::imageNameLinkedMap->clear(); + Doxygen::dotFileNameLinkedMap->clear(); + Doxygen::mscFileNameLinkedMap->clear(); + Doxygen::diaFileNameLinkedMap->clear(); Doxygen::tagDestinationDict.clear(); SectionManager::instance().clear(); CitationManager::instance().clear(); @@ -249,8 +247,9 @@ class Statistics void statistics() { - fprintf(stderr,"--- inputNameDict stats ----\n"); - Doxygen::inputNameDict->statistics(); +#if 0 + fprintf(stderr,"--- inputNameLinkedMap stats ----\n"); + Doxygen::inputNameLinkedMap->statistics(); fprintf(stderr,"--- includeNameDict stats ----\n"); Doxygen::includeNameDict->statistics(); fprintf(stderr,"--- exampleNameDict stats ----\n"); @@ -263,6 +262,7 @@ void statistics() Doxygen::mscFileNameDict->statistics(); fprintf(stderr,"--- diaFileNameDict stats ----\n"); Doxygen::diaFileNameDict->statistics(); +#endif //fprintf(stderr,"--- g_excludeNameDict stats ----\n"); //g_excludeNameDict.statistics(); fprintf(stderr,"--- aliasDict stats ----\n"); @@ -505,7 +505,7 @@ static void buildFileList(const Entry *root) ) { bool ambig; - FileDef *fd=findFileDef(Doxygen::inputNameDict,root->name,ambig); + FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,root->name,ambig); if (!fd || ambig) { int save_ambig = ambig; @@ -513,7 +513,7 @@ static void buildFileList(const Entry *root) // directory as the describing file. QCString fn = root->fileName; int newIndex=fn.findRev('/'); - fd=findFileDef(Doxygen::inputNameDict,fn.left(newIndex) + "/" + root->name,ambig); + fd=findFileDef(Doxygen::inputNameLinkedMap,fn.left(newIndex) + "/" + root->name,ambig); if (!fd) ambig = save_ambig; } //printf("**************** root->name=%s fd=%p\n",root->name.data(),fd); @@ -548,7 +548,7 @@ static void buildFileList(const Entry *root) if (ambig) // name is ambiguous { text+="matches the following input files:\n"; - text+=showFileDefMatches(Doxygen::inputNameDict,root->name); + text+=showFileDefMatches(Doxygen::inputNameLinkedMap,root->name); text+="Please use a more specific name by " "including a (larger) part of the path!"; } @@ -591,7 +591,7 @@ static void addIncludeFile(ClassDef *cd,FileDef *ifd,const Entry *root) // see if we need to include a verbatim copy of the header file //printf("root->includeFile=%s\n",root->includeFile.data()); if (!includeFile.isEmpty() && - (fd=findFileDef(Doxygen::inputNameDict,includeFile,ambig))==0 + (fd=findFileDef(Doxygen::inputNameLinkedMap,includeFile,ambig))==0 ) { // explicit request QCString text; @@ -602,7 +602,7 @@ static void addIncludeFile(ClassDef *cd,FileDef *ifd,const Entry *root) if (ambig) // name is ambiguous { text+="matches the following input files:\n"; - text+=showFileDefMatches(Doxygen::inputNameDict,root->includeFile); + text+=showFileDefMatches(Doxygen::inputNameLinkedMap,root->includeFile); text+="Please use a more specific name by " "including a (larger) part of the path!"; } @@ -1951,24 +1951,18 @@ static void findUsingDeclImports(const Entry *root) static void findIncludedUsingDirectives() { // first mark all files as not visited - 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) { fd->setVisited(FALSE); } } // then recursively add using directives found in #include files // to files that have not been visited. - for (fnli.toFirst();(fn=fnli.current());++fnli) + for (const auto &fn : *Doxygen::inputNameLinkedMap) { - FileNameIterator fni(*fn); - FileDef *fd; - for (fni.toFirst();(fd=fni.current());++fni) + for (const auto &fd : *fn) { if (!fd->isVisited()) { @@ -4874,13 +4868,9 @@ static void computeMemberReferences() { cd->computeAnchors(); } - 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) { fd->computeAnchors(); } @@ -4913,13 +4903,9 @@ static void addListReferences() } } - 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) { fd->addListReferences(); } @@ -7548,7 +7534,7 @@ static void buildCompleteMemberLists() static void generateFileSources() { - if (Doxygen::inputNameList->count()>0) + if (!Doxygen::inputNameLinkedMap->empty()) { #if USE_LIBCLANG static bool clangAssistedParsing = Config_getBool(CLANG_ASSISTED_PARSING); @@ -7558,23 +7544,17 @@ static void generateFileSources() // create a dictionary with files to process QDict<void> g_filesToProcess(10007); - 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) { g_filesToProcess.insert(fd->absFilePath(),(void*)0x8); } } // process source files (and their include dependencies) - 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) { if (fd->isSource() && !fd->isReference()) { @@ -7601,7 +7581,7 @@ static void generateFileSources() { QStrList moreFiles; bool ambig; - FileDef *ifd=findFileDef(Doxygen::inputNameDict,incFile,ambig); + FileDef *ifd=findFileDef(Doxygen::inputNameLinkedMap,incFile,ambig); if (ifd && !ifd->isReference()) { if (ifd->generateSourceFile() && !g_useOutputTemplate) // sources need to be shown in the output @@ -7627,11 +7607,9 @@ static void generateFileSources() } } // process remaining files - 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) { if (!g_processedFiles.find(fd->absFilePath())) // not yet processed { @@ -7657,13 +7635,9 @@ static void generateFileSources() else #endif { - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - for (;(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) { QStrList filesInSameTu; fd->startParsing(); @@ -7692,15 +7666,11 @@ static void generateFileDocs() { if (documentedHtmlFiles==0) return; - if (Doxygen::inputNameList->count()>0) + if (!Doxygen::inputNameLinkedMap->empty()) { - 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 (fni.toFirst();(fd=fni.current());++fni) + for (const auto &fd : *fn) { bool doc = fd->isLinkableInProject(); if (doc) @@ -7814,13 +7784,9 @@ static void sortMemberLists() } // sort file member lists - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - for (;(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) { fd->sortMemberLists(); } @@ -7845,34 +7811,6 @@ static void setAnonymousEnumType() { cd->setAnonymousEnumType(); } - -#if 0 - NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); - NamespaceDef *nd=0; - for (nli.toFirst();(nd=nli.current());++nli) - { - nd->setAnonymousEnumType(); - } - - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - for (;(fn=fnli.current());++fnli) - { - FileNameIterator fni(*fn); - FileDef *fd; - for (;(fd=fni.current());++fni) - { - fd->setAnonymousEnumType(); - } - } - - GroupSDict::Iterator gli(*Doxygen::groupSDict); - GroupDef *gd; - for (gli.toFirst();(gd=gli.current());++gli) - { - gd->setAnonymousEnumType(); - } -#endif } //---------------------------------------------------------------------------- @@ -7893,13 +7831,9 @@ static void countMembers() nd->countMembers(); } - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - for (;(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) { fd->countMembers(); } @@ -7995,22 +7929,16 @@ static void inheritDocumentation() static void combineUsingRelations() { // for each file - 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 (fni.toFirst();(fd=fni.current());++fni) + for (const auto &fd : *fn) { fd->setVisited(FALSE); } } - for (fnli.toFirst();(fn=fnli.current());++fnli) + for (const auto &fn : *Doxygen::inputNameLinkedMap) { - FileNameIterator fni(*fn); - FileDef *fd; - for (fni.toFirst();(fd=fni.current());++fni) + for (const auto &fd : *fn) { fd->combineUsingRelations(); } @@ -8041,13 +7969,9 @@ static void addMembersToMemberGroup() cd->addMembersToMemberGroup(); } // for each file - 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 (fni.toFirst();(fd=fni.current());++fni) + for (const auto &fd : *fn) { fd->addMembersToMemberGroup(); } @@ -8080,13 +8004,9 @@ static void distributeMemberGroupDocumentation() cd->distributeMemberGroupDocumentation(); } // for each file - 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 (fni.toFirst();(fd=fni.current());++fni) + for (const auto &fd : *fn) { fd->distributeMemberGroupDocumentation(); } @@ -8119,13 +8039,9 @@ static void findSectionsInDocumentation() cd->findSectionsInDocumentation(); } // for each file - 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 (fni.toFirst();(fd=fni.current());++fni) + for (const auto &fd : *fn) { fd->findSectionsInDocumentation(); } @@ -9110,6 +9026,70 @@ static void copyExtraFiles(QStrList files,const QCString &filesOption,const QCSt //---------------------------------------------------------------------------- +static void generateDiskNames() +{ + for (const auto &fn : *Doxygen::inputNameLinkedMap) + { + struct FileEntry + { + FileEntry(const QCString &p,FileDef *fd) : path(p), fileDef(fd) {} + QCString path; + FileDef *fileDef; + }; + + // collect the entry for which to compute the longest common prefix (LCP) of the path + std::vector<FileEntry> fileEntries; + for (const auto &fd : *fn) + { + if (!fd->isReference()) // skip external references + { + fileEntries.emplace_back(fd->getPath(),fd.get()); + } + } + + size_t size = fileEntries.size(); + + if (size==1) // name if unique, so diskname is simply the name + { + FileDef *fd = fileEntries[0].fileDef; + fd->setDiskName(fn->fileName()); + } + else if (size>1) // multiple occurrences of the same file name + { + // sort the array + std::sort(fileEntries.begin(), + fileEntries.end(), + [](const FileEntry &fe1,const FileEntry &fe2) + { return qstrcmp(fe1.path.data(),fe2.path.data()); } + ); + + // since the entries are sorted, the common prefix of the whole array is same + // as the common prefix between the first and last entry + const FileEntry &first = fileEntries[0]; + const FileEntry &last = fileEntries[size-1]; + int j=0; + for (size_t i=0;i<first.path.size() && i<last.path.size();i++) + { + if (first.path[i]=='/') j=i; + if (first.path[i]!=last.path[i]) break; + } + + // add non-common part of the path to the name + for (auto &fileEntry : fileEntries) + { + QCString prefix = fileEntry.path.right(fileEntry.path.length()-j-1); + fileEntry.fileDef->setName(prefix+fn->fileName()); + //printf("!!!!!!!! non unique disk name=%s:%s\n",prefix.data(),fn->fileName()); + fileEntry.fileDef->setDiskName(prefix+fn->fileName()); + } + } + } +} + + + +//---------------------------------------------------------------------------- + static OutlineParserInterface &getParserForFile(const char *fn) { QCString fileName=fn; @@ -9211,7 +9191,7 @@ static void parseFiles(const std::shared_ptr<Entry> &root) for (it.toFirst();(s=it.current());++it) { bool ambig; - FileDef *fd=findFileDef(Doxygen::inputNameDict,s->data(),ambig); + FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,s->data(),ambig); ASSERT(fd!=0); if (fd->isSource() && !fd->isReference()) // this is a source file { @@ -9228,7 +9208,7 @@ static void parseFiles(const std::shared_ptr<Entry> &root) { if (qstrcmp(incFile,s->data()) && !g_processedFiles.find(incFile)) { - FileDef *ifd=findFileDef(Doxygen::inputNameDict,incFile,ambig); + FileDef *ifd=findFileDef(Doxygen::inputNameLinkedMap,incFile,ambig); if (ifd && !ifd->isReference()) { QStrList moreFiles; @@ -9250,7 +9230,7 @@ static void parseFiles(const std::shared_ptr<Entry> &root) { bool ambig; QStrList filesInSameTu; - FileDef *fd=findFileDef(Doxygen::inputNameDict,s->data(),ambig); + FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,s->data(),ambig); ASSERT(fd!=0); OutlineParserInterface &parser = getParserForFile(s->data()); parser.startTranslationUnit(s->data()); @@ -9269,7 +9249,7 @@ static void parseFiles(const std::shared_ptr<Entry> &root) { bool ambig; QStrList filesInSameTu; - FileDef *fd=findFileDef(Doxygen::inputNameDict,s->data(),ambig); + FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,s->data(),ambig); ASSERT(fd!=0); OutlineParserInterface &parser = getParserForFile(s->data()); parser.startTranslationUnit(s->data()); @@ -9355,8 +9335,7 @@ static QDict<void> g_pathsVisited(1009); // The contents of all files is append to the input string int readDir(QFileInfo *fi, - FileNameList *fnList, - FileNameDict *fnDict, + FileNameLinkedMap *fnMap, StringDict *exclDict, QStrList *patList, QStrList *exclPatList, @@ -9414,20 +9393,18 @@ int readDir(QFileInfo *fi, totalSize+=cfi->size()+cfi->absFilePath().length()+4; QCString name=cfi->fileName().utf8(); //printf("New file %s\n",name.data()); - if (fnDict) + if (fnMap) { - FileDef *fd=createFileDef(cfi->dirPath().utf8()+"/",name); + std::unique_ptr<FileDef> fd { createFileDef(cfi->dirPath().utf8()+"/",name) }; FileName *fn=0; - if (!name.isEmpty() && (fn=(*fnDict)[name])) + if (!name.isEmpty() && (fn=fnMap->find(name))) { - fn->append(fd); + fn->push_back(std::move(fd)); } else { - fn = new FileName(cfi->absFilePath().utf8(),name); - fn->append(fd); - if (fnList) fnList->append(fn); - fnDict->insert(name,fn); + fn = fnMap->add(name,cfi->absFilePath().utf8()); + fn->push_back(std::move(fd)); } } QCString *rs=0; @@ -9446,7 +9423,7 @@ int readDir(QFileInfo *fi, cfi->fileName().at(0)!='.') // skip "." ".." and ".dir" { cfi->setFile(cfi->absFilePath()); - totalSize+=readDir(cfi,fnList,fnDict,exclDict, + totalSize+=readDir(cfi,fnMap,exclDict, patList,exclPatList,resultList,resultDict,errorIfNotExist, recursive,killDict,paths); } @@ -9463,8 +9440,7 @@ int readDir(QFileInfo *fi, // input string. The names of the files are appended to the 'fiList' list. int readFileOrDirectory(const char *s, - FileNameList *fnList, - FileNameDict *fnDict, + FileNameLinkedMap *fnMap, StringDict *exclDict, QStrList *patList, QStrList *exclPatList, @@ -9513,20 +9489,18 @@ int readFileOrDirectory(const char *s, //fiList->inSort(new FileInfo(fi)); QCString name=fi.fileName().utf8(); //printf("New file %s\n",name.data()); - if (fnDict) + if (fnMap) { - FileDef *fd=createFileDef(dirPath+"/",name); + std::unique_ptr<FileDef> fd { createFileDef(dirPath+"/",name) }; FileName *fn=0; - if (!name.isEmpty() && (fn=(*fnDict)[name])) + if (!name.isEmpty() && (fn=fnMap->find(name))) { - fn->append(fd); + fn->push_back(std::move(fd)); } else { - fn = new FileName(filePath,name); - fn->append(fd); - if (fnList) fnList->append(fn); - fnDict->insert(name,fn); + fn = fnMap->add(name,filePath); + fn->push_back(std::move(fd)); } } QCString *rs=0; @@ -9542,7 +9516,7 @@ int readFileOrDirectory(const char *s, } else if (fi.isDir()) // readable dir { - totalSize+=readDir(&fi,fnList,fnDict,exclDict,patList, + totalSize+=readDir(&fi,fnMap,exclDict,patList, exclPatList,resultList,resultDict,errorIfNotExist, recursive,killDict,paths); } @@ -9825,8 +9799,6 @@ void initDoxygen() #ifdef USE_LIBCLANG Doxygen::clangUsrMap = new QDict<Definition>(50177); #endif - Doxygen::inputNameList = new FileNameList; - Doxygen::inputNameList->setAutoDelete(TRUE); Doxygen::memberNameSDict = new MemberNameSDict(10000); Doxygen::memberNameSDict->setAutoDelete(TRUE); Doxygen::functionNameSDict = new MemberNameSDict(10000); @@ -9854,13 +9826,13 @@ void initDoxygen() // initialisation of these globals depends on // configuration switches so we need to postpone these Doxygen::globalScope = 0; - Doxygen::inputNameDict = 0; - Doxygen::includeNameDict = 0; - Doxygen::exampleNameDict = 0; - Doxygen::imageNameDict = 0; - Doxygen::dotFileNameDict = 0; - Doxygen::mscFileNameDict = 0; - Doxygen::diaFileNameDict = 0; + Doxygen::inputNameLinkedMap = 0; + Doxygen::includeNameLinkedMap = 0; + Doxygen::exampleNameLinkedMap = 0; + Doxygen::imageNameLinkedMap = 0; + Doxygen::dotFileNameLinkedMap = 0; + Doxygen::mscFileNameLinkedMap = 0; + Doxygen::diaFileNameLinkedMap = 0; /************************************************************************** * Initialize some global constants @@ -9882,13 +9854,13 @@ void cleanUpDoxygen() delete Doxygen::indexList; delete Doxygen::genericsDict; - delete Doxygen::inputNameDict; - delete Doxygen::includeNameDict; - delete Doxygen::exampleNameDict; - delete Doxygen::imageNameDict; - delete Doxygen::dotFileNameDict; - delete Doxygen::mscFileNameDict; - delete Doxygen::diaFileNameDict; + delete Doxygen::inputNameLinkedMap; + delete Doxygen::includeNameLinkedMap; + delete Doxygen::exampleNameLinkedMap; + delete Doxygen::imageNameLinkedMap; + delete Doxygen::dotFileNameLinkedMap; + delete Doxygen::mscFileNameLinkedMap; + delete Doxygen::diaFileNameLinkedMap; delete Doxygen::mainPage; delete Doxygen::pageSDict; delete Doxygen::exampleSDict; @@ -9919,7 +9891,6 @@ void cleanUpDoxygen() } } - delete Doxygen::inputNameList; delete Doxygen::memberNameSDict; delete Doxygen::functionNameSDict; delete Doxygen::groupSDict; @@ -10341,18 +10312,13 @@ void checkConfiguration() void adjustConfiguration() { Doxygen::globalScope = createNamespaceDef("<globalScope>",1,1,"<globalScope>"); - Doxygen::inputNameDict = new FileNameDict(10007); - Doxygen::includeNameDict = new FileNameDict(10007); - Doxygen::exampleNameDict = new FileNameDict(1009); - Doxygen::exampleNameDict->setAutoDelete(TRUE); - Doxygen::imageNameDict = new FileNameDict(257); - Doxygen::imageNameDict->setAutoDelete(TRUE); - Doxygen::dotFileNameDict = new FileNameDict(257); - Doxygen::dotFileNameDict->setAutoDelete(TRUE); - Doxygen::mscFileNameDict = new FileNameDict(257); - Doxygen::mscFileNameDict->setAutoDelete(TRUE); - Doxygen::diaFileNameDict = new FileNameDict(257); - Doxygen::diaFileNameDict->setAutoDelete(TRUE); + Doxygen::inputNameLinkedMap = new FileNameLinkedMap; + Doxygen::includeNameLinkedMap = new FileNameLinkedMap; + Doxygen::exampleNameLinkedMap = new FileNameLinkedMap; + Doxygen::imageNameLinkedMap = new FileNameLinkedMap; + Doxygen::dotFileNameLinkedMap = new FileNameLinkedMap; + Doxygen::mscFileNameLinkedMap = new FileNameLinkedMap; + Doxygen::diaFileNameLinkedMap = new FileNameLinkedMap; QCString outputLanguage=Config_getEnum(OUTPUT_LANGUAGE); if (!setTranslator(outputLanguage)) @@ -10482,13 +10448,9 @@ static void writeTagFile() tagFile << "<tagfile>" << endl; // for each file - 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 (fni.toFirst();(fd=fni.current());++fni) + for (const auto &fd : *fn) { if (fd->isLinkableInProject()) fd->writeTagFile(tagFile); } @@ -10627,7 +10589,7 @@ void searchInputFiles() { pl = Config_getList(FILE_PATTERNS); } - readFileOrDirectory(s,0,Doxygen::includeNameDict,0,&pl, + readFileOrDirectory(s,Doxygen::includeNameLinkedMap,0,&pl, &exclPatterns,0,0, alwaysRecursive, TRUE,killDict); @@ -10641,7 +10603,7 @@ void searchInputFiles() s=examplePathList.first(); while (s) { - readFileOrDirectory(s,0,Doxygen::exampleNameDict,0, + readFileOrDirectory(s,Doxygen::exampleNameLinkedMap,0, &Config_getList(EXAMPLE_PATTERNS), 0,0,0, (alwaysRecursive || Config_getBool(EXAMPLE_RECURSIVE)), @@ -10656,7 +10618,7 @@ void searchInputFiles() s=imagePathList.first(); while (s) { - readFileOrDirectory(s,0,Doxygen::imageNameDict,0,0, + readFileOrDirectory(s,Doxygen::imageNameLinkedMap,0,0, 0,0,0, alwaysRecursive, TRUE,killDict); @@ -10670,7 +10632,7 @@ void searchInputFiles() s=dotFileList.first(); while (s) { - readFileOrDirectory(s,0,Doxygen::dotFileNameDict,0,0, + readFileOrDirectory(s,Doxygen::dotFileNameLinkedMap,0,0, 0,0,0, alwaysRecursive, TRUE,killDict); @@ -10684,7 +10646,7 @@ void searchInputFiles() s=mscFileList.first(); while (s) { - readFileOrDirectory(s,0,Doxygen::mscFileNameDict,0,0, + readFileOrDirectory(s,Doxygen::mscFileNameLinkedMap,0,0, 0,0,0, alwaysRecursive, TRUE,killDict); @@ -10698,7 +10660,7 @@ void searchInputFiles() s=diaFileList.first(); while (s) { - readFileOrDirectory(s,0,Doxygen::diaFileNameDict,0,0, + readFileOrDirectory(s,Doxygen::diaFileNameLinkedMap,0,0, 0,0,0, alwaysRecursive, TRUE,killDict); @@ -10711,7 +10673,7 @@ void searchInputFiles() s=excludeList.first(); while (s) { - readFileOrDirectory(s,0,0,0,&Config_getList(FILE_PATTERNS), + readFileOrDirectory(s,0,0,&Config_getList(FILE_PATTERNS), 0,0,&excludeNameDict, alwaysRecursive, FALSE); @@ -10739,8 +10701,7 @@ void searchInputFiles() readFileOrDirectory( path, - Doxygen::inputNameList, - Doxygen::inputNameDict, + Doxygen::inputNameLinkedMap, &excludeNameDict, &Config_getList(FILE_PATTERNS), &exclPatterns, @@ -10752,7 +10713,13 @@ void searchInputFiles() } s=inputList.next(); } - Doxygen::inputNameList->sort(); + std::sort(Doxygen::inputNameLinkedMap->begin(),Doxygen::inputNameLinkedMap->end(), + [](FileNameLinkedMap::Ptr &f1,FileNameLinkedMap::Ptr &f2) + { + return Config_getBool(FULL_PATH_NAMES) ? + qstricmp(f1->fullName(),f2->fullName()) : + qstricmp(f1->fileName(),f2->fileName()); + }); g_s.end(); delete killDict; @@ -11201,7 +11168,7 @@ void parseInput() // compute the shortest possible names of all files // without losing the uniqueness of the file names. g_s.begin("Generating disk names...\n"); - Doxygen::inputNameList->generateDiskNames(); + generateDiskNames(); g_s.end(); g_s.begin("Adding source references...\n"); diff --git a/src/doxygen.h b/src/doxygen.h index f549261..f8f09bd 100644 --- a/src/doxygen.h +++ b/src/doxygen.h @@ -46,8 +46,7 @@ class ClassDef; class ClassSDict; class GenericsSDict; class MemberNameSDict; -class FileNameDict; -class FileNameList; +class FileNameLinkedMap; class NamespaceSDict; class NamespaceDef; class DefinitionIntf; @@ -98,15 +97,14 @@ class Doxygen static PageSDict *pageSDict; static PageDef *mainPage; static bool insideMainPage; - static FileNameDict *includeNameDict; - static FileNameDict *exampleNameDict; + static FileNameLinkedMap *includeNameLinkedMap; + static FileNameLinkedMap *exampleNameLinkedMap; static QDict<void> inputPaths; - static FileNameDict *inputNameDict; - static FileNameList *inputNameList; - static FileNameDict *imageNameDict; - static FileNameDict *dotFileNameDict; - static FileNameDict *mscFileNameDict; - static FileNameDict *diaFileNameDict; + static FileNameLinkedMap *inputNameLinkedMap; + static FileNameLinkedMap *imageNameLinkedMap; + static FileNameLinkedMap *dotFileNameLinkedMap; + static FileNameLinkedMap *mscFileNameLinkedMap; + static FileNameLinkedMap *diaFileNameLinkedMap; static QStrList tagfileList; static MemberNameSDict *memberNameSDict; static MemberNameSDict *functionNameSDict; @@ -156,8 +154,7 @@ void readAliases(); void readFormulaRepository(QCString dir, bool cmp = FALSE); void cleanUpDoxygen(); int readFileOrDirectory(const char *s, - FileNameList *fnList, - FileNameDict *fnDict, + FileNameLinkedMap *fnDict, StringDict *exclDict, QStrList *patList, QStrList *exclPatList, @@ -169,8 +166,7 @@ int readFileOrDirectory(const char *s, QDict<void> *paths = 0 ); int readDir(QFileInfo *fi, - FileNameList *fnList, - FileNameDict *fnDict, + FileNameLinkedMap *fnDict, StringDict *exclDict, QStrList *patList, QStrList *exclPatList, 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 { diff --git a/src/filename.cpp b/src/filename.cpp deleted file mode 100644 index 637fe33..0000000 --- a/src/filename.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/****************************************************************************** - * - * - * - * 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 - * for any purpose. It is provided "as is" without express or implied warranty. - * See the GNU General Public License for more details. - * - * Documents produced by Doxygen are derivative works derived from the - * input used in their production; they are not affected by this license. - * - */ - -#include "filename.h" -#include "util.h" -#include "config.h" - -FileName::FileName(const char *fn,const char *n) : FileList() -{ - setAutoDelete(TRUE); - fName=fn; - name=n; -} - -FileName::~FileName() -{ -} - - -void FileName::generateDiskNames() -{ - //QCString commonPrefix; - QListIterator<FileDef> it(*this); - FileDef *fd; - int count=0; - for (;(fd=it.current());++it) - { - if (!fd->isReference()) count++; - } - if (count==1) - { - // skip references - for (it.toFirst();(fd=it.current()) && fd->isReference();++it) { } - if (fd) - { - // name if unique, so diskname is simply the name - //printf("!!!!!!!! Unique disk name=%s for fd=%s\n",name.data(),fd->diskname.data()); - fd->setDiskName(name); - } - } - else if (count>1) // multiple occurrences of the same file name - { - //printf("Multiple occurrences of %s\n",name.data()); - int i=0,j=0; - bool found=FALSE; - while (!found) // search for the common prefix of all paths - { - for (it.toFirst();(fd=it.current()) && fd->isReference();++it) { } - if (fd) - { - char c=fd->getPath().at(i); - if (c=='/') j=i; // remember last position of dirname - ++it; - while ((fd=it.current()) && !found) - { - QCString path = fd->getPath(); - if (!fd->isReference()) - { - //printf("i=%d j=%d fd->path='%s' fd->name='%s'\n",i,j,fd->path.left(i).data(),fd->name().data()); - if (i==(int)path.length()) - { - //warning("Input file %s found multiple times!\n" - // " The generated documentation for this file may not be correct!\n",fd->absFilePath().data()); - found=TRUE; - } - else if (path[i]!=c) - { - found=TRUE; - } - } - ++it; - } - i++; - } - } - for (it.toFirst();(fd=it.current());++it) - { - //printf("fd->setName(%s)\n",(fd->path.right(fd->path.length()-j-1)+name).data()); - if (!fd->isReference()) - { - QCString path = fd->getPath(); - QCString prefix = path.right(path.length()-j-1); - fd->setName(prefix+name); - //printf("!!!!!!!! non unique disk name=%s:%s\n",prefix.data(),name.data()); - fd->setDiskName(prefix+name); - } - } - } -} - -int FileName::compareValues(const FileDef *f1, const FileDef *f2) const -{ - return qstricmp(f1->fileName(),f2->fileName()); -} - -FileNameIterator::FileNameIterator(const FileName &fname) : - QListIterator<FileDef>(fname) -{ -} - -FileNameList::FileNameList() : QList<FileName>() -{ -} - -FileNameList::~FileNameList() -{ -} - -void FileNameList::generateDiskNames() -{ - FileNameListIterator it(*this); - FileName *fn; - for (;(fn=it.current());++it) - { - fn->generateDiskNames(); - } -} - -int FileNameList::compareValues(const FileName *f1, const FileName *f2) const -{ - return Config_getBool(FULL_PATH_NAMES) ? - qstricmp(f1->fullName(),f2->fullName()) : - qstricmp(f1->fileName(),f2->fileName()); -} - -FileNameListIterator::FileNameListIterator(const FileNameList &fnlist) : - QListIterator<FileName>(fnlist) -{ -} - -static bool getCaseSenseNames() -{ - static bool caseSenseNames = Config_getBool(CASE_SENSE_NAMES); - return caseSenseNames; -} - -FileNameDict::FileNameDict(uint size) : QDict<FileName>(size,getCaseSenseNames()) -{ -} - diff --git a/src/filename.h b/src/filename.h index fbee0e1..c3a0d3e 100644 --- a/src/filename.h +++ b/src/filename.h @@ -1,12 +1,10 @@ /****************************************************************************** * - * - * - * Copyright (C) 1997-2015 by Dimitri van Heesch. + * Copyright (C) 1997-2020 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. * @@ -18,57 +16,31 @@ #ifndef FILENAME_H #define FILENAME_H -#include <qdict.h> -#include <qlist.h> -#include "filedef.h" +#include <memory> +#include <vector> -/** Class representing all files with a certain base name */ -class FileName : public FileList -{ - public: - FileName(const char *fn,const char *name); - ~FileName(); - const char *fileName() const { return name; } - const char *fullName() const { return fName; } - void generateDiskNames(); +#include "linkedmap.h" - private: - int compareValues(const FileDef *item1,const FileDef *item2) const; - QCString name; - QCString fName; -}; +class FileDef; -/** Iterator for FileDef objects in a FileName list. */ -class FileNameIterator : public QListIterator<FileDef> +/** Class representing all files with a certain base name */ +class FileName : public std::vector< std::unique_ptr<FileDef> > { public: - FileNameIterator(const FileName &list); -}; + FileName(const char *nm,const char *fn) : m_name(nm), m_fName(fn), m_pathName("tmp") {} + const char *fileName() const { return m_name; } + const char *fullName() const { return m_fName; } + const char *path() const { return m_pathName; } -/** Class representing a list of FileName objects. */ -class FileNameList : public QList<FileName> -{ - public: - FileNameList(); - ~FileNameList(); - void generateDiskNames(); private: - int compareValues(const FileName *item1,const FileName *item2) const; + QCString m_name; + QCString m_fName; + QCString m_pathName; }; -/** Iterator for FileName objects in a FileNameList. */ -class FileNameListIterator : public QListIterator<FileName> +/** Ordered dictionary of FileName objects. */ +class FileNameLinkedMap : public LinkedMap<FileName> { - public: - FileNameListIterator( const FileNameList &list ); -}; - -/** Unsorted dictionary of FileName objects. */ -class FileNameDict : public QDict<FileName> -{ - public: - FileNameDict(uint size); - ~FileNameDict() {} }; #endif diff --git a/src/index.cpp b/src/index.cpp index 70475a2..7890898 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -776,19 +776,15 @@ static void writeDirHierarchy(OutputList &ol, FTVHelp* ftv,bool addToIndex) } if (ftv) { - 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) { static bool fullPathNames = Config_getBool(FULL_PATH_NAMES); if (!fullPathNames || fd->getDirDef()==0) // top level file { bool doc,src; - doc = fileVisibleInIndex(fd,src); + doc = fileVisibleInIndex(fd.get(),src); QCString reference, outputBase; if (doc) { @@ -799,19 +795,19 @@ static void writeDirHierarchy(OutputList &ol, FTVHelp* ftv,bool addToIndex) { ftv->addContentsItem(FALSE,fd->displayName(), reference, outputBase, 0, - FALSE,FALSE,fd); + FALSE,FALSE,fd.get()); } if (addToIndex) { if (doc) { - addMembersToIndex(fd,LayoutDocManager::File,fd->displayName(),QCString(),TRUE); + addMembersToIndex(fd.get(),LayoutDocManager::File,fd->displayName(),QCString(),TRUE); } else if (src) { Doxygen::indexList->addContentsItem( FALSE, convertToHtml(fd->name(),TRUE), 0, - fd->getSourceFileBase(), 0, FALSE, TRUE, fd); + fd->getSourceFileBase(), 0, FALSE, TRUE, fd.get()); } } } @@ -1321,16 +1317,12 @@ static void countFiles(int &htmlFiles,int &files) { htmlFiles=0; files=0; - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - for (;(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) { bool doc,src; - doc = fileVisibleInIndex(fd,src); + doc = fileVisibleInIndex(fd.get(),src); if (doc || src) { htmlFiles++; @@ -1470,27 +1462,23 @@ static void writeFileIndex(OutputList &ol) if (Config_getBool(FULL_PATH_NAMES)) { // re-sort input files in (dir,file) output order instead of (file,dir) input order - 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) { QCString path=fd->getPath(); if (path.isEmpty()) path="[external]"; FileList *fl = outputNameDict.find(path); if (fl) { - fl->append(fd); + fl->append(fd.get()); //printf("+ inserting %s---%s\n",fd->getPath().data(),fd->name().data()); } else { //printf("o inserting %s---%s\n",fd->getPath().data(),fd->name().data()); fl = new FileList(path); - fl->append(fd); + fl->append(fd.get()); outputNameList.append(fl); outputNameDict.insert(path,fl); } @@ -1517,15 +1505,11 @@ static void writeFileIndex(OutputList &ol) } else { - 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) { - writeSingleFileIndex(ol,fd); + writeSingleFileIndex(ol,fd.get()); } } } diff --git a/src/latexgen.cpp b/src/latexgen.cpp index f00e6cf..52a8acf 100644 --- a/src/latexgen.cpp +++ b/src/latexgen.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. * @@ -175,8 +175,8 @@ void LatexCodeGenerator::writeCodeLink(const char *ref,const char *f, { m_t << "\\mbox{\\hyperlink{"; if (f) m_t << stripPath(f); - if (f && anchor) m_t << "_"; - if (anchor) m_t << anchor; + if (f && anchor) m_t << "_"; + if (anchor) m_t << anchor; m_t << "}{"; codify(name); m_t << "}}"; @@ -372,7 +372,7 @@ static void writeLatexMakefile() t << endl << "clean:" << endl - << "\trm -f " + << "\trm -f " << "*.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out *.brf *.blg *.bbl refman.pdf" << endl; } @@ -623,7 +623,7 @@ static void writeDefaultHeaderPart1(FTextStream &t) "}\n" "\\makeatother\n" "\n"; - // + // t << "\\makeatletter\n" "\\newcommand\\hrulefilll{\\leavevmode\\leaders\\hrule\\hskip 0pt plus 1filll\\kern\\z@}\n" "\\makeatother\n" @@ -905,11 +905,11 @@ void LatexGenerator::endFile() //void LatexGenerator::writeIndex() //{ // startFile("refman.tex"); -//} - +//} + void LatexGenerator::startProjectNumber() { - t << "\\\\[1ex]\\large "; + t << "\\\\[1ex]\\large "; } void LatexGenerator::startIndexSection(IndexSections is) @@ -1021,7 +1021,7 @@ void LatexGenerator::startIndexSection(IndexSections is) t << "{"; // Namespace Documentation}\n": found=TRUE; } - } + } } break; case isClassDocumentation: @@ -1031,7 +1031,7 @@ void LatexGenerator::startIndexSection(IndexSections is) bool found=FALSE; for (cli.toFirst();(cd=cli.current()) && !found;++cli) { - if (cd->isLinkableInProject() && + if (cd->isLinkableInProject() && cd->templateMaster()==0 && !cd->isEmbeddedInOuterScope() ) @@ -1046,13 +1046,9 @@ void LatexGenerator::startIndexSection(IndexSections is) case isFileDocumentation: { bool isFirst=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) { if (fd->isLinkableInProject()) { @@ -1151,7 +1147,7 @@ void LatexGenerator::endIndexSection(IndexSections is) if (!gd->isReference()) { //if (compactLatex) t << "\\input"; else t << "\\include"; - t << "\\include"; + t << "\\include"; t << "{" << gd->getOutputFileBase() << "}\n"; } } @@ -1175,7 +1171,7 @@ void LatexGenerator::endIndexSection(IndexSections is) if (dd->isLinkableInProject()) { //if (compactLatex) t << "\\input"; else t << "\\include"; - t << "\\input"; + t << "\\input"; t << "{" << dd->getOutputFileBase() << "}\n"; } } @@ -1199,7 +1195,7 @@ void LatexGenerator::endIndexSection(IndexSections is) if (nd->isLinkableInProject()) { //if (compactLatex) t << "\\input"; else t << "\\include"; - t << "\\input"; + t << "\\input"; t << "{" << nd->getOutputFileBase() << "}\n"; } ++nli; @@ -1213,7 +1209,7 @@ void LatexGenerator::endIndexSection(IndexSections is) bool found=FALSE; for (cli.toFirst();(cd=cli.current()) && !found;++cli) { - if (cd->isLinkableInProject() && + if (cd->isLinkableInProject() && cd->templateMaster()==0 && !cd->isEmbeddedInOuterScope() ) @@ -1224,28 +1220,24 @@ void LatexGenerator::endIndexSection(IndexSections is) } for (;(cd=cli.current());++cli) { - if (cd->isLinkableInProject() && + if (cd->isLinkableInProject() && cd->templateMaster()==0 && !cd->isEmbeddedInOuterScope() ) { //if (compactLatex) t << "\\input"; else t << "\\include"; - t << "\\input"; + t << "\\input"; t << "{" << cd->getOutputFileBase() << "}\n"; - } + } } } break; case isFileDocumentation: { bool isFirst=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) { if (fd->isLinkableInProject()) { @@ -1262,7 +1254,7 @@ void LatexGenerator::endIndexSection(IndexSections is) else { //if (compactLatex) t << "\\input" ; else t << "\\include"; - t << "\\input" ; + t << "\\input" ; t << "{" << fd->getOutputFileBase() << "}\n"; if (sourceBrowser && m_prettyCode && fd->generateSourceFile()) { @@ -1287,7 +1279,7 @@ void LatexGenerator::endIndexSection(IndexSections is) for (++pdi;(pd=pdi.current());++pdi) { //if (compactLatex) t << "\\input" ; else t << "\\include"; - t << "\\input"; + t << "\\input"; t << "{" << pd->getOutputFileBase() << "}\n"; } } @@ -1306,7 +1298,7 @@ void LatexGenerator::endIndexSection(IndexSections is) if (compactLatex) t << "\\doxysection"; else t << "\\chapter"; t << "{" << pd->title(); t << "}\n"; - + if (compactLatex || first) t << "\\input" ; else t << "\\include"; t << "{" << pd->getOutputFileBase() << "}\n"; first=FALSE; @@ -1339,7 +1331,7 @@ void LatexGenerator::writePageLink(const char *name, bool /*first*/) //bool &compactLatex = Config_getBool(COMPACT_LATEX); // next is remove for bug615957 //if (compactLatex || first) t << "\\input" ; else t << "\\include"; - t << "\\input" ; + t << "\\input" ; t << "{" << name << "}\n"; } @@ -1442,7 +1434,7 @@ void LatexGenerator::writeStartAnnoItem(const char *,const char *, { t << "\\item\\contentsline{section}\\textbf{ "; if (path) docify(path); - docify(name); + docify(name); t << "} "; } @@ -1477,7 +1469,7 @@ void LatexGenerator::endIndexValue(const char *name,bool /*hasBrief*/) //{ // t << "\\textbf{ "; // docify(name); -// t << "}"; +// t << "}"; //} void LatexGenerator::startTextLink(const char *f,const char *anchor) @@ -1487,7 +1479,7 @@ void LatexGenerator::startTextLink(const char *f,const char *anchor) { t << "\\mbox{\\hyperlink{"; if (f) t << stripPath(f); - if (anchor) t << "_" << anchor; + if (anchor) t << "_" << anchor; t << "}{"; } else @@ -1514,8 +1506,8 @@ void LatexGenerator::writeObjectLink(const char *ref, const char *f, { t << "\\mbox{\\hyperlink{"; if (f) t << stripPath(f); - if (f && anchor) t << "_"; - if (anchor) t << anchor; + if (f && anchor) t << "_"; + if (anchor) t << anchor; t << "}{"; docify(text); t << "}}"; @@ -1525,7 +1517,7 @@ void LatexGenerator::writeObjectLink(const char *ref, const char *f, t << "\\textbf{ "; docify(text); t << "}"; - } + } } void LatexGenerator::startPageRef() @@ -1536,7 +1528,7 @@ void LatexGenerator::startPageRef() void LatexGenerator::endPageRef(const char *clname, const char *anchor) { t << "}{"; - if (clname) t << clname; + if (clname) t << clname; if (anchor) t << "_" << anchor; t << "}"; } @@ -1550,13 +1542,13 @@ void LatexGenerator::startTitleHead(const char *fileName) { t << "\\hypertarget{" << stripPath(fileName) << "}{}"; } - if (Config_getBool(COMPACT_LATEX)) + if (Config_getBool(COMPACT_LATEX)) { - t << "\\doxysubsection{"; + t << "\\doxysubsection{"; } - else + else { - t << "\\doxysection{"; + t << "\\doxysection{"; } } @@ -1575,26 +1567,26 @@ void LatexGenerator::endTitleHead(const char *fileName,const char *name) void LatexGenerator::startTitle() { - if (Config_getBool(COMPACT_LATEX)) + if (Config_getBool(COMPACT_LATEX)) { - t << "\\doxysubsection{"; + t << "\\doxysubsection{"; } - else + else { - t << "\\doxysection{"; + t << "\\doxysection{"; } } void LatexGenerator::startGroupHeader(int extraIndentLevel) { - if (Config_getBool(COMPACT_LATEX)) + if (Config_getBool(COMPACT_LATEX)) { extraIndentLevel++; } if (extraIndentLevel==3) { - t << "\\doxysubparagraph*{"; + t << "\\doxysubparagraph*{"; } else if (extraIndentLevel==2) { @@ -1619,11 +1611,11 @@ void LatexGenerator::endGroupHeader(int) void LatexGenerator::startMemberHeader(const char *,int) { - if (Config_getBool(COMPACT_LATEX)) + if (Config_getBool(COMPACT_LATEX)) { - t << "\\doxysubsubsection*{"; + t << "\\doxysubsubsection*{"; } - else + else { t << "\\doxysubsection*{"; } @@ -1733,9 +1725,9 @@ void LatexGenerator::endDoxyAnchor(const char *fName,const char *anchor) } void LatexGenerator::writeAnchor(const char *fName,const char *name) -{ +{ //printf("LatexGenerator::writeAnchor(%s,%s)\n",fName,name); - t << "\\label{" << stripPath(name) << "}" << endl; + t << "\\label{" << stripPath(name) << "}" << endl; static bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS); static bool usePDFLatex = Config_getBool(USE_PDFLATEX); if (usePDFLatex && pdfHyperlinks) @@ -1885,31 +1877,31 @@ void LatexGenerator::endMemberTemplateParams(const char *,const char *) } } -void LatexGenerator::startMemberItem(const char *,int annoType,const char *) -{ +void LatexGenerator::startMemberItem(const char *,int annoType,const char *) +{ //printf("LatexGenerator::startMemberItem(%d)\n",annType); if (!m_insideTabbing) { - t << "\\item " << endl; + t << "\\item " << endl; templateMemberItem = (annoType == 3); } } -void LatexGenerator::endMemberItem() +void LatexGenerator::endMemberItem() { if (m_insideTabbing) { t << "\\\\"; - } + } templateMemberItem = FALSE; - t << endl; + t << endl; } -void LatexGenerator::startMemberDescription(const char *,const char *,bool) +void LatexGenerator::startMemberDescription(const char *,const char *,bool) { if (!m_insideTabbing) - { - t << "\\begin{DoxyCompactList}\\small\\item\\em "; + { + t << "\\begin{DoxyCompactList}\\small\\item\\em "; } else { @@ -1918,12 +1910,12 @@ void LatexGenerator::startMemberDescription(const char *,const char *,bool) } } -void LatexGenerator::endMemberDescription() -{ +void LatexGenerator::endMemberDescription() +{ if (!m_insideTabbing) { - //t << "\\item\\end{DoxyCompactList}"; - t << "\\end{DoxyCompactList}"; + //t << "\\item\\end{DoxyCompactList}"; + t << "\\end{DoxyCompactList}"; } else { @@ -1932,7 +1924,7 @@ void LatexGenerator::endMemberDescription() } -void LatexGenerator::writeNonBreakableSpace(int) +void LatexGenerator::writeNonBreakableSpace(int) { //printf("writeNonBreakableSpace()\n"); if (m_insideTabbing) @@ -1941,7 +1933,7 @@ void LatexGenerator::writeNonBreakableSpace(int) } else { - t << "~"; + t << "~"; } } @@ -2001,25 +1993,25 @@ void LatexGenerator::endDescTableData() t << "\\\\\n\\hline\n" << endl; } -void LatexGenerator::lastIndexPage() +void LatexGenerator::lastIndexPage() { } -void LatexGenerator::startMemberList() -{ +void LatexGenerator::startMemberList() +{ if (!m_insideTabbing) { - t << "\\begin{DoxyCompactItemize}" << endl; + t << "\\begin{DoxyCompactItemize}" << endl; } } -void LatexGenerator::endMemberList() +void LatexGenerator::endMemberList() { //printf("LatexGenerator::endMemberList(%d)\n",m_insideTabbing); if (!m_insideTabbing) { - t << "\\end{DoxyCompactItemize}" << endl; + t << "\\end{DoxyCompactItemize}" << endl; } } @@ -2029,7 +2021,7 @@ void LatexGenerator::startMemberGroupHeader(bool hasHeader) if (hasHeader) t << "\\begin{Indent}"; t << "\\textbf{ "; // changed back to rev 756 due to bug 660501 - //if (Config_getBool(COMPACT_LATEX)) + //if (Config_getBool(COMPACT_LATEX)) //{ // t << "\\doxysubparagraph*{"; //} @@ -2062,80 +2054,80 @@ void LatexGenerator::startMemberGroup() void LatexGenerator::endMemberGroup(bool hasHeader) { - if (hasHeader)t << "\\end{Indent}"; + if (hasHeader)t << "\\end{Indent}"; t << endl; } -void LatexGenerator::startDotGraph() +void LatexGenerator::startDotGraph() { newParagraph(); } -void LatexGenerator::endDotGraph(DotClassGraph &g) +void LatexGenerator::endDotGraph(DotClassGraph &g) { g.writeGraph(t,GOF_EPS,EOF_LaTeX,Config_getString(LATEX_OUTPUT),m_fileName,m_relPath); } -void LatexGenerator::startInclDepGraph() +void LatexGenerator::startInclDepGraph() { } -void LatexGenerator::endInclDepGraph(DotInclDepGraph &g) +void LatexGenerator::endInclDepGraph(DotInclDepGraph &g) { g.writeGraph(t,GOF_EPS,EOF_LaTeX,Config_getString(LATEX_OUTPUT),m_fileName,m_relPath); } -void LatexGenerator::startGroupCollaboration() +void LatexGenerator::startGroupCollaboration() { } -void LatexGenerator::endGroupCollaboration(DotGroupCollaboration &g) +void LatexGenerator::endGroupCollaboration(DotGroupCollaboration &g) { g.writeGraph(t,GOF_EPS,EOF_LaTeX,Config_getString(LATEX_OUTPUT),m_fileName,m_relPath); } -void LatexGenerator::startCallGraph() +void LatexGenerator::startCallGraph() { } -void LatexGenerator::endCallGraph(DotCallGraph &g) +void LatexGenerator::endCallGraph(DotCallGraph &g) { g.writeGraph(t,GOF_EPS,EOF_LaTeX,Config_getString(LATEX_OUTPUT),m_fileName,m_relPath); } -void LatexGenerator::startDirDepGraph() +void LatexGenerator::startDirDepGraph() { } -void LatexGenerator::endDirDepGraph(DotDirDeps &g) +void LatexGenerator::endDirDepGraph(DotDirDeps &g) { g.writeGraph(t,GOF_EPS,EOF_LaTeX,Config_getString(LATEX_OUTPUT),m_fileName,m_relPath); } -void LatexGenerator::startDescription() -{ - t << "\\begin{description}" << endl; +void LatexGenerator::startDescription() +{ + t << "\\begin{description}" << endl; } -void LatexGenerator::endDescription() -{ - t << "\\end{description}" << endl; +void LatexGenerator::endDescription() +{ + t << "\\end{description}" << endl; m_firstDescItem=TRUE; } -void LatexGenerator::startDescItem() -{ +void LatexGenerator::startDescItem() +{ m_firstDescItem=TRUE; - t << "\\item["; + t << "\\item["; } -void LatexGenerator::endDescItem() -{ - if (m_firstDescItem) +void LatexGenerator::endDescItem() +{ + if (m_firstDescItem) { t << "]" << endl; m_firstDescItem=FALSE; - } + } else { lineBreak(); @@ -2278,11 +2270,11 @@ void LatexGenerator::endCodeFragment() void LatexGenerator::startInlineHeader() { - if (Config_getBool(COMPACT_LATEX)) + if (Config_getBool(COMPACT_LATEX)) { - t << "\\doxyparagraph*{"; + t << "\\doxyparagraph*{"; } - else + else { t << "\\doxysubsubsection*{"; } diff --git a/src/linkedmap.h b/src/linkedmap.h index 3abc069..f3caeb0 100644 --- a/src/linkedmap.h +++ b/src/linkedmap.h @@ -32,6 +32,7 @@ class LinkedMap using Vec = std::vector<Ptr>; using Map = std::unordered_map<std::string,T*>; using iterator = typename Vec::iterator; + using const_iterator = typename Vec::const_iterator; //! find an element given the key. //! Returns a pointer to the element if found or nullptr if it is not found. @@ -66,6 +67,8 @@ class LinkedMap iterator begin() { return m_entries.begin(); } iterator end() { return m_entries.end(); } + const_iterator begin() const { return m_entries.cbegin(); } + const_iterator end() const { return m_entries.cend(); } bool empty() const { return m_entries.empty(); } int size() const { return m_entries.size(); } diff --git a/src/markdown.cpp b/src/markdown.cpp index 2e67145..749bd9f 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -3,8 +3,8 @@ * 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. * @@ -13,7 +13,7 @@ * */ -/* Note: part of the code below is inspired by libupskirt written by +/* Note: part of the code below is inspired by libupskirt written by * Natacha Porté. Original copyright message follows: * * Copyright (c) 2008, Natacha Porté @@ -209,11 +209,11 @@ static QCString isBlockCommand(const char *data,int offset,int size) { return "}"; } - else if (blockName=="dot" || - blockName=="code" || + else if (blockName=="dot" || + blockName=="code" || blockName=="msc" || - blockName=="verbatim" || - blockName=="latexonly" || + blockName=="verbatim" || + blockName=="latexonly" || blockName=="htmlonly" || blockName=="xmlonly" || blockName=="rtfonly" || @@ -254,12 +254,12 @@ static int findEmphasisChar(const char *data, int size, char c, int c_size) while (i<size) { - while (i<size && data[i]!=c && data[i]!='`' && + while (i<size && data[i]!=c && data[i]!='`' && data[i]!='\\' && data[i]!='@' && data[i]!='\n') i++; //printf("findEmphasisChar: data=[%s] i=%d c=%c\n",data,i,data[i]); - // not counting escaped chars or characters that are unlikely + // not counting escaped chars or characters that are unlikely // to appear as the end of the emphasis char if (i>0 && ignoreCloseEmphChar(i-1)) { @@ -356,9 +356,9 @@ static int processEmphasis1(GrowBuf &out, const char *data, int size, char c) while (i<size) { len = findEmphasisChar(data+i, size-i, c, 1); - if (len==0) return 0; + if (len==0) return 0; i+=len; - if (i>=size) return 0; + if (i>=size) return 0; if (i+1<size && data[i+1]==c) { @@ -389,7 +389,7 @@ static int processEmphasis2(GrowBuf &out, const char *data, int size, char c) return 0; } i += len; - if (i+1<size && data[i]==c && data[i+1]==c && i && data[i-1]!=' ' && + if (i+1<size && data[i]==c && data[i+1]==c && i && data[i-1]!=' ' && data[i-1]!='\n' ) { @@ -406,7 +406,7 @@ static int processEmphasis2(GrowBuf &out, const char *data, int size, char c) } /** Parsing triple emphasis. - * Finds the first closing tag, and delegates to the other emph + * Finds the first closing tag, and delegates to the other emph */ static int processEmphasis3(GrowBuf &out, const char *data, int size, char c) { @@ -503,7 +503,7 @@ static int processQuoted(GrowBuf &out,const char *data,int,int size) { int i=1; int nl=0; - while (i<size && data[i]!='"' && nl<2) + while (i<size && data[i]!='"' && nl<2) { if (data[i]=='\n') nl++; i++; @@ -622,7 +622,7 @@ static int processEmphasis(GrowBuf &out,const char *data,int offset,int size) if (size>2 && c!='~' && data[1]!=c) // _bla or *bla { // whitespace cannot follow an opening emphasis - if (data[1]==' ' || data[1]=='\n' || + if (data[1]==' ' || data[1]=='\n' || (ret = processEmphasis1(out, data+1, size-1, c)) == 0) { return 0; @@ -631,7 +631,7 @@ static int processEmphasis(GrowBuf &out,const char *data,int offset,int size) } if (size>3 && data[1]==c && data[2]!=c) // __bla or **bla { - if (data[2]==' ' || data[2]=='\n' || + if (data[2]==' ' || data[2]=='\n' || (ret = processEmphasis2(out, data+2, size-2, c)) == 0) { return 0; @@ -640,7 +640,7 @@ static int processEmphasis(GrowBuf &out,const char *data,int offset,int size) } if (size>4 && c!='~' && data[1]==c && data[2]==c && data[3]!=c) // ___bla or ***bla { - if (data[3]==' ' || data[3]=='\n' || + if (data[3]==' ' || data[3]=='\n' || (ret = processEmphasis3(out, data+3, size-3, c)) == 0) { return 0; @@ -833,7 +833,7 @@ static int processLink(GrowBuf &out,const char *data,int,int size) title = lr->title; //printf("processLink: ref: link={%s} title={%s}\n",link.data(),title.data()); } - else // reference not found! + else // reference not found! { //printf("processLink: ref {%s} do not exist\n",link.lower().data()); return 0; @@ -876,12 +876,12 @@ static int processLink(GrowBuf &out,const char *data,int,int size) out.addStr("}"); } } - else if (isImageLink) + else if (isImageLink) { bool ambig; FileDef *fd=0; if (link.find("@ref ")!=-1 || link.find("\\ref ")!=-1 || - (fd=findFileDef(Doxygen::imageNameDict,link,ambig))) + (fd=findFileDef(Doxygen::imageNameLinkedMap,link,ambig))) // assume doxygen symbol link or local image link { writeMarkdownImage(out, "html", explicitTitle, title, content, link, fd); @@ -909,7 +909,7 @@ static int processLink(GrowBuf &out,const char *data,int,int size) { SrcLangExt lang = getLanguageFromFileName(link); int lp=-1; - if ((lp=link.find("@ref "))!=-1 || (lp=link.find("\\ref "))!=-1 || (lang==SrcLangExt_Markdown && !isURL(link))) + if ((lp=link.find("@ref "))!=-1 || (lp=link.find("\\ref "))!=-1 || (lang==SrcLangExt_Markdown && !isURL(link))) // assume doxygen symbol link { if (lp==-1) // link to markdown page @@ -928,7 +928,7 @@ static int processLink(GrowBuf &out,const char *data,int,int size) } out.addStr("\""); } - else if (link.find('/')!=-1 || link.find('.')!=-1 || link.find('#')!=-1) + else if (link.find('/')!=-1 || link.find('.')!=-1 || link.find('#')!=-1) { // file/url link out.addStr("<a href=\""); out.addStr(link); @@ -969,9 +969,9 @@ static int processCodeSpan(GrowBuf &out, const char *data, int /*offset*/, int s int nl=0; for (end=nb; end<size && i<nb && nl<2; end++) { - if (data[end]=='`') + if (data[end]=='`') { - i++; + i++; } else if (data[end]=='\n') { @@ -989,7 +989,7 @@ static int processCodeSpan(GrowBuf &out, const char *data, int /*offset*/, int s } else { - i=0; + i=0; } } if (i < nb && end >= size) @@ -1122,9 +1122,9 @@ static int isHeaderline(const char *data, int size, bool allowAdjustLevel) if (allowAdjustLevel && level==1 && g_indentLevel==-1) { // In case a page starts with a header line we use it as title, promoting it to @page. - // We set g_indentLevel to -1 to promoting the other sections if they have a deeper + // We set g_indentLevel to -1 to promoting the other sections if they have a deeper // nesting level than the page header, i.e. @section..@subsection becomes @page..@section. - // In case a section at the same level is found (@section..@section) however we need + // In case a section at the same level is found (@section..@section) however we need // to undo this (and the result will be @page..@section). g_indentLevel=0; } @@ -1149,14 +1149,14 @@ static bool isBlockQuote(const char *data,int size,int indent) { // count >'s and skip spaces int level=0; - while (i<size && (data[i]=='>' || data[i]==' ')) + while (i<size && (data[i]=='>' || data[i]==' ')) { if (data[i]=='>') level++; i++; } - // last characters should be a space or newline, + // last characters should be a space or newline, // so a line starting with >= does not match - return level>0 && i<size && ((data[i-1]==' ') || data[i]=='\n'); + return level>0 && i<size && ((data[i-1]==' ') || data[i]=='\n'); } else // too much indentation -> code block { @@ -1222,7 +1222,7 @@ static int isLinkRef(const char *data,int size, i++; while (i<size && data[i]==' ') i++; } - if (i>=size) + if (i>=size) { //printf("end of isLinkRef while looking for title! i=%d\n",i); return i; // end of buffer while looking for the optional title @@ -1263,7 +1263,7 @@ static int isHRuler(const char *data,int size) while (i<size && data[i]==' ') i++; if (i>=size) return 0; // empty line char c=data[i]; - if (c!='*' && c!='-' && c!='_') + if (c!='*' && c!='-' && c!='_') { return 0; // not a hrule character } @@ -1317,13 +1317,13 @@ static int isAtxHeader(const char *data,int size, // find start of header text and determine heading level while (i<size && data[i]==' ') i++; - if (i>=size || data[i]!='#') + if (i>=size || data[i]!='#') { return 0; } while (i<size && level<6 && data[i]=='#') i++,level++; while (i<size && data[i]==' ') i++,blanks++; - if (level==1 && blanks==0) + if (level==1 && blanks==0) { return 0; // special case to prevent #someid seen as a header (see bug 671395) } @@ -1395,7 +1395,7 @@ static int computeIndentExcludingListMarkers(const char *data,int size) bool isDigit=FALSE; bool isLi=FALSE; bool listMarkerSkipped=FALSE; - while (i<size && + while (i<size && (data[i]==' ' || // space (!listMarkerSkipped && // first list marker (data[i]=='+' || data[i]=='-' || data[i]=='*' || // unordered list char @@ -1405,7 +1405,7 @@ static int computeIndentExcludingListMarkers(const char *data,int size) ) ) ) - ) + ) { if (isDigit) // skip over ordered list marker '10. ' { @@ -1483,7 +1483,7 @@ static bool isFencedCodeBlock(const char *data,int size,int refIndent, int endTildes=0; while (i<size && data[i]==tildaChar) endTildes++,i++; while (i<size && data[i]==' ') i++; - if (i==size || data[i]=='\n') + if (i==size || data[i]=='\n') { offset=i; return endTildes==startTildes; @@ -1512,7 +1512,7 @@ static bool isCodeBlock(const char *data,int offset,int size,int &indent) //printf("only spaces at the end of a comment block\n"); return FALSE; } - + i=offset; int nl=0; int nl_pos[3]; @@ -1542,7 +1542,7 @@ static bool isCodeBlock(const char *data,int offset,int size,int &indent) // determine the indent of line -2 indent=computeIndentExcludingListMarkers(data+nl_pos[2],nl_pos[1]-nl_pos[2]); - + //printf(">isCodeBlock local_indent %d>=%d+4=%d\n", // indent0,indent2,indent0>=indent2+4); // if the difference is >4 spaces -> code block @@ -1615,7 +1615,7 @@ static bool isTableBlock(const char *data,int size) // the first line should have at least two columns separated by '|' int i = findTableColumns(data,size,start,end,cc0); - if (i>=size || cc0<1) + if (i>=size || cc0<1) { //printf("isTableBlock: no |'s in the header\n"); return FALSE; @@ -1663,7 +1663,7 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size) // write table header, in range [start..end] out.addStr("<tr>"); #endif - + // read cell alignments int ret = findTableColumns(data+i,size-i,start,end,cc); k=0; @@ -1677,12 +1677,12 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size) if (!startFound) { if (data[j]==':') { leftMarker=TRUE; startFound=TRUE; } - if (data[j]=='-') startFound=TRUE; + if (data[j]=='-') startFound=TRUE; //printf(" data[%d]=%c startFound=%d\n",j,data[j],startFound); } if (data[j]=='-') rightMarker=FALSE; else if (data[j]==':') rightMarker=TRUE; - if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\'))) + if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\'))) { if (k<columns) { @@ -1751,7 +1751,7 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size) } out.addStr(">"); } - if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\'))) + if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\'))) { columnStart=j+1; k++; @@ -1810,7 +1810,7 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size) rowContents->insert(k, new TableCell); while (j<=end+i) { - if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\'))) + if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\'))) { // do the column span test before stripping white space // || is spanning columns, | | is not @@ -1818,7 +1818,7 @@ static int writeTableBlock(GrowBuf &out,const char *data,int size) rowContents->at(k)->cellText = rowContents->at(k)->cellText.stripWhiteSpace(); k++; rowContents->insert(k, new TableCell); - } // if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\'))) + } // if (j<=end+i && (data[j]=='|' && (j==0 || data[j-1]!='\\'))) else { rowContents->at(k)->cellText += data[j]; @@ -1979,7 +1979,7 @@ void writeOneLineHeaderOrRuler(GrowBuf &out,const char *data,int size) } hTag.sprintf("h%d",level); out.addStr("<"+hTag+">"); - out.addStr(header); + out.addStr(header); out.addStr("</"+hTag+">\n"); } } @@ -2014,7 +2014,7 @@ static int writeBlockQuote(GrowBuf &out,const char *data,int size) else if (j>0 && data[j-1]=='>') indent=j+1; j++; } - if (j>0 && data[j-1]=='>' && + if (j>0 && data[j-1]=='>' && !(j==size || data[j]=='\n')) // disqualify last > if not followed by space { indent--; @@ -2065,7 +2065,7 @@ static int writeCodeBlock(GrowBuf &out,const char *data,int size,int refIndent) while (j<end && data[j]==' ') j++,indent++; //printf("j=%d end=%d indent=%d refIndent=%d tabSize=%d data={%s}\n", // j,end,indent,refIndent,Config_getInt(TAB_SIZE),QCString(data+i).left(end-i-1).data()); - if (j==end-1) // empty line + if (j==end-1) // empty line { emptyLines++; i=end; @@ -2087,7 +2087,7 @@ static int writeCodeBlock(GrowBuf &out,const char *data,int size,int refIndent) break; } } - out.addStr("@endverbatim\n"); + out.addStr("@endverbatim\n"); while (emptyLines>0) // write skipped empty lines { // add empty line @@ -2152,7 +2152,7 @@ static void findEndOfLine(GrowBuf &out,const char *data,int size, end++; } } - else if (nb==0 && data[end-1]=='`') + else if (nb==0 && data[end-1]=='`') { while (end<=size && data[end-1]=='`') end++,nb++; } @@ -2255,7 +2255,7 @@ static QCString processBlocks(const QCString &s,int indent) // get indent for the first line end = i+1; int sp=0; - while (end<=size && data[end-1]!='\n') + while (end<=size && data[end-1]!='\n') { if (data[end-1]==' ') sp++; end++; @@ -2414,7 +2414,7 @@ static QCString extractPageTitle(QCString &docs,QCString &id) const char *data = docs.data(); int i=0; int size=docs.size(); - while (i<size && (data[i]==' ' || data[i]=='\n')) + while (i<size && (data[i]==' ' || data[i]=='\n')) { if (data[i]=='\n') ln++; i++; @@ -2473,7 +2473,7 @@ static QCString detab(const QCString &s,int &refIndent) int stop = tabSize - (col%tabSize); //printf("expand at %d stop=%d\n",col,stop); col+=stop; - while (stop--) out.addChar(' '); + while (stop--) out.addChar(' '); } break; case '\n': // reset column counter @@ -2625,8 +2625,8 @@ MarkdownOutlineParser::~MarkdownOutlineParser() { } -void MarkdownOutlineParser::parseInput(const char *fileName, - const char *fileBuf, +void MarkdownOutlineParser::parseInput(const char *fileName, + const char *fileBuf, const std::shared_ptr<Entry> &root, bool /*sameTranslationUnit*/, QStrList & /*filesInSameTranslationUnit*/) @@ -2670,7 +2670,7 @@ void MarkdownOutlineParser::parseInput(const char *fileName, } int lineNr=1; - // even without markdown support enabled, we still + // even without markdown support enabled, we still // parse markdown files as such bool markdownEnabled = Doxygen::markdownSupport; Doxygen::markdownSupport = TRUE; diff --git a/src/message.cpp b/src/message.cpp index dbbc6dd..4e07d56 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -128,7 +128,7 @@ static void format_warn(const char *file,int line,const char *text) if (file) // get version from file name { bool ambig; - FileDef *fd=findFileDef(Doxygen::inputNameDict,file,ambig); + FileDef *fd=findFileDef(Doxygen::inputNameLinkedMap,file,ambig); if (fd) { versionSubst = fd->getVersion(); diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index 0183cdc..eb566ff 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -171,10 +171,10 @@ public: inline PerlModOutput &closeHash() { close('}'); return *this; } protected: - + void iopenSave(); void icloseSave(QCString &); - + void incIndent(); void decIndent(); @@ -187,7 +187,7 @@ protected: void iclose(char); private: - + PerlModOutputStream *m_stream; int m_indentation; bool m_blockstart; @@ -226,7 +226,7 @@ void PerlModOutput::decIndent() m_spaces[m_indentation * 2] = 0; } -void PerlModOutput::iaddQuoted(const char *s) +void PerlModOutput::iaddQuoted(const char *s) { char c; while ((c = *s++) != 0) { @@ -235,7 +235,7 @@ void PerlModOutput::iaddQuoted(const char *s) m_stream->add(c); } } - + void PerlModOutput::iaddField(const char *s) { continueBlock(); @@ -276,10 +276,10 @@ void PerlModOutput::iopen(char c, const char *s) void PerlModOutput::iclose(char c) { - decIndent(); + decIndent(); indent(); if (c != 0) - m_stream->add(c); + m_stream->add(c); m_blockstart = false; } @@ -291,11 +291,11 @@ public: virtual ~PerlModDocVisitor() { } void finish(); - + //-------------------------------------- // visitor functions for leaf nodes //-------------------------------------- - + void visit(DocWord *); void visit(DocLinkedWord *); void visit(DocWhiteSpace *); @@ -317,7 +317,7 @@ public: //-------------------------------------- // visitor functions for compound nodes //-------------------------------------- - + void visitPre(DocAutoList *); void visitPost(DocAutoList *); void visitPre(DocAutoListItem *); @@ -405,7 +405,7 @@ private: void addLink(const QCString &ref, const QCString &file, const QCString &anchor); - + void enterText(); void leaveText(); @@ -653,7 +653,7 @@ void PerlModDocVisitor::visit(DocStyleChange *s) case DocStyleChange::Preformatted: style = "preformatted"; break; case DocStyleChange::Div: style = "div"; break; case DocStyleChange::Span: style = "span"; break; - + } openItem("style"); m_output.addFieldQuotedString("style", style) @@ -712,12 +712,12 @@ void PerlModDocVisitor::visit(DocInclude *inc) { case DocInclude::IncWithLines: #if 0 - { + { m_t << "<div class=\"fragment\"><pre>"; QFileInfo cfi( inc->file() ); FileDef fd( cfi.dirPath(), cfi.fileName() ); parseCode(m_ci,inc->context(),inc->text().latin1(),inc->isExample(),inc->exampleFile(), &fd); - m_t << "</pre></div>"; + m_t << "</pre></div>"; } break; #endif @@ -740,8 +740,8 @@ void PerlModDocVisitor::visit(DocInclude *inc) case DocInclude::VerbInclude: type = "preformatted"; break; case DocInclude::Snippet: return; case DocInclude::SnipWithLines: return; - case DocInclude::SnippetDoc: - case DocInclude::IncludeDoc: + case DocInclude::SnippetDoc: + case DocInclude::IncludeDoc: err("Internal inconsistency: found switch SnippetDoc / IncludeDoc in file: %s" "Please create a bug report\n",__FILE__); break; @@ -764,7 +764,7 @@ void PerlModDocVisitor::visit(DocIncOperator *) { parseCode(m_ci,op->context(),op->text(),FALSE,0); } - if (op->isLast()) + if (op->isLast()) { m_output.add("</programlisting>"); } @@ -914,7 +914,7 @@ void PerlModDocVisitor::visitPost(DocTitle *) closeItem(); } -void PerlModDocVisitor::visitPre(DocSimpleList *) +void PerlModDocVisitor::visitPre(DocSimpleList *) { openItem("list"); m_output.addFieldQuotedString("style", "itemized"); @@ -1126,7 +1126,7 @@ void PerlModDocVisitor::visitPre(DocImage *) case DocImage::Rtf: m_output.add("rtf"); break; } m_output.add("\""); - + QCString baseName=img->name(); int i; if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) @@ -1484,7 +1484,7 @@ static void addPerlModDocBlock(PerlModOutput &output, } } -static const char *getProtectionName(Protection prot) +static const char *getProtectionName(Protection prot) { switch (prot) { @@ -1547,7 +1547,7 @@ public: void generatePerlModForFile(const FileDef *fd); void generatePerlModForGroup(const GroupDef *gd); void generatePerlModForPage(PageDef *pi); - + bool createOutputFile(QFile &f, const char *s); bool createOutputDir(QDir &perlModDir); bool generateDoxyLatexTex(); @@ -1576,7 +1576,7 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini // - body code // - template arguments // (templateArguments(), definitionTemplateParameterLists()) - + QCString memType; bool isFunc=FALSE; switch (md->memberType()) @@ -1605,13 +1605,13 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini .addFieldQuotedString("virtualness", getVirtualnessName(md->virtualness())) .addFieldQuotedString("protection", getProtectionName(md->protection())) .addFieldBoolean("static", md->isStatic()); - + addPerlModDocBlock(m_output,"brief",md->getDefFileName(),md->getDefLine(),md->getOuterScope(),md,md->briefDescription()); addPerlModDocBlock(m_output,"detailed",md->getDefFileName(),md->getDefLine(),md->getOuterScope(),md,md->documentation()); if (md->memberType()!=MemberType_Define && md->memberType()!=MemberType_Enumeration) m_output.addFieldQuotedString("type", md->typeString()); - + const ArgumentList &al = md->argumentList(); if (isFunc) //function { @@ -1650,7 +1650,7 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini if (!a.attrib.isEmpty()) m_output.addFieldQuotedString("attributes", a.attrib); - + m_output.closeHash(); } } @@ -1668,17 +1668,17 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini } m_output.closeList(); } - else if (md->argsString()!=0) + else if (md->argsString()!=0) { m_output.addFieldQuotedString("arguments", md->argsString()); } if (!md->initializer().isEmpty()) m_output.addFieldQuotedString("initializer", md->initializer()); - + if (md->excpString()) m_output.addFieldQuotedString("exceptions", md->excpString()); - + if (md->memberType()==MemberType_Enumeration) // enum { const MemberList *enumFields = md->enumFieldList(); @@ -1691,7 +1691,7 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini { m_output.openHash() .addFieldQuotedString("name", emd->name()); - + if (!emd->initializer().isEmpty()) m_output.addFieldQuotedString("initializer", emd->initializer()); @@ -1722,7 +1722,7 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini .closeHash(); m_output.closeList(); } - + m_output.closeHash(); } @@ -1735,7 +1735,7 @@ void PerlModGenerator::generatePerlModSection(const Definition *d, if (header) m_output.addFieldQuotedString("header", header); - + m_output.openList("members"); MemberListIterator mli(*ml); const MemberDef *md; @@ -1837,7 +1837,7 @@ void PerlModGenerator::generatePerlModForClass(const ClassDef *cd) m_output.openHash() .addFieldQuotedString("name", cd->name()); - + if (cd->baseClasses()) { m_output.openList("base"); @@ -1943,12 +1943,12 @@ void PerlModGenerator::generatePerlModForClass(const ClassDef *cd) collaborationGraph.writePerlMod(t); t << " </collaborationgraph>" << endl; } - t << " <location file=\"" - << cd->getDefFileName() << "\" line=\"" + t << " <location file=\"" + << cd->getDefFileName() << "\" line=\"" << cd->getDefLine() << "\""; if (cd->getStartBodyLine()!=-1) { - t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\"" + t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\"" << cd->getEndBodyLine() << "\""; } t << "/>" << endl; @@ -1972,7 +1972,7 @@ void PerlModGenerator::generatePerlModForNamespace(const NamespaceDef *nd) m_output.openHash() .addFieldQuotedString("name", nd->name()); - + ClassSDict *cl = nd->getClassSDict(); if (cl) { @@ -2029,12 +2029,12 @@ void PerlModGenerator::generatePerlModForFile(const FileDef *fd) // - source code // - location // - number of lines - + if (fd->isReference()) return; m_output.openHash() .addFieldQuotedString("name", fd->name()); - + IncludeInfo *inc; m_output.openList("includes"); if (fd->includeFileList()) @@ -2052,7 +2052,7 @@ void PerlModGenerator::generatePerlModForFile(const FileDef *fd) } } m_output.closeList(); - + m_output.openList("included_by"); if (fd->includedByFileList()) { @@ -2069,7 +2069,7 @@ void PerlModGenerator::generatePerlModForFile(const FileDef *fd) } } m_output.closeList(); - + /* DGA: fix #7494 Perlmod does not generate grouped members from files */ generatePerlUserDefinedSection(fd, fd->getMemberGroupSDict()); @@ -2196,7 +2196,7 @@ void PerlModGenerator::generatePerlModForPage(PageDef *pd) m_output.openHash() .addFieldQuotedString("name", pd->name()); - + const SectionInfo *si = SectionManager::instance().find(pd->name()); if (si) m_output.addFieldQuotedString("title4", filterTitle(si->title())); @@ -2210,12 +2210,12 @@ bool PerlModGenerator::generatePerlModOutput() QFile outputFile; if (!createOutputFile(outputFile, pathDoxyDocsPM)) return false; - + FTextStream outputTextStream(&outputFile); PerlModOutputStream outputStream(&outputTextStream); m_output.setPerlModOutputStream(&outputStream); m_output.add("$doxydocs=").openHash(); - + m_output.openList("classes"); ClassSDict::Iterator cli(*Doxygen::classSDict); const ClassDef *cd; @@ -2231,14 +2231,12 @@ bool PerlModGenerator::generatePerlModOutput() m_output.closeList(); m_output.openList("files"); - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - for (;(fn=fnli.current());++fnli) + for (const auto &fn : *Doxygen::inputNameLinkedMap) { - FileNameIterator fni(*fn); - const FileDef *fd; - for (;(fd=fni.current());++fni) - generatePerlModForFile(fd); + for (const auto &fd : *fn) + { + generatePerlModForFile(fd.get()); + } } m_output.closeList(); @@ -2317,7 +2315,7 @@ bool PerlModGenerator::createOutputDir(QDir &perlModDir) return false; } } - + perlModDir.setPath(outputDirectory+"/perlmod"); if (!perlModDir.exists() && !perlModDir.mkdir(outputDirectory+"/perlmod")) { @@ -2334,7 +2332,7 @@ bool PerlModGenerator::generateDoxyStructurePM() return false; FTextStream doxyModelPMStream(&doxyModelPM); - doxyModelPMStream << + doxyModelPMStream << "sub memberlist($) {\n" " my $prefix = $_[0];\n" " return\n" @@ -2464,7 +2462,7 @@ bool PerlModGenerator::generateDoxyStructurePM() "\t\tclasses =>\n" "\t\t [ \"list\", \"Classes\",\n" "\t\t [ \"hash\", \"Class\",\n" - "\t\t {\n" + "\t\t {\n" "\t\t name => [ \"string\", \"Classname\" ]\n" "\t\t }\n" "\t\t ],\n" @@ -2472,7 +2470,7 @@ bool PerlModGenerator::generateDoxyStructurePM() "\t\tnamespaces =>\n" "\t\t [ \"list\", \"Namespaces\",\n" "\t\t [ \"hash\", \"Namespace\",\n" - "\t\t {\n" + "\t\t {\n" "\t\t name => [ \"string\", \"NamespaceName\" ]\n" "\t\t }\n" "\t\t ],\n" @@ -2642,7 +2640,7 @@ bool PerlModGenerator::generateDoxyLatexStructurePL() return false; FTextStream doxyLatexStructurePLStream(&doxyLatexStructurePL); - doxyLatexStructurePLStream << + doxyLatexStructurePLStream << "use DoxyStructure;\n" "\n" "sub process($) {\n" @@ -2676,7 +2674,7 @@ bool PerlModGenerator::generateDoxyLatexPL() return false; FTextStream doxyLatexPLStream(&doxyLatexPL); - doxyLatexPLStream << + doxyLatexPLStream << "use DoxyStructure;\n" "use DoxyDocs;\n" "\n" @@ -2799,7 +2797,7 @@ bool PerlModGenerator::generateDoxyFormatTex() return false; FTextStream doxyFormatTexStream(&doxyFormatTex); - doxyFormatTexStream << + doxyFormatTexStream << "\\def\\Defcs#1{\\long\\expandafter\\def\\csname#1\\endcsname}\n" "\\Defcs{Empty}{}\n" "\\def\\IfEmpty#1{\\expandafter\\ifx\\csname#1\\endcsname\\Empty}\n" @@ -3045,12 +3043,12 @@ void generatePerlMod() (global-set-key '(control z) (lambda () (interactive) (save-excursion (if (< (mark) (point)) (exchange-point-and-mark)) - (let ((start (point)) (replacers + (let ((start (point)) (replacers '(("\\\\" "\\\\\\\\") ("\"" "\\\\\"") ("\t" "\\\\t") ("^.*$" "\"\\&\\\\n\"")))) - (while replacers + (while replacers (while (re-search-forward (caar replacers) (mark) t) (replace-match (cadar replacers) t)) (goto-char start) @@ -1705,11 +1705,11 @@ static void setFileName(yyscan_t yyscanner,const char *name) bool ambig; QFileInfo fi(name); state->yyFileName=fi.absFilePath().utf8(); - state->yyFileDef=findFileDef(Doxygen::inputNameDict,state->yyFileName,ambig); + state->yyFileDef=findFileDef(Doxygen::inputNameLinkedMap,state->yyFileName,ambig); if (state->yyFileDef==0) // if this is not an input file check if it is an // include file { - state->yyFileDef=findFileDef(Doxygen::includeNameDict,state->yyFileName,ambig); + state->yyFileDef=findFileDef(Doxygen::includeNameLinkedMap,state->yyFileName,ambig); } //printf("setFileName(%s) state->yyFileName=%s state->yyFileDef=%p\n", // name,state->yyFileName.data(),state->yyFileDef); @@ -2958,7 +2958,7 @@ static void readIncludeFile(yyscan_t yyscanner,const QCString &inc) // add include dependency to the file in which the #include was found bool ambig; // change to absolute name for bug 641336 - FileDef *incFd = findFileDef(Doxygen::inputNameDict,absIncFileName,ambig); + FileDef *incFd = findFileDef(Doxygen::inputNameLinkedMap,absIncFileName,ambig); oldFileDef->addIncludeDependency(ambig ? 0 : incFd,incFileName,localInclude,state->isImported,FALSE); // add included by dependency if (state->yyFileDef) @@ -3001,7 +3001,7 @@ static void readIncludeFile(yyscan_t yyscanner,const QCString &inc) bool ambig; // change to absolute name for bug 641336 - FileDef *fd = findFileDef(Doxygen::inputNameDict,absIncFileName,ambig); + FileDef *fd = findFileDef(Doxygen::inputNameLinkedMap,absIncFileName,ambig); //printf("%s::findFileDef(%s)=%p\n",oldFileDef->name().data(),incFileName.data(),fd); // add include dependency to the file in which the #include was found oldFileDef->addIncludeDependency(ambig ? 0 : fd,incFileName,localInclude,state->isImported,FALSE); diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 1a11989..77455cb 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -1,6 +1,6 @@ /****************************************************************************** * - * + * * * Copyright (C) 1997-2015 by Parker Waechter & Dimitri van Heesch. * @@ -61,7 +61,7 @@ static QCString dateToRTFDateString() d.date().year(), d.date().month(), d.date().day(), d.time().hour(),d.time().minute(),d.time().second()); return result; -} +} RTFGenerator::RTFGenerator() : OutputGenerator() { @@ -512,7 +512,7 @@ void RTFGenerator::startIndexSection(IndexSections is) bool found=FALSE; for (cli.toFirst();(cd=cli.current()) && !found;++cli) { - if (cd->isLinkableInProject() && + if (cd->isLinkableInProject() && cd->templateMaster()==0 && !cd->isEmbeddedInOuterScope() ) @@ -527,13 +527,9 @@ void RTFGenerator::startIndexSection(IndexSections is) { //File Documentation bool isFirst=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) { if (fd->isLinkableInProject()) { @@ -573,7 +569,7 @@ void RTFGenerator::startIndexSection(IndexSections is) void RTFGenerator::endIndexSection(IndexSections is) { bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); - bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); + bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); static QCString projectName = Config_getString(PROJECT_NAME); @@ -622,7 +618,7 @@ void RTFGenerator::endIndexSection(IndexSections is) t << "{\\field\\fldedit {\\*\\fldinst TITLE \\\\*MERGEFORMAT}{\\fldrslt "; writeDoc(root,0,0); t << "}}\\par" << endl; - + } t << rtf_Style_Reset << rtf_Style["SubTitle"]->reference << endl; // set to title style @@ -700,7 +696,7 @@ void RTFGenerator::endIndexSection(IndexSections is) { t << "{\\tc \\v " << theTranslator->trNamespaceIndex() << "}" << endl; } - + t << "{\\field\\fldedit{\\*\\fldinst INCLUDETEXT \"namespaces.rtf\" \\\\*MERGEFORMAT}{\\fldrslt includedstuff}}\n"; break; case isClassHierarchyIndex: @@ -813,7 +809,7 @@ void RTFGenerator::endIndexSection(IndexSections is) } for (cli.toFirst();(cd=cli.current()) && !found;++cli) { - if (cd->isLinkableInProject() && + if (cd->isLinkableInProject() && cd->templateMaster()==0 && !cd->isEmbeddedInOuterScope() ) @@ -827,7 +823,7 @@ void RTFGenerator::endIndexSection(IndexSections is) } for (;(cd=cli.current());++cli) { - if (cd->isLinkableInProject() && + if (cd->isLinkableInProject() && cd->templateMaster()==0 && !cd->isEmbeddedInOuterScope() ) @@ -846,13 +842,9 @@ void RTFGenerator::endIndexSection(IndexSections is) bool isFirst=TRUE; t << "{\\tc \\v " << theTranslator->trFileDocumentation() << "}"<< endl; - 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) { if (fd->isLinkableInProject()) { @@ -1257,22 +1249,22 @@ void RTFGenerator::endSubsubsection() // t << "}"; //} -//void RTFGenerator::startTable(bool,int colNumbers) +//void RTFGenerator::startTable(bool,int colNumbers) //{ // DBG_RTF(t << "{\\comment startTable}\n";) // m_numCols=colNumbers; // t << "\\par\n"; //} // -//void RTFGenerator::endTable(bool hasCaption) -//{ +//void RTFGenerator::endTable(bool hasCaption) +//{ // DBG_RTF(t << "{\\comment endTable}\n";) -// if (!hasCaption) -// t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n"; -// t << "\\pard\n" << endl; +// if (!hasCaption) +// t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n"; +// t << "\\pard\n" << endl; //} // -//void RTFGenerator::startCaption() +//void RTFGenerator::startCaption() //{ // DBG_RTF(t << "{\\comment startCaption}\n";) // endTableRow(); @@ -1281,15 +1273,15 @@ void RTFGenerator::endSubsubsection() // nextTableColumn(); //} // -//void RTFGenerator::endCaption() +//void RTFGenerator::endCaption() //{ // DBG_RTF(t << "{\\comment endCaption}\n";) // endTableColumn(); // endTableRow(); //} // -//void RTFGenerator::nextTableRow() -//{ +//void RTFGenerator::nextTableRow() +//{ // DBG_RTF(t << "{\\comment nextTableRow}\n";) // ASSERT(m_numCols>0 && m_numCols<25); // uint columnWidth=rtf_pageWidth/m_numCols; @@ -1297,7 +1289,7 @@ void RTFGenerator::endSubsubsection() // "\\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10 " // "\\trbrdrr\\brdrs\\brdrw10 \\trbrdrh\\brdrs\\brdrw10 " // "\\trbrdrv\\brdrs\\brdrw10 "<<endl; -// for (int i=0;i<m_numCols;i++) +// for (int i=0;i<m_numCols;i++) // { // t << "\\clvertalt\\clbrdrt\\brdrs\\brdrw10 \\clbrdrl\\brdrs\\brdrw10 " // "\\clbrdrb\\brdrs\\brdrw10 \\clbrdrr \\brdrs\\brdrw10 \\cltxlrtb " @@ -1305,21 +1297,21 @@ void RTFGenerator::endSubsubsection() // } // t << "\\pard \\widctlpar\\intbl\\adjustright\n{"; //} -// -//void RTFGenerator::endTableRow() -//{ +// +//void RTFGenerator::endTableRow() +//{ // DBG_RTF(t << "{\\comment endTableRow}\n";) // t << "\n\\pard \\widctlpar\\intbl\\adjustright\n{\\row }\n"; //} -// -//void RTFGenerator::nextTableColumn() +// +//void RTFGenerator::nextTableColumn() //{ // DBG_RTF(t << "{\\comment nextTableColumn}\n";) // t << "{ "; //} // -//void RTFGenerator::endTableColumn() -//{ +//void RTFGenerator::endTableColumn() +//{ // DBG_RTF(t << "{\\comment endTableColumn}\n";) // t << " \\cell }"; //} @@ -2807,32 +2799,32 @@ void RTFGenerator::writeDoc(DocNode *n,const Definition *ctx,const MemberDef *) { RTFDocVisitor *visitor = new RTFDocVisitor(t,*this,ctx?ctx->getDefFileExtension():QCString("")); n->accept(visitor); - delete visitor; + delete visitor; m_omitParagraph = TRUE; } -void RTFGenerator::rtfwriteRuler_doubleline() -{ +void RTFGenerator::rtfwriteRuler_doubleline() +{ DBG_RTF(t << "{\\comment (rtfwriteRuler_doubleline)}" << endl) - t << "{\\pard\\widctlpar\\brdrb\\brdrdb\\brdrw15\\brsp20 \\adjustright \\par}" << endl; + t << "{\\pard\\widctlpar\\brdrb\\brdrdb\\brdrw15\\brsp20 \\adjustright \\par}" << endl; } -void RTFGenerator::rtfwriteRuler_emboss() -{ +void RTFGenerator::rtfwriteRuler_emboss() +{ DBG_RTF(t << "{\\comment (rtfwriteRuler_emboss)}" << endl) - t << "{\\pard\\widctlpar\\brdrb\\brdremboss\\brdrw15\\brsp20 \\adjustright \\par}" << endl; + t << "{\\pard\\widctlpar\\brdrb\\brdremboss\\brdrw15\\brsp20 \\adjustright \\par}" << endl; } -void RTFGenerator::rtfwriteRuler_thick() -{ +void RTFGenerator::rtfwriteRuler_thick() +{ DBG_RTF(t << "{\\comment (rtfwriteRuler_thick)}" << endl) - t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw75\\brsp20 \\adjustright \\par}" << endl; + t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw75\\brsp20 \\adjustright \\par}" << endl; } -void RTFGenerator::rtfwriteRuler_thin() -{ +void RTFGenerator::rtfwriteRuler_thin() +{ DBG_RTF(t << "{\\comment (rtfwriteRuler_thin)}" << endl) - t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw5\\brsp20 \\adjustright \\par}" << endl; + t << "{\\pard\\widctlpar\\brdrb\\brdrs\\brdrw5\\brsp20 \\adjustright \\par}" << endl; } #if 0 @@ -2845,9 +2837,9 @@ void RTFGenerator::postProcess(QByteArray &a) for (i=0;i<a.size();i++) { unsigned char c = (unsigned char)a.at(i); - + // treat characters > 0x80 as multibyte characters, except when they - // are control characters + // are control characters if (c>0x80 || (mbFlag && c!='\\' && c!='{' && c!='}')) { char s[10]; @@ -2870,7 +2862,7 @@ void RTFGenerator::startConstraintList(const char *header) { DBG_RTF(t << "{\\comment (startConstraintList)}" << endl) t << "{"; // ends at endConstraintList - t << "{"; + t << "{"; startBold(); newParagraph(); docify(header); @@ -2938,7 +2930,7 @@ void RTFGenerator::endIndexListItem() t << "\\par" << endl; } -void RTFGenerator::startInlineHeader() +void RTFGenerator::startInlineHeader() { DBG_RTF(t << "{\\comment (startInlineHeader)}" << endl) t << "{" << endl; @@ -2946,7 +2938,7 @@ void RTFGenerator::startInlineHeader() startBold(); } -void RTFGenerator::endInlineHeader() +void RTFGenerator::endInlineHeader() { DBG_RTF(t << "{\\comment (endInlineHeader)}" << endl) endBold(); diff --git a/src/searchindex.cpp b/src/searchindex.cpp index 25d1576..00786d6 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -831,19 +831,15 @@ void createJavaScriptSearchIndex() } // index files - FileNameListIterator inli(*Doxygen::inputNameList); - FileName *fn; - for (;(fn=inli.current());++inli) + for (const auto &fn : *Doxygen::inputNameLinkedMap) { - FileNameIterator fni(*fn); - FileDef *fd; - for (;(fd=fni.current());++fni) + for (const auto &fd : *fn) { uint letter = getUtf8CodeToLower(fd->name(),0); if (fd->isLinkable() && isId(letter)) { - g_searchIndexInfo[SEARCH_INDEX_ALL].symbolList.append(letter,fd); - g_searchIndexInfo[SEARCH_INDEX_FILES].symbolList.append(letter,fd); + g_searchIndexInfo[SEARCH_INDEX_ALL].symbolList.append(letter,fd.get()); + g_searchIndexInfo[SEARCH_INDEX_FILES].symbolList.append(letter,fd.get()); } } } diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index 1ab81fc..4cbb18f 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -501,9 +501,9 @@ const char * table_schema[][2] = { ////////////////////////////////////////////////////// struct SqlStmt { - const char *query; - sqlite3_stmt *stmt; - sqlite3 *db; + const char *query = 0; + sqlite3_stmt *stmt = 0; + sqlite3 *db = 0; }; ////////////////////////////////////////////////////// /* If you add a new statement below, make sure to add it to @@ -924,7 +924,7 @@ static int insertPath(QCString name, bool local=TRUE, bool found=TRUE, int type= static void recordMetadata() { - bindTextParameter(meta_insert,":doxygen_version",getVersion()); + bindTextParameter(meta_insert,":doxygen_version",getFullVersion()); bindTextParameter(meta_insert,":schema_version","0.2.0"); //TODO: this should be a constant somewhere; not sure where bindTextParameter(meta_insert,":generated_at",dateToString(TRUE), FALSE); bindTextParameter(meta_insert,":generated_on",dateToString(FALSE), FALSE); @@ -1218,8 +1218,6 @@ static void pragmaTuning(sqlite3 *db) static int initializeTables(sqlite3* db) { int rc; - sqlite3_stmt *stmt = 0; - msg("Initializing DB schema (tables)...\n"); for (unsigned int k = 0; k < sizeof(table_schema) / sizeof(table_schema[0]); k++) { @@ -1238,8 +1236,6 @@ static int initializeTables(sqlite3* db) static int initializeViews(sqlite3* db) { int rc; - sqlite3_stmt *stmt = 0; - msg("Initializing DB schema (views)...\n"); for (unsigned int k = 0; k < sizeof(view_schema) / sizeof(view_schema[0]); k++) { @@ -2612,16 +2608,12 @@ void generateSqlite3() } // + files - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - for (;(fn=fnli.current());++fnli) + for (const auto &fn : *Doxygen::inputNameLinkedMap) { - FileNameIterator fni(*fn); - const FileDef *fd; - for (;(fd=fni.current());++fni) + for (const auto &fd : *fn) { msg("Generating Sqlite3 output for file %s\n",fd->name().data()); - generateSqlite3ForFile(fd); + generateSqlite3ForFile(fd.get()); } } diff --git a/src/tagreader.cpp b/src/tagreader.cpp index 275d66a..78cbb20 100644 --- a/src/tagreader.cpp +++ b/src/tagreader.cpp @@ -1388,21 +1388,18 @@ void TagFileParser::buildLists(const std::shared_ptr<Entry> &root) QCString fullName = m_tagName+":"+tfi->path+stripPath(tfi->name); fe->fileName = fullName; //printf("createFileDef() filename=%s\n",tfi->filename.data()); - FileDef *fd = createFileDef(m_tagName+":"+tfi->path, + std::unique_ptr<FileDef> fd { createFileDef(m_tagName+":"+tfi->path, tfi->name,m_tagName, - tfi->filename - ); + tfi->filename) }; FileName *mn; - if ((mn=Doxygen::inputNameDict->find(tfi->name))) + if ((mn=Doxygen::inputNameLinkedMap->find(tfi->name))) { - mn->append(fd); + mn->push_back(std::move(fd)); } else { - mn = new FileName(fullName,tfi->name); - mn->append(fd); - Doxygen::inputNameList->inSort(mn); - Doxygen::inputNameDict->insert(tfi->name,mn); + mn = Doxygen::inputNameLinkedMap->add(tfi->name,fullName); + mn->push_back(std::move(fd)); } buildMemberList(fe,tfi->members); root->moveToSubEntryAndKeep(fe); @@ -1504,13 +1501,10 @@ void TagFileParser::addIncludes() for (fit.toFirst();(tfi=fit.current());++fit) { //printf("tag file tagName=%s path=%s name=%s\n",m_tagName.data(),tfi->path.data(),tfi->name.data()); - FileName *fn = Doxygen::inputNameDict->find(tfi->name); + FileName *fn = Doxygen::inputNameLinkedMap->find(tfi->name); if (fn) { - //printf("found\n"); - FileNameIterator fni(*fn); - FileDef *fd; - for (;(fd=fni.current());++fni) + for (const auto &fd : *fn) { //printf("input file path=%s name=%s\n",fd->getPath().data(),fd->name().data()); if (fd->getPath()==QCString(m_tagName+":"+tfi->path)) @@ -1521,19 +1515,17 @@ void TagFileParser::addIncludes() for (;(ii=mii.current());++mii) { //printf("ii->name='%s'\n",ii->name.data()); - FileName *ifn = Doxygen::inputNameDict->find(ii->name); + FileName *ifn = Doxygen::inputNameLinkedMap->find(ii->name); ASSERT(ifn!=0); if (ifn) { - FileNameIterator ifni(*ifn); - FileDef *ifd; - for (;(ifd=ifni.current());++ifni) + for (const auto &ifd : *ifn) { //printf("ifd->getOutputFileBase()=%s ii->id=%s\n", // ifd->getOutputFileBase().data(),ii->id.data()); if (ifd->getOutputFileBase()==QCString(ii->id)) { - fd->addIncludeDependency(ifd,ii->text,ii->isLocal,ii->isImported,FALSE); + fd->addIncludeDependency(ifd.get(),ii->text,ii->isLocal,ii->isImported,FALSE); } } } diff --git a/src/util.cpp b/src/util.cpp index bcc32f3..920e794 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -4159,7 +4159,7 @@ bool resolveRef(/* in */ const char *scName, else if (tsName.find('.')!=-1) // maybe a link to a file { bool ambig; - fd=findFileDef(Doxygen::inputNameDict,tsName,ambig); + fd=findFileDef(Doxygen::inputNameLinkedMap,tsName,ambig); if (fd && !ambig) { *resContext=fd; @@ -4333,7 +4333,7 @@ bool resolveLink(/* in */ const char *scName, *resContext=gd; return TRUE; } - else if ((fd=findFileDef(Doxygen::inputNameDict,linkRef,ambig)) // file link + else if ((fd=findFileDef(Doxygen::inputNameLinkedMap,linkRef,ambig)) // file link && fd->isLinkable()) { *resContext=fd; @@ -4440,7 +4440,7 @@ void generateFileRef(OutputDocInterface &od,const char *name,const char *text) //FileInfo *fi; FileDef *fd; bool ambig; - if ((fd=findFileDef(Doxygen::inputNameDict,name,ambig)) && + if ((fd=findFileDef(Doxygen::inputNameLinkedMap,name,ambig)) && fd->isLinkable()) // link to documented input file od.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,linkText); @@ -4488,14 +4488,14 @@ struct FindFileCacheElem static QCache<FindFileCacheElem> g_findFileDefCache(5000); -FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig) +FileDef *findFileDef(const FileNameLinkedMap *fnMap,const char *n,bool &ambig) { ambig=FALSE; if (n==0) return 0; const int maxAddrSize = 20; char addr[maxAddrSize]; - qsnprintf(addr,maxAddrSize,"%p:",(void*)fnDict); + qsnprintf(addr,maxAddrSize,"%p:",(void*)fnMap); QCString key = addr; key+=n; @@ -4516,7 +4516,7 @@ FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig) QCString name=QDir::cleanDirPath(n).utf8(); QCString path; int slashPos; - FileName *fn; + const FileName *fn; if (name.isEmpty()) goto exit; slashPos=QMAX(name.findRev('/'),name.findRev('\\')); if (slashPos!=-1) @@ -4526,12 +4526,12 @@ FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig) //printf("path=%s name=%s\n",path.data(),name.data()); } if (name.isEmpty()) goto exit; - if ((fn=(*fnDict)[name])) + if ((fn=fnMap->find(name))) { //printf("fn->count()=%d\n",fn->count()); - if (fn->count()==1) + if (fn->size()==1) { - FileDef *fd = fn->getFirst(); + const std::unique_ptr<FileDef> &fd = fn->front(); #if defined(_WIN32) || defined(__MACOSX__) || defined(__CYGWIN__) // Windows or MacOSX bool isSamePath = fd->getPath().right(path.length()).lower()==path.lower(); #else // Unix @@ -4539,26 +4539,24 @@ FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig) #endif if (path.isEmpty() || isSamePath) { - cachedResult->fileDef = fd; + cachedResult->fileDef = fd.get(); g_findFileDefCache.insert(key,cachedResult); //printf("=1 ===> add to cache %p\n",fd); - return fd; + return fd.get(); } } else // file name alone is ambiguous { int count=0; - FileNameIterator fni(*fn); - FileDef *fd; FileDef *lastMatch=0; QCString pathStripped = stripFromIncludePath(path); - for (fni.toFirst();(fd=fni.current());++fni) + for (const auto &fd : *fn) { QCString fdStripPath = stripFromIncludePath(fd->getPath()); if (path.isEmpty() || fdStripPath.right(pathStripped.length())==pathStripped) { count++; - lastMatch=fd; + lastMatch=fd.get(); } } //printf(">1 ===> add to cache %p\n",fd); @@ -4583,7 +4581,7 @@ exit: //---------------------------------------------------------------------- -QCString showFileDefMatches(const FileNameDict *fnDict,const char *n) +QCString showFileDefMatches(const FileNameLinkedMap *fnMap,const char *n) { QCString result; QCString name=n; @@ -4594,12 +4592,10 @@ QCString showFileDefMatches(const FileNameDict *fnDict,const char *n) path=name.left(slashPos+1); name=name.right(name.length()-slashPos-1); } - FileName *fn; - if ((fn=(*fnDict)[name])) + const FileName *fn; + if ((fn=fnMap->find(name))) { - FileNameIterator fni(*fn); - FileDef *fd; - for (fni.toFirst();(fd=fni.current());++fni) + for (const auto &fd : *fn) { if (path.isEmpty() || fd->getPath().right(path.length())==path) { @@ -35,7 +35,7 @@ class ClassDef; class FileDef; class MemberList; class NamespaceDef; -class FileNameDict; +class FileNameLinkedMap; class ArgumentList; class OutputList; class OutputDocInterface; @@ -217,10 +217,10 @@ const ClassDef *getResolvedClass(const Definition *scope, NamespaceDef *getResolvedNamespace(const char *key); -FileDef *findFileDef(const FileNameDict *fnDict,const char *n, +FileDef *findFileDef(const FileNameLinkedMap *fnMap,const char *n, bool &ambig); -QCString showFileDefMatches(const FileNameDict *fnDict,const char *n); +QCString showFileDefMatches(const FileNameLinkedMap *fnMap,const char *n); int guessSection(const char *name); diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 3528627..162044b 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -2567,44 +2567,8 @@ static void writeUCFLink(const MemberDef* mdef,OutputList &ol) VhdlDocGen::formatString(largs,ol,mdef); } -bool VhdlDocGen::findConstraintFile(LayoutNavEntry *lne) -{ - FileName *fn=Doxygen::inputNameList->getFirst(); - //LayoutNavEntry *cc = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::Files); - uint count=Doxygen::inputNameList->count(); - LayoutNavEntry *kk = lne->parent();// find(LayoutNavEntry::Files); - // LayoutNavEntry *kks = kk->parent();// find(LayoutNavEntry::Files); - QCString file; - QCString co("Constraints"); - - QCString imgExt = getDotImageExtension(); - if (Config_getBool(HAVE_DOT) && imgExt=="svg") - { - QCString ov = theTranslator->trDesignOverview(); - QCString ofile("vhdl_design_overview"); - LayoutNavEntry *oo=new LayoutNavEntry( lne,LayoutNavEntry::MainPage,TRUE,ofile,ov,""); - kk->addChild(oo); - } - - uint i=0; - while (i<count) - { - FileDef *fd=fn->at(i); - if (fd->name().contains(".ucf") || fd->name().contains(".qsf")) - { - file = convertNameToFile(fd->name().data(),FALSE,FALSE); - LayoutNavEntry *ucf=new LayoutNavEntry(lne,LayoutNavEntry::MainPage,TRUE,file,co,""); - kk->addChild(ucf); - break; - } - i++; - } - return FALSE; -} - - // for cell_inst : [entity] work.proto [ (label|expr) ] -QCString VhdlDocGen::parseForConfig(QCString & entity,QCString & arch) +QCString VhdlDocGen::parseForConfig(QCString & entity,QCString & arch) { int index; QCString label; diff --git a/src/vhdldocgen.h b/src/vhdldocgen.h index 1e43a67..5442f88 100644 --- a/src/vhdldocgen.h +++ b/src/vhdldocgen.h @@ -3,8 +3,8 @@ * 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. * @@ -16,8 +16,8 @@ #ifndef VHDLDOCGEN_H #define VHDLDOCGEN_H -/** - * This class implements functions for parsing and generating +/** + * This class implements functions for parsing and generating * vhdl documents */ @@ -42,15 +42,15 @@ struct Argument; struct VhdlConfNode -{ - VhdlConfNode(const char* a,const char* b,const char* config,const char* cs,bool leaf) - { +{ + VhdlConfNode(const char* a,const char* b,const char* config,const char* cs,bool leaf) + { arch=a; // architecture e.g. for iobuffer arch=arch.lower(); binding=b; // binding e.g. use entity work.xxx(bev) binding=binding.lower(); confVhdl=config; // configuration foo is bar - compSpec=cs; + compSpec=cs; isInlineConf=false; // primary configuration? isLeaf=leaf; }; @@ -67,7 +67,7 @@ struct VhdlConfNode /** Class for generating documentation specific for VHDL */ -class VhdlDocGen +class VhdlDocGen { public: @@ -98,11 +98,11 @@ class VhdlDocGen USE, PROCESS, PORT, - UNITS, + UNITS, GENERIC, INSTANTIATION, GROUP, - VFILE, + VFILE, SHAREDVARIABLE, CONFIG, ALIAS, @@ -115,7 +115,7 @@ class VhdlDocGen static void init(); static QCString convertFileNameToClassName(QCString name); // --- used by vhdlscanner.l ----------- - + static bool isSubClass(ClassDef* cd,ClassDef *scd, bool followInstances,int level); static QCString getIndexWord(const char* ,int index); @@ -132,7 +132,7 @@ class VhdlDocGen static QCString* findKeyWord(const QCString& word); static ClassDef* getPackageName(const QCString& name); - static MemberDef* findMember(const QCString& className, + static MemberDef* findMember(const QCString& className, const QCString& memName); static void findAllPackages(ClassDef*); static MemberDef* findMemberDef(ClassDef* cd, @@ -207,19 +207,18 @@ class VhdlDocGen static QCString convertArgumentListToString(const ArgumentList &al,bool f); static QCString getProcessNumber(); static QCString getRecordNumber(); - + static QCString getClassName(const ClassDef*); static bool isNumber(const QCString& s); static QCString getProtectionName(int prot); static void parseUCF(const char* input,Entry* entity,QCString f,bool vendor); - static bool findConstraintFile( LayoutNavEntry *lne); static ClassDef* findArchitecture(const ClassDef *cd); static ClassDef* findArchitecture(QCString identifier, QCString entity_name); static void correctMemberProperties(MemberDef *md); - + static void writeSource(const MemberDef *mdef,OutputList& ol,const QCString & cname); static QCString parseForConfig(QCString & entity,QCString & arch); @@ -229,15 +228,15 @@ class VhdlDocGen static void writeOverview(OutputList &ol); static void writeOverview(); - + // flowcharts static void createFlowChart(const MemberDef*); //static void addFlowImage(const FTextStream &,const QCString &); - + static void setFlowMember( const MemberDef *flowMember); static const MemberDef *getFlowMember(); - static bool isVhdlClass (const Entry *cu) + static bool isVhdlClass (const Entry *cu) { return cu->spec==VhdlDocGen::ENTITY || cu->spec==VhdlDocGen::PACKAGE || @@ -290,7 +289,7 @@ class FlowChart BEGIN_NO = 1<<21 }; - //---------- create svg ------------------------------------------------------------- + //---------- create svg ------------------------------------------------------------- static void createSVG(); static void startDot(FTextStream &t); static void endDot(FTextStream &t); diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index 33426a7..045f87c 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -3,8 +3,8 @@ * Copyright (C) 1997-2020 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. * @@ -13,7 +13,7 @@ * */ -#include <qfileinfo.h> +#include <qfileinfo.h> #include "xmldocvisitor.h" #include "docparser.h" @@ -29,6 +29,7 @@ #include "config.h" #include "htmlentity.h" #include "emoji.h" +#include "filedef.h" static void visitCaption(XmlDocVisitor *parent, QList<DocNode> children) { @@ -37,9 +38,9 @@ static void visitCaption(XmlDocVisitor *parent, QList<DocNode> children) for (cli.toFirst();(n=cli.current());++cli) n->accept(parent); } -static void visitPreStart(FTextStream &t, const char *cmd, bool doCaption, - XmlDocVisitor *parent, QList<DocNode> children, - const QCString &name, bool writeType, DocImage::Type type, const QCString &width, +static void visitPreStart(FTextStream &t, const char *cmd, bool doCaption, + XmlDocVisitor *parent, QList<DocNode> children, + const QCString &name, bool writeType, DocImage::Type type, const QCString &width, const QCString &height, bool inlineImage = FALSE) { t << "<" << cmd; @@ -85,8 +86,8 @@ static void visitPostEnd(FTextStream &t, const char *cmd) t << "</" << cmd << ">" << endl; } -XmlDocVisitor::XmlDocVisitor(FTextStream &t,CodeOutputInterface &ci) - : DocVisitor(DocVisitor_XML), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) +XmlDocVisitor::XmlDocVisitor(FTextStream &t,CodeOutputInterface &ci) + : DocVisitor(DocVisitor_XML), m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE) { } @@ -156,7 +157,7 @@ void XmlDocVisitor::visit(DocEmoji *s) void XmlDocVisitor::visit(DocURL *u) { if (m_hide) return; - m_t << "<ulink url=\""; + m_t << "<ulink url=\""; if (u->isEmail()) m_t << "mailto:"; filter(u->url()); m_t << "\">"; @@ -218,12 +219,12 @@ void XmlDocVisitor::visit(DocStyleChange *s) if (s->enable()) m_t << "<small>"; else m_t << "</small>"; break; case DocStyleChange::Preformatted: - if (s->enable()) + if (s->enable()) { - m_t << "<preformatted>"; + m_t << "<preformatted>"; m_insidePre=TRUE; } - else + else { m_t << "</preformatted>"; m_insidePre=FALSE; @@ -254,14 +255,14 @@ void XmlDocVisitor::visit(DocVerbatim *s) Doxygen::parserManager->getCodeParser(lang) .parseCode(m_ci,s->context(),s->text(),langExt, s->isExample(),s->exampleFile()); - m_t << "</programlisting>"; + m_t << "</programlisting>"; break; - case DocVerbatim::Verbatim: + case DocVerbatim::Verbatim: m_t << "<verbatim>"; filter(s->text()); - m_t << "</verbatim>"; + m_t << "</verbatim>"; break; - case DocVerbatim::HtmlOnly: + case DocVerbatim::HtmlOnly: if (s->isBlock()) { m_t << "<htmlonly block=\"yes\">"; @@ -273,17 +274,17 @@ void XmlDocVisitor::visit(DocVerbatim *s) filter(s->text()); m_t << "</htmlonly>"; break; - case DocVerbatim::RtfOnly: + case DocVerbatim::RtfOnly: m_t << "<rtfonly>"; filter(s->text()); m_t << "</rtfonly>"; break; - case DocVerbatim::ManOnly: + case DocVerbatim::ManOnly: m_t << "<manonly>"; filter(s->text()); m_t << "</manonly>"; break; - case DocVerbatim::LatexOnly: + case DocVerbatim::LatexOnly: m_t << "<latexonly>"; filter(s->text()); m_t << "</latexonly>"; @@ -293,7 +294,7 @@ void XmlDocVisitor::visit(DocVerbatim *s) filter(s->text()); m_t << "</docbookonly>"; break; - case DocVerbatim::XmlOnly: + case DocVerbatim::XmlOnly: m_t << s->text(); break; case DocVerbatim::Dot: @@ -327,7 +328,7 @@ void XmlDocVisitor::visit(DocInclude *inc) switch(inc->type()) { case DocInclude::IncWithLines: - { + { m_t << "<programlisting filename=\"" << inc->file() << "\">"; QFileInfo cfi( inc->file() ); FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() ); @@ -345,10 +346,10 @@ void XmlDocVisitor::visit(DocInclude *inc) TRUE // show line numbers ); delete fd; - m_t << "</programlisting>"; + m_t << "</programlisting>"; } - break; - case DocInclude::Include: + break; + case DocInclude::Include: m_t << "<programlisting filename=\"" << inc->file() << "\">"; Doxygen::parserManager->getCodeParser(inc->extension()) .parseCode(m_ci,inc->context(), @@ -363,12 +364,12 @@ void XmlDocVisitor::visit(DocInclude *inc) 0, // memberDef FALSE // show line numbers ); - m_t << "</programlisting>"; + m_t << "</programlisting>"; break; - case DocInclude::DontInclude: - case DocInclude::DontIncWithLines: + case DocInclude::DontInclude: + case DocInclude::DontIncWithLines: break; - case DocInclude::HtmlInclude: + case DocInclude::HtmlInclude: if (inc->isBlock()) { m_t << "<htmlonly block=\"yes\">"; @@ -403,10 +404,10 @@ void XmlDocVisitor::visit(DocInclude *inc) filter(inc->text()); m_t << "</docbookonly>"; break; - case DocInclude::VerbInclude: + case DocInclude::VerbInclude: m_t << "<verbatim>"; filter(inc->text()); - m_t << "</verbatim>"; + m_t << "</verbatim>"; break; case DocInclude::Snippet: m_t << "<programlisting filename=\"" << inc->file() << "\">"; @@ -418,7 +419,7 @@ void XmlDocVisitor::visit(DocInclude *inc) inc->isExample(), inc->exampleFile() ); - m_t << "</programlisting>"; + m_t << "</programlisting>"; break; case DocInclude::SnipWithLines: { @@ -431,7 +432,7 @@ void XmlDocVisitor::visit(DocInclude *inc) extractBlock(inc->text(),inc->blockId()), langExt, inc->isExample(), - inc->exampleFile(), + inc->exampleFile(), fd, lineBlock(inc->text(),inc->blockId()), -1, // endLine @@ -440,11 +441,11 @@ void XmlDocVisitor::visit(DocInclude *inc) TRUE // show line number ); delete fd; - m_t << "</programlisting>"; + m_t << "</programlisting>"; } break; - case DocInclude::SnippetDoc: - case DocInclude::IncludeDoc: + case DocInclude::SnippetDoc: + case DocInclude::IncludeDoc: err("Internal inconsistency: found switch SnippetDoc / IncludeDoc in file: %s" "Please create a bug report\n",__FILE__); break; @@ -455,7 +456,7 @@ void XmlDocVisitor::visit(DocIncOperator *op) { //printf("DocIncOperator: type=%d first=%d, last=%d text='%s'\n", // op->type(),op->isFirst(),op->isLast(),op->text().data()); - if (op->isFirst()) + if (op->isFirst()) { if (!m_hide) { @@ -467,10 +468,10 @@ void XmlDocVisitor::visit(DocIncOperator *op) QCString locLangExt = getFileNameExtension(op->includeFileName()); if (locLangExt.isEmpty()) locLangExt = m_langExt; SrcLangExt langExt = getLanguageFromFileName(locLangExt); - if (op->type()!=DocIncOperator::Skip) + if (op->type()!=DocIncOperator::Skip) { popEnabled(); - if (!m_hide) + if (!m_hide) { FileDef *fd = 0; if (!op->includeFileName().isEmpty()) @@ -495,10 +496,10 @@ void XmlDocVisitor::visit(DocIncOperator *op) pushEnabled(); m_hide=TRUE; } - if (op->isLast()) + if (op->isLast()) { popEnabled(); - if (!m_hide) m_t << "</programlisting>"; + if (!m_hide) m_t << "</programlisting>"; } else { @@ -578,13 +579,13 @@ void XmlDocVisitor::visitPre(DocAutoListItem *) m_t << "<listitem>"; } -void XmlDocVisitor::visitPost(DocAutoListItem *) +void XmlDocVisitor::visitPost(DocAutoListItem *) { if (m_hide) return; m_t << "</listitem>"; } -void XmlDocVisitor::visitPre(DocPara *) +void XmlDocVisitor::visitPre(DocPara *) { if (m_hide) return; m_t << "<para>"; @@ -612,21 +613,21 @@ void XmlDocVisitor::visitPre(DocSimpleSect *s) m_t << "<simplesect kind=\""; switch(s->type()) { - case DocSimpleSect::See: + case DocSimpleSect::See: m_t << "see"; break; - case DocSimpleSect::Return: + case DocSimpleSect::Return: m_t << "return"; break; - case DocSimpleSect::Author: + case DocSimpleSect::Author: m_t << "author"; break; - case DocSimpleSect::Authors: + case DocSimpleSect::Authors: m_t << "authors"; break; - case DocSimpleSect::Version: + case DocSimpleSect::Version: m_t << "version"; break; - case DocSimpleSect::Since: + case DocSimpleSect::Since: m_t << "since"; break; - case DocSimpleSect::Date: + case DocSimpleSect::Date: m_t << "date"; break; - case DocSimpleSect::Note: + case DocSimpleSect::Note: m_t << "note"; break; case DocSimpleSect::Warning: m_t << "warning"; break; @@ -642,9 +643,9 @@ void XmlDocVisitor::visitPre(DocSimpleSect *s) m_t << "remark"; break; case DocSimpleSect::Attention: m_t << "attention"; break; - case DocSimpleSect::User: + case DocSimpleSect::User: m_t << "par"; break; - case DocSimpleSect::Rcs: + case DocSimpleSect::Rcs: m_t << "rcs"; break; case DocSimpleSect::Unknown: break; } @@ -687,7 +688,7 @@ void XmlDocVisitor::visitPre(DocSimpleListItem *) m_t << "<listitem>"; } -void XmlDocVisitor::visitPost(DocSimpleListItem *) +void XmlDocVisitor::visitPost(DocSimpleListItem *) { if (m_hide) return; m_t << "</listitem>\n"; @@ -704,7 +705,7 @@ void XmlDocVisitor::visitPre(DocSection *s) m_t << "</title>" << endl; } -void XmlDocVisitor::visitPost(DocSection *s) +void XmlDocVisitor::visitPost(DocSection *s) { m_t << "</sect" << s->level() << ">\n"; } @@ -712,18 +713,18 @@ void XmlDocVisitor::visitPost(DocSection *s) void XmlDocVisitor::visitPre(DocHtmlList *s) { if (m_hide) return; - if (s->type()==DocHtmlList::Ordered) - m_t << "<orderedlist>\n"; - else + if (s->type()==DocHtmlList::Ordered) + m_t << "<orderedlist>\n"; + else m_t << "<itemizedlist>\n"; } -void XmlDocVisitor::visitPost(DocHtmlList *s) +void XmlDocVisitor::visitPost(DocHtmlList *s) { if (m_hide) return; - if (s->type()==DocHtmlList::Ordered) - m_t << "</orderedlist>\n"; - else + if (s->type()==DocHtmlList::Ordered) + m_t << "</orderedlist>\n"; + else m_t << "</itemizedlist>\n"; } @@ -733,7 +734,7 @@ void XmlDocVisitor::visitPre(DocHtmlListItem *) m_t << "<listitem>\n"; } -void XmlDocVisitor::visitPost(DocHtmlListItem *) +void XmlDocVisitor::visitPost(DocHtmlListItem *) { if (m_hide) return; m_t << "</listitem>\n"; @@ -745,7 +746,7 @@ void XmlDocVisitor::visitPre(DocHtmlDescList *) m_t << "<variablelist>\n"; } -void XmlDocVisitor::visitPost(DocHtmlDescList *) +void XmlDocVisitor::visitPost(DocHtmlDescList *) { if (m_hide) return; m_t << "</variablelist>\n"; @@ -757,7 +758,7 @@ void XmlDocVisitor::visitPre(DocHtmlDescTitle *) m_t << "<varlistentry><term>"; } -void XmlDocVisitor::visitPost(DocHtmlDescTitle *) +void XmlDocVisitor::visitPost(DocHtmlDescTitle *) { if (m_hide) return; m_t << "</term></varlistentry>\n"; @@ -769,7 +770,7 @@ void XmlDocVisitor::visitPre(DocHtmlDescData *) m_t << "<listitem>"; } -void XmlDocVisitor::visitPost(DocHtmlDescData *) +void XmlDocVisitor::visitPost(DocHtmlDescData *) { if (m_hide) return; m_t << "</listitem>\n"; @@ -778,11 +779,11 @@ void XmlDocVisitor::visitPost(DocHtmlDescData *) void XmlDocVisitor::visitPre(DocHtmlTable *t) { if (m_hide) return; - m_t << "<table rows=\"" << t->numRows() + m_t << "<table rows=\"" << t->numRows() << "\" cols=\"" << t->numColumns() << "\">" ; } -void XmlDocVisitor::visitPost(DocHtmlTable *) +void XmlDocVisitor::visitPost(DocHtmlTable *) { if (m_hide) return; m_t << "</table>\n"; @@ -794,7 +795,7 @@ void XmlDocVisitor::visitPre(DocHtmlRow *) m_t << "<row>\n"; } -void XmlDocVisitor::visitPost(DocHtmlRow *) +void XmlDocVisitor::visitPost(DocHtmlRow *) { if (m_hide) return; m_t << "</row>\n"; @@ -844,10 +845,10 @@ void XmlDocVisitor::visitPre(DocHtmlCell *c) m_t << ">"; } -void XmlDocVisitor::visitPost(DocHtmlCell *) +void XmlDocVisitor::visitPost(DocHtmlCell *) { if (m_hide) return; - m_t << "</entry>"; + m_t << "</entry>"; } void XmlDocVisitor::visitPre(DocHtmlCaption *) @@ -856,7 +857,7 @@ void XmlDocVisitor::visitPre(DocHtmlCaption *) m_t << "<caption>"; } -void XmlDocVisitor::visitPost(DocHtmlCaption *) +void XmlDocVisitor::visitPost(DocHtmlCaption *) { if (m_hide) return; m_t << "</caption>\n"; @@ -868,7 +869,7 @@ void XmlDocVisitor::visitPre(DocInternal *) m_t << "<internal>"; } -void XmlDocVisitor::visitPost(DocInternal *) +void XmlDocVisitor::visitPost(DocInternal *) { if (m_hide) return; m_t << "</internal>" << endl; @@ -880,7 +881,7 @@ void XmlDocVisitor::visitPre(DocHRef *href) m_t << "<ulink url=\"" << convertToXML(href->url(), TRUE) << "\">"; } -void XmlDocVisitor::visitPost(DocHRef *) +void XmlDocVisitor::visitPost(DocHRef *) { if (m_hide) return; m_t << "</ulink>"; @@ -892,7 +893,7 @@ void XmlDocVisitor::visitPre(DocHtmlHeader *header) m_t << "<heading level=\"" << header->level() << "\">"; } -void XmlDocVisitor::visitPost(DocHtmlHeader *) +void XmlDocVisitor::visitPost(DocHtmlHeader *) { if (m_hide) return; m_t << "</heading>\n"; @@ -917,7 +918,7 @@ void XmlDocVisitor::visitPre(DocImage *img) // copy the image to the output dir FileDef *fd; bool ambig; - if (url.isEmpty() && (fd=findFileDef(Doxygen::imageNameDict,img->name(),ambig))) + if (url.isEmpty() && (fd=findFileDef(Doxygen::imageNameLinkedMap,img->name(),ambig))) { QFile inImage(fd->absFilePath()); QFile outImage(Config_getString(XML_OUTPUT)+"/"+baseName.data()); @@ -935,7 +936,7 @@ void XmlDocVisitor::visitPre(DocImage *img) } } -void XmlDocVisitor::visitPost(DocImage *) +void XmlDocVisitor::visitPost(DocImage *) { if (m_hide) return; visitPostEnd(m_t, "image"); @@ -947,7 +948,7 @@ void XmlDocVisitor::visitPre(DocDotFile *df) visitPreStart(m_t, "dotfile", FALSE, this, df->children(), df->file(), FALSE, DocImage::Html, df->width(), df->height()); } -void XmlDocVisitor::visitPost(DocDotFile *) +void XmlDocVisitor::visitPost(DocDotFile *) { if (m_hide) return; visitPostEnd(m_t, "dotfile"); @@ -959,7 +960,7 @@ void XmlDocVisitor::visitPre(DocMscFile *df) visitPreStart(m_t, "mscfile", FALSE, this, df->children(), df->file(), FALSE, DocImage::Html, df->width(), df->height()); } -void XmlDocVisitor::visitPost(DocMscFile *) +void XmlDocVisitor::visitPost(DocMscFile *) { if (m_hide) return; visitPostEnd(m_t, "mscfile"); @@ -983,7 +984,7 @@ void XmlDocVisitor::visitPre(DocLink *lnk) startLink(lnk->ref(),lnk->file(),lnk->anchor()); } -void XmlDocVisitor::visitPost(DocLink *) +void XmlDocVisitor::visitPost(DocLink *) { if (m_hide) return; endLink(); @@ -992,14 +993,14 @@ void XmlDocVisitor::visitPost(DocLink *) void XmlDocVisitor::visitPre(DocRef *ref) { if (m_hide) return; - if (!ref->file().isEmpty()) + if (!ref->file().isEmpty()) { startLink(ref->ref(),ref->file(),ref->isSubPage() ? QCString() : ref->anchor()); } if (!ref->hasLinkText()) filter(ref->targetTitle()); } -void XmlDocVisitor::visitPost(DocRef *ref) +void XmlDocVisitor::visitPost(DocRef *ref) { if (m_hide) return; if (!ref->file().isEmpty()) endLink(); @@ -1012,7 +1013,7 @@ void XmlDocVisitor::visitPre(DocSecRefItem *ref) m_t << "<tocitem id=\"" << ref->file() << "_1" << ref->anchor() << "\">"; } -void XmlDocVisitor::visitPost(DocSecRefItem *) +void XmlDocVisitor::visitPost(DocSecRefItem *) { if (m_hide) return; m_t << "</tocitem>" << endl; @@ -1024,7 +1025,7 @@ void XmlDocVisitor::visitPre(DocSecRefList *) m_t << "<toclist>" << endl; } -void XmlDocVisitor::visitPost(DocSecRefList *) +void XmlDocVisitor::visitPost(DocSecRefList *) { if (m_hide) return; m_t << "</toclist>" << endl; @@ -1036,7 +1037,7 @@ void XmlDocVisitor::visitPost(DocSecRefList *) // m_t << "<language langid=\"" << l->id() << "\">"; //} // -//void XmlDocVisitor::visitPost(DocLanguage *) +//void XmlDocVisitor::visitPost(DocLanguage *) //{ // if (m_hide) return; // m_t << "</language>" << endl; @@ -1048,13 +1049,13 @@ void XmlDocVisitor::visitPre(DocParamSect *s) m_t << "<parameterlist kind=\""; switch(s->type()) { - case DocParamSect::Param: + case DocParamSect::Param: m_t << "param"; break; - case DocParamSect::RetVal: + case DocParamSect::RetVal: m_t << "retval"; break; - case DocParamSect::Exception: + case DocParamSect::Exception: m_t << "exception"; break; - case DocParamSect::TemplateParam: + case DocParamSect::TemplateParam: m_t << "templateparam"; break; default: ASSERT(0); @@ -1088,11 +1089,11 @@ void XmlDocVisitor::visitPre(DocParamList *pl) { if (type->kind()==DocNode::Kind_Word) { - visit((DocWord*)type); + visit((DocWord*)type); } else if (type->kind()==DocNode::Kind_LinkedWord) { - visit((DocLinkedWord*)type); + visit((DocLinkedWord*)type); } else if (type->kind()==DocNode::Kind_Sep) { @@ -1123,11 +1124,11 @@ void XmlDocVisitor::visitPre(DocParamList *pl) m_t << ">"; if (param->kind()==DocNode::Kind_Word) { - visit((DocWord*)param); + visit((DocWord*)param); } else if (param->kind()==DocNode::Kind_LinkedWord) { - visit((DocLinkedWord*)param); + visit((DocLinkedWord*)param); } m_t << "</parametername>" << endl; } @@ -1169,7 +1170,7 @@ void XmlDocVisitor::visitPre(DocInternalRef *ref) startLink(0,ref->file(),ref->anchor()); } -void XmlDocVisitor::visitPost(DocInternalRef *) +void XmlDocVisitor::visitPost(DocInternalRef *) { if (m_hide) return; endLink(); @@ -1218,7 +1219,7 @@ void XmlDocVisitor::visitPost(DocParBlock *) void XmlDocVisitor::filter(const char *str) -{ +{ m_t << convertToXML(str); } diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 284332e..42d4426 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -3,8 +3,8 @@ * 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. * @@ -195,7 +195,7 @@ void writeXMLLink(FTextStream &t,const char *extRef,const char *compoundId, t << "<ref refid=\"" << compoundId; if (anchorId) t << "_1" << anchorId; t << "\" kindref=\""; - if (anchorId) t << "member"; else t << "compound"; + if (anchorId) t << "member"; else t << "compound"; t << "\""; if (extRef) t << " external=\"" << extRef << "\""; if (tooltip) t << " tooltip=\"" << convertToXML(tooltip) << "\""; @@ -211,7 +211,7 @@ class TextGeneratorXMLImpl : public TextGeneratorIntf TextGeneratorXMLImpl(FTextStream &t): m_t(t) {} void writeString(const char *s,bool /*keepSpaces*/) const { - writeXMLString(m_t,s); + writeXMLString(m_t,s); } void writeBreak(int) const {} void writeLink(const char *extRef,const char *file, @@ -412,7 +412,7 @@ static void writeXMLDocBlock(FTextStream &t, delete visitor; delete xmlCodeGen; delete root; - + } void writeXMLCodeBlock(FTextStream &t,FileDef *fd) @@ -448,7 +448,7 @@ static void writeMemberReference(FTextStream &t,const Definition *def,const Memb } t << " <" << tagName << " refid=\""; t << rmd->getOutputFileBase() << "_1" << rmd->anchor() << "\""; - if (rmd->getStartBodyLine()!=-1 && rmd->getBodyDef()) + if (rmd->getStartBodyLine()!=-1 && rmd->getBodyDef()) { t << " compoundref=\"" << rmd->getBodyDef()->getOutputFileBase() << "\""; t << " startline=\"" << rmd->getStartBodyLine() << "\""; @@ -458,7 +458,7 @@ static void writeMemberReference(FTextStream &t,const Definition *def,const Memb } } t << ">" << convertToXML(name) << "</" << tagName << ">" << endl; - + } static void stripQualifiers(QCString &typeStr) @@ -477,18 +477,18 @@ static void stripQualifiers(QCString &typeStr) static QCString classOutputFileBase(const ClassDef *cd) { //static bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES); - //if (inlineGroupedClasses && cd->partOfGroups()!=0) + //if (inlineGroupedClasses && cd->partOfGroups()!=0) return cd->getOutputFileBase(); - //else + //else // return cd->getOutputFileBase(); } static QCString memberOutputFileBase(const MemberDef *md) { //static bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES); - //if (inlineGroupedClasses && md->getClassDef() && md->getClassDef()->partOfGroups()!=0) + //if (inlineGroupedClasses && md->getClassDef() && md->getClassDef()->partOfGroups()!=0) // return md->getClassDef()->getXmlOutputFileBase(); - //else + //else // return md->getOutputFileBase(); return md->getOutputFileBase(); } @@ -506,11 +506,11 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream // + source definition // + source references // + source referenced by - // - body code - // + template arguments + // - body code + // + template arguments // (templateArguments(), definitionTemplateParameterLists()) // - call graph - + // enum values are written as part of the enum if (md->memberType()==MemberType_EnumValue) return; if (md->isHidden()) return; @@ -540,16 +540,16 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream case MemberType_Dictionary: memType="dictionary"; break; } - ti << " <member refid=\"" << memberOutputFileBase(md) - << "_1" << md->anchor() << "\" kind=\"" << memType << "\"><name>" + ti << " <member refid=\"" << memberOutputFileBase(md) + << "_1" << md->anchor() << "\" kind=\"" << memType << "\"><name>" << convertToXML(md->name()) << "</name></member>" << endl; - + QCString scopeName; - if (md->getClassDef()) + if (md->getClassDef()) scopeName=md->getClassDef()->name(); - else if (md->getNamespaceDef()) + else if (md->getNamespaceDef()) scopeName=md->getNamespaceDef()->name(); - + t << " <memberdef kind=\""; //enum { define_t,variable_t,typedef_t,enum_t,function_t } xmlType = function_t; t << memType << "\" id=\""; @@ -586,7 +586,7 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream { const ArgumentList &al = md->argumentList(); t << " const=\""; - if (al.constSpecifier) t << "yes"; else t << "no"; + if (al.constSpecifier) t << "yes"; else t << "no"; t << "\""; t << " explicit=\""; @@ -661,12 +661,12 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream { //ArgumentList *al = md->argumentList(); //t << " volatile=\""; - //if (al && al->volatileSpecifier) t << "yes"; else t << "no"; + //if (al && al->volatileSpecifier) t << "yes"; else t << "no"; t << " mutable=\""; if (md->isMutable()) t << "yes"; else t << "no"; t << "\""; - + if (md->isInitonly()) { t << " initonly=\"yes\""; @@ -796,7 +796,7 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream } t << " <name>" << convertToXML(md->name()) << "</name>" << endl; - + if (md->memberType() == MemberType_Property) { if (md->isReadable()) @@ -811,11 +811,11 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream if (bitfield.at(0)==':') bitfield=bitfield.mid(1); t << " <bitfield>" << convertToXML(bitfield) << "</bitfield>" << endl; } - + const MemberDef *rmd = md->reimplements(); if (rmd) { - t << " <reimplements refid=\"" + t << " <reimplements refid=\"" << memberOutputFileBase(rmd) << "_1" << rmd->anchor() << "\">" << convertToXML(rmd->name()) << "</reimplements>" << endl; } @@ -825,7 +825,7 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream MemberListIterator mli(*rbml); for (mli.toFirst();(rmd=mli.current());++mli) { - t << " <reimplementedby refid=\"" + t << " <reimplementedby refid=\"" << memberOutputFileBase(rmd) << "_1" << rmd->anchor() << "\">" << convertToXML(rmd->name()) << "</reimplementedby>" << endl; } @@ -863,7 +863,7 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream if (!a.name.isEmpty()) { t << " <declname>"; - writeXMLString(t,a.name); + writeXMLString(t,a.name); t << "</declname>" << endl; } if (defArg && !defArg->name.isEmpty() && defArg->name!=a.name) @@ -874,8 +874,8 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream } if (!a.array.isEmpty()) { - t << " <array>"; - writeXMLString(t,a.array); + t << " <array>"; + writeXMLString(t,a.array); t << "</array>" << endl; } if (!a.defval.isEmpty()) @@ -895,7 +895,7 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream } } } - else if (md->memberType()==MemberType_Define && + else if (md->memberType()==MemberType_Define && md->argsString()) // define { if (md->argumentList().empty()) // special case for "foo()" to @@ -925,7 +925,7 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream linkifyText(TextGeneratorXMLImpl(t),def,md->getBodyDef(),md,md->excpString()); t << "</exceptions>" << endl; } - + if (md->memberType()==MemberType_Enumeration) // enum { const MemberList *enumFields = md->enumFieldList(); @@ -979,9 +979,9 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream t << " </inbodydescription>" << endl; if (md->getDefLine()!=-1) { - t << " <location file=\"" + t << " <location file=\"" << convertToXML(stripFromPath(md->getDefFileName())) << "\" line=\"" - << md->getDefLine() << "\" column=\"" + << md->getDefLine() << "\" column=\"" << md->getDefColumn() << "\"" ; if (md->getStartBodyLine()!=-1) { @@ -990,7 +990,7 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream { t << " bodyfile=\"" << convertToXML(stripFromPath(bodyDef->absFilePath())) << "\""; } - t << " bodystart=\"" << md->getStartBodyLine() << "\" bodyend=\"" + t << " bodystart=\"" << md->getStartBodyLine() << "\" bodyend=\"" << md->getEndBodyLine() << "\""; } if (md->getDeclLine()!=-1) @@ -1021,7 +1021,7 @@ static void generateXMLForMember(const MemberDef *md,FTextStream &ti,FTextStream writeMemberReference(t,def,rmd,"referencedby"); } } - + t << " </memberdef>" << endl; } @@ -1112,7 +1112,7 @@ static void writeListOfAllMembers(const ClassDef *cd,FTextStream &t) { t << " ambiguityscope=\"" << convertToXML(mi->ambiguityResolutionScope) << "\""; } - t << "><scope>" << convertToXML(cd->name()) << "</scope><name>" << + t << "><scope>" << convertToXML(cd->name()) << "</scope><name>" << convertToXML(md->name()) << "</name></member>" << endl; } } @@ -1171,7 +1171,7 @@ static void writeInnerFiles(const FileList *fl,FTextStream &t) FileDef *fd; for (fli.toFirst();(fd=fli.current());++fli) { - t << " <innerfile refid=\"" << fd->getOutputFileBase() + t << " <innerfile refid=\"" << fd->getOutputFileBase() << "\">" << convertToXML(fd->name()) << "</innerfile>" << endl; } } @@ -1204,7 +1204,7 @@ static void writeInnerGroups(const GroupList *gl,FTextStream &t) for (gli.toFirst();(sgd=gli.current());++gli) { t << " <innergroup refid=\"" << sgd->getOutputFileBase() - << "\">" << convertToXML(sgd->groupTitle()) + << "\">" << convertToXML(sgd->groupTitle()) << "</innergroup>" << endl; } } @@ -1218,12 +1218,12 @@ static void writeInnerDirs(const DirList *dl,FTextStream &t) DirDef *subdir; for (subdirs.toFirst();(subdir=subdirs.current());++subdirs) { - t << " <innerdir refid=\"" << subdir->getOutputFileBase() + t << " <innerdir refid=\"" << subdir->getOutputFileBase() << "\">" << convertToXML(subdir->displayName()) << "</innerdir>" << endl; } } } - + static void generateXMLForClass(const ClassDef *cd,FTextStream &ti) { // + brief description @@ -1250,10 +1250,10 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti) msg("Generating XML output for class %s\n",cd->name().data()); - ti << " <compound refid=\"" << classOutputFileBase(cd) + ti << " <compound refid=\"" << classOutputFileBase(cd) << "\" kind=\"" << cd->compoundTypeString() << "\"><name>" << convertToXML(cd->name()) << "</name>" << endl; - + QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+ classOutputFileBase(cd)+".xml"; QFile f(fileName); @@ -1266,8 +1266,8 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti) //t.setEncoding(FTextStream::UnicodeUTF8); writeXMLHeader(t); - t << " <compounddef id=\"" - << classOutputFileBase(cd) << "\" kind=\"" + t << " <compounddef id=\"" + << classOutputFileBase(cd) << "\" kind=\"" << cd->compoundTypeString() << "\" language=\"" << langToString(cd->getLanguage()) << "\" prot=\""; switch (cd->protection()) @@ -1281,8 +1281,8 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti) if (cd->isSealed()) t << "\" sealed=\"yes"; if (cd->isAbstract()) t << "\" abstract=\"yes"; t << "\">" << endl; - t << " <compoundname>"; - writeXMLString(t,cd->name()); + t << " <compoundname>"; + writeXMLString(t,cd->name()); t << "</compoundname>" << endl; if (cd->baseClasses()) { @@ -1331,7 +1331,7 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti) BaseClassDef *bcd; for (bcli.toFirst();(bcd=bcli.current());++bcli) { - t << " <derivedcompoundref refid=\"" + t << " <derivedcompoundref refid=\"" << classOutputFileBase(bcd->classDef) << "\" prot=\""; switch (bcd->prot) @@ -1348,7 +1348,7 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti) case Virtual: t << "virtual"; break; case Pure: t << "pure-virtual"; break; } - t << "\">" << convertToXML(bcd->classDef->displayName()) + t << "\">" << convertToXML(bcd->classDef->displayName()) << "</derivedcompoundref>" << endl; } } @@ -1415,9 +1415,9 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti) collaborationGraph.writeXML(t); t << " </collaborationgraph>" << endl; } - t << " <location file=\"" + t << " <location file=\"" << convertToXML(stripFromPath(cd->getDefFileName())) << "\" line=\"" - << cd->getDefLine() << "\"" << " column=\"" + << cd->getDefLine() << "\"" << " column=\"" << cd->getDefColumn() << "\"" ; if (cd->getStartBodyLine()!=-1) { @@ -1426,7 +1426,7 @@ static void generateXMLForClass(const ClassDef *cd,FTextStream &ti) { t << " bodyfile=\"" << convertToXML(stripFromPath(bodyDef->absFilePath())) << "\""; } - t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\"" + t << " bodystart=\"" << cd->getStartBodyLine() << "\" bodyend=\"" << cd->getEndBodyLine() << "\""; } t << "/>" << endl; @@ -1450,10 +1450,10 @@ static void generateXMLForNamespace(const NamespaceDef *nd,FTextStream &ti) if (nd->isReference() || nd->isHidden()) return; // skip external references - ti << " <compound refid=\"" << nd->getOutputFileBase() - << "\" kind=\"namespace\"" << "><name>" + ti << " <compound refid=\"" << nd->getOutputFileBase() + << "\" kind=\"namespace\"" << "><name>" << convertToXML(nd->name()) << "</name>" << endl; - + QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+nd->getOutputFileBase()+".xml"; QFile f(fileName); @@ -1464,10 +1464,10 @@ static void generateXMLForNamespace(const NamespaceDef *nd,FTextStream &ti) } FTextStream t(&f); //t.setEncoding(FTextStream::UnicodeUTF8); - + writeXMLHeader(t); - t << " <compounddef id=\"" << nd->getOutputFileBase() - << "\" kind=\"namespace\" language=\"" + t << " <compounddef id=\"" << nd->getOutputFileBase() + << "\" kind=\"namespace\" language=\"" << langToString(nd->getLanguage()) << "\">" << endl; t << " <compoundname>"; writeXMLString(t,nd->name()); @@ -1528,13 +1528,13 @@ static void generateXMLForFile(FileDef *fd,FTextStream &ti) // + source code // + location // - number of lines - + if (fd->isReference()) return; // skip external references - - ti << " <compound refid=\"" << fd->getOutputFileBase() - << "\" kind=\"file\"><name>" << convertToXML(fd->name()) + + ti << " <compound refid=\"" << fd->getOutputFileBase() + << "\" kind=\"file\"><name>" << convertToXML(fd->name()) << "</name>" << endl; - + QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+fd->getOutputFileBase()+".xml"; QFile f(fileName); @@ -1548,7 +1548,7 @@ static void generateXMLForFile(FileDef *fd,FTextStream &ti) writeXMLHeader(t); t << " <compounddef id=\"" << fd->getOutputFileBase() - << "\" kind=\"file\" language=\"" + << "\" kind=\"file\" language=\"" << langToString(fd->getLanguage()) << "\">" << endl; t << " <compoundname>"; writeXMLString(t,fd->name()); @@ -1669,9 +1669,9 @@ static void generateXMLForGroup(const GroupDef *gd,FTextStream &ti) if (gd->isReference()) return; // skip external references - ti << " <compound refid=\"" << gd->getOutputFileBase() + ti << " <compound refid=\"" << gd->getOutputFileBase() << "\" kind=\"group\"><name>" << convertToXML(gd->name()) << "</name>" << endl; - + QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+gd->getOutputFileBase()+".xml"; QFile f(fileName); @@ -1684,7 +1684,7 @@ static void generateXMLForGroup(const GroupDef *gd,FTextStream &ti) FTextStream t(&f); //t.setEncoding(FTextStream::UnicodeUTF8); writeXMLHeader(t); - t << " <compounddef id=\"" + t << " <compounddef id=\"" << gd->getOutputFileBase() << "\" kind=\"group\">" << endl; t << " <compoundname>" << convertToXML(gd->name()) << "</compoundname>" << endl; t << " <title>" << convertToXML(gd->groupTitle()) << "</title>" << endl; @@ -1731,8 +1731,8 @@ static void generateXMLForGroup(const GroupDef *gd,FTextStream &ti) static void generateXMLForDir(DirDef *dd,FTextStream &ti) { if (dd->isReference()) return; // skip external references - ti << " <compound refid=\"" << dd->getOutputFileBase() - << "\" kind=\"dir\"><name>" << convertToXML(dd->displayName()) + ti << " <compound refid=\"" << dd->getOutputFileBase() + << "\" kind=\"dir\"><name>" << convertToXML(dd->displayName()) << "</name>" << endl; QCString outputDirectory = Config_getString(XML_OUTPUT); @@ -1747,7 +1747,7 @@ static void generateXMLForDir(DirDef *dd,FTextStream &ti) FTextStream t(&f); //t.setEncoding(FTextStream::UnicodeUTF8); writeXMLHeader(t); - t << " <compounddef id=\"" + t << " <compounddef id=\"" << dd->getOutputFileBase() << "\" kind=\"dir\">" << endl; t << " <compoundname>" << convertToXML(dd->displayName()) << "</compoundname>" << endl; @@ -1776,18 +1776,18 @@ static void generateXMLForPage(PageDef *pd,FTextStream &ti,bool isExample) const char *kindName = isExample ? "example" : "page"; if (pd->isReference()) return; - + QCString pageName = pd->getOutputFileBase(); if (pd->getGroupDef()) { pageName+=(QCString)"_"+pd->name(); } if (pageName=="index") pageName="indexpage"; // to prevent overwriting the generated index page. - + ti << " <compound refid=\"" << pageName - << "\" kind=\"" << kindName << "\"><name>" << convertToXML(pd->name()) + << "\" kind=\"" << kindName << "\"><name>" << convertToXML(pd->name()) << "</name>" << endl; - + QCString outputDirectory = Config_getString(XML_OUTPUT); QCString fileName=outputDirectory+"/"+pageName+".xml"; QFile f(fileName); @@ -1802,7 +1802,7 @@ static void generateXMLForPage(PageDef *pd,FTextStream &ti,bool isExample) writeXMLHeader(t); t << " <compounddef id=\"" << pageName; t << "\" kind=\"" << kindName << "\">" << endl; - t << " <compoundname>" << convertToXML(pd->name()) + t << " <compoundname>" << convertToXML(pd->name()) << "</compoundname>" << endl; if (pd==Doxygen::mainPage) // main page is special @@ -1816,7 +1816,7 @@ static void generateXMLForPage(PageDef *pd,FTextStream &ti,bool isExample) { title = Config_getString(PROJECT_NAME); } - t << " <title>" << convertToXML(convertCharEntitiesToUTF8(title)) + t << " <title>" << convertToXML(convertCharEntitiesToUTF8(title)) << "</title>" << endl; } else @@ -1911,7 +1911,7 @@ void generateXML() // + groups // + related pages // - examples - + QCString outputDirectory = Config_getString(XML_OUTPUT); QDir xmlDir(outputDirectory); createSubDirs(xmlDir); @@ -1994,16 +1994,12 @@ void generateXML() msg("Generating XML output for namespace %s\n",nd->name().data()); generateXMLForNamespace(nd,t); } - FileNameListIterator fnli(*Doxygen::inputNameList); - FileName *fn; - for (;(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) { msg("Generating XML output for file %s\n",fd->name().data()); - generateXMLForFile(fd,t); + generateXMLForFile(fd.get(),t); } } GroupSDict::Iterator gli(*Doxygen::groupSDict); |