diff options
Diffstat (limited to 'src/filedef.cpp')
-rw-r--r-- | src/filedef.cpp | 424 |
1 files changed, 229 insertions, 195 deletions
diff --git a/src/filedef.cpp b/src/filedef.cpp index 82db047..784ebff 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -78,35 +78,32 @@ FileDef::FileDef(const char *p,const char *nm, const char *lref,const char *dn) : Definition((QCString)p+nm,1,1,nm) { - path=p; - filepath=path+nm; - filename=nm; - diskname=dn; - if (diskname.isEmpty()) diskname=nm; + m_path=p; + m_filePath=m_path+nm; + m_fileName=nm; + m_diskName=dn; + if (m_diskName.isEmpty()) m_diskName=nm; setReference(lref); - classSDict = 0; - includeList = 0; - includeDict = 0; - includedByList = 0; - includedByDict = 0; - namespaceSDict = 0; - srcDefDict = 0; - srcMemberDict = 0; - usingDirList = 0; - usingDeclList = 0; - package = 0; - isSource = FALSE; - docname = nm; - dir = 0; + m_classSDict = 0; + m_includeList = 0; + m_includeDict = 0; + m_includedByList = 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_docname = nm; + m_dir = 0; if (Config_getBool("FULL_PATH_NAMES")) { - docname.prepend(stripFromPath(path.copy())); + m_docname.prepend(stripFromPath(m_path.copy())); } - SrcLangExt lang = getLanguageFromFileName(name()); - setLanguage(lang); - //m_isJava = lang==SrcLangExt_Java; - //m_isCSharp = lang==SrcLangExt_CSharp; - memberGroupSDict = 0; + setLanguage(getLanguageFromFileName(name())); + m_memberGroupSDict = 0; acquireFileVersion(); m_subGrouping=Config_getBool("SUBGROUPING"); } @@ -114,17 +111,17 @@ FileDef::FileDef(const char *p,const char *nm, /*! destroy the file definition */ FileDef::~FileDef() { - delete classSDict; - delete includeDict; - delete includeList; - delete includedByDict; - delete includedByList; - delete namespaceSDict; - delete srcDefDict; - delete srcMemberDict; - delete usingDirList; - delete usingDeclList; - delete memberGroupSDict; + delete m_classSDict; + delete m_includeDict; + delete m_includeList; + delete m_includedByDict; + delete m_includedByList; + delete m_namespaceSDict; + delete m_srcDefDict; + delete m_srcMemberDict; + delete m_usingDirList; + delete m_usingDeclList; + delete m_memberGroupSDict; } /*! Compute the HTML anchor names for all members in the class */ @@ -137,9 +134,9 @@ void FileDef::computeAnchors() void FileDef::distributeMemberGroupDocumentation() { //printf("FileDef::distributeMemberGroupDocumentation()\n"); - if (memberGroupSDict) + if (m_memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -151,9 +148,9 @@ void FileDef::distributeMemberGroupDocumentation() void FileDef::findSectionsInDocumentation() { docFindSections(documentation(),this,0,docFile()); - if (memberGroupSDict) + if (m_memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -194,7 +191,7 @@ void FileDef::writeDetailedDescription(OutputList &ol,const QCString &title) ol.startTextBlock(); if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) { - ol.parseDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE); + ol.generateDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE); } if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF") && !documentation().isEmpty()) @@ -210,7 +207,7 @@ void FileDef::writeDetailedDescription(OutputList &ol,const QCString &title) } if (!documentation().isEmpty()) { - ol.parseDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE); + 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")) @@ -236,41 +233,41 @@ void FileDef::writeBriefDescription(OutputList &ol) { if (!briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC")) { - ol.startParagraph(); - ol.parseDoc(briefFile(),briefLine(),this,0, - briefDescription(),TRUE,FALSE,0,TRUE,FALSE); - ol.pushGeneratorState(); - ol.disable(OutputGenerator::RTF); - ol.writeString(" \n"); - ol.enable(OutputGenerator::RTF); + DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(),this,0, + briefDescription(),TRUE,FALSE,0,TRUE,FALSE); - if (Config_getBool("REPEAT_BRIEF") || - !documentation().isEmpty() - ) + if (rootNode && !rootNode->isEmpty()) { - ol.disableAllBut(OutputGenerator::Html); - ol.startTextLink(0,"details"); - ol.parseText(theTranslator->trMore()); - ol.endTextLink(); - } - ol.popGeneratorState(); - ol.endParagraph(); + ol.startParagraph(); + ol.writeDoc(rootNode,this,0); + ol.pushGeneratorState(); + ol.disable(OutputGenerator::RTF); + ol.writeString(" \n"); + ol.enable(OutputGenerator::RTF); - //ol.pushGeneratorState(); - //ol.disable(OutputGenerator::RTF); - //ol.newParagraph(); - //ol.popGeneratorState(); + if (Config_getBool("REPEAT_BRIEF") || + !documentation().isEmpty() + ) + { + ol.disableAllBut(OutputGenerator::Html); + ol.startTextLink(0,"details"); + ol.parseText(theTranslator->trMore()); + ol.endTextLink(); + } + ol.popGeneratorState(); + ol.endParagraph(); + } + delete rootNode; } ol.writeSynopsis(); } void FileDef::writeIncludeFiles(OutputList &ol) { - if (/*Config_getBool("SHOW_INCLUDE_FILES") &&*/ includeList && - includeList->count()>0) + if (m_includeList && m_includeList->count()>0) { ol.startTextBlock(TRUE); - QListIterator<IncludeInfo> ili(*includeList); + QListIterator<IncludeInfo> ili(*m_includeList); IncludeInfo *ii; for (;(ii=ili.current());++ili) { @@ -355,7 +352,7 @@ void FileDef::writeIncludeGraph(OutputList &ol) DotInclDepGraph incDepGraph(this,FALSE); if (incDepGraph.isTooBig()) { - err("warning: Include graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data()); + warn_uncond("Include graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data()); } else if (!incDepGraph.isTrivial()) { @@ -379,7 +376,7 @@ void FileDef::writeIncludedByGraph(OutputList &ol) DotInclDepGraph incDepGraph(this,TRUE); if (incDepGraph.isTooBig()) { - err("warning: Included by graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data()); + warn_uncond("Included by graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",name().data()); } if (!incDepGraph.isTrivial()) { @@ -415,18 +412,18 @@ void FileDef::writeNamespaceDeclarations(OutputList &ol,const QCString &title, bool const isConstantGroup) { // write list of namespaces - if (namespaceSDict) namespaceSDict->writeDeclaration(ol,title,isConstantGroup); + if (m_namespaceSDict) m_namespaceSDict->writeDeclaration(ol,title,isConstantGroup); } void FileDef::writeClassDeclarations(OutputList &ol,const QCString &title) { // write list of classes - if (classSDict) classSDict->writeDeclaration(ol,0,title,FALSE); + if (m_classSDict) m_classSDict->writeDeclaration(ol,0,title,FALSE); } void FileDef::writeInlineClasses(OutputList &ol) { - if (classSDict) classSDict->writeDocumentation(ol,this); + if (m_classSDict) m_classSDict->writeDocumentation(ol,this); } void FileDef::startMemberDeclarations(OutputList &ol) @@ -460,10 +457,10 @@ void FileDef::endMemberDocumentation(OutputList &ol) void FileDef::writeMemberGroups(OutputList &ol) { /* write user defined member groups */ - if (memberGroupSDict) + if (m_memberGroupSDict) { - memberGroupSDict->sort(); - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + m_memberGroupSDict->sort(); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -499,8 +496,10 @@ void FileDef::writeSummaryLinks(OutputList &ol) SrcLangExt lang=getLanguage(); for (eli.toFirst();(lde=eli.current());++eli) { - if ((lde->kind()==LayoutDocEntry::FileClasses && classSDict && classSDict->declVisible()) || - (lde->kind()==LayoutDocEntry::FileNamespaces && namespaceSDict && namespaceSDict->declVisible()) + if ((lde->kind()==LayoutDocEntry::FileClasses && + m_classSDict && m_classSDict->declVisible()) || + (lde->kind()==LayoutDocEntry::FileNamespaces && + m_namespaceSDict && m_namespaceSDict->declVisible()) ) { LayoutDocEntrySection *ls = (LayoutDocEntrySection*)lde; @@ -543,12 +542,12 @@ void FileDef::writeDocumentation(OutputList &ol) //printf("WriteDocumentation diskname=%s\n",diskname.data()); QCString versionTitle; - if (!fileVersion.isEmpty()) + if (!m_fileVersion.isEmpty()) { - versionTitle=("("+fileVersion+")"); + versionTitle=("("+m_fileVersion+")"); } - QCString title = docname+versionTitle; - QCString pageTitle=theTranslator->trFileReference(docname); + QCString title = m_docname+versionTitle; + QCString pageTitle=theTranslator->trFileReference(m_docname); if (getDirDef()) { @@ -585,7 +584,7 @@ void FileDef::writeDocumentation(OutputList &ol) ol.startContents(); - if (!fileVersion.isEmpty()) + if (!m_fileVersion.isEmpty()) { ol.disableAllBut(OutputGenerator::Html); ol.startProjectNumber(); @@ -802,15 +801,15 @@ void FileDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const } /*! Write a source listing of this file to the output */ -void FileDef::writeSource(OutputList &ol) +void FileDef::writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu) { static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); static bool filterSourceFiles = Config_getBool("FILTER_SOURCE_FILES"); static bool latexSourceCode = Config_getBool("LATEX_SOURCE_CODE"); - QCString title = docname; - if (!fileVersion.isEmpty()) + QCString title = m_docname; + if (!m_fileVersion.isEmpty()) { - title+=(" ("+fileVersion+")"); + title+=(" ("+m_fileVersion+")"); } QCString pageTitle = theTranslator->trSourceFile(title); ol.disable(OutputGenerator::Man); @@ -853,15 +852,23 @@ void FileDef::writeSource(OutputList &ol) if (latexSourceCode) ol.enable(OutputGenerator::Latex); } + (void)sameTu; + (void)filesInSameTu; #if USE_LIBCLANG static bool clangAssistedParsing = Config_getBool("CLANG_ASSISTED_PARSING"); if (clangAssistedParsing && (getLanguage()==SrcLangExt_Cpp || getLanguage()==SrcLangExt_ObjC)) { ol.startCodeFragment(); - ClangParser::instance()->start(absFilePath()); + if (!sameTu) + { + ClangParser::instance()->start(absFilePath(),filesInSameTu); + } + else + { + ClangParser::instance()->switchToFile(absFilePath()); + } ClangParser::instance()->writeSources(ol,this); - ClangParser::instance()->finish(); ol.endCodeFragment(); } else @@ -881,17 +888,47 @@ void FileDef::writeSource(OutputList &ol) ol.enableAll(); } -void FileDef::parseSource() +void FileDef::parseSource(bool sameTu,QStrList &filesInSameTu) { static bool filterSourceFiles = Config_getBool("FILTER_SOURCE_FILES"); DevNullCodeDocInterface devNullIntf; - ParserInterface *pIntf = Doxygen::parserManager->getParser(getDefFileExtension()); - pIntf->resetCodeParserState(); - pIntf->parseCode( + (void)sameTu; + (void)filesInSameTu; +#if USE_LIBCLANG + static bool clangAssistedParsing = Config_getBool("CLANG_ASSISTED_PARSING"); + if (clangAssistedParsing && + (getLanguage()==SrcLangExt_Cpp || getLanguage()==SrcLangExt_ObjC)) + { + if (!sameTu) + { + ClangParser::instance()->start(absFilePath(),filesInSameTu); + } + else + { + ClangParser::instance()->switchToFile(absFilePath()); + } + ClangParser::instance()->writeSources(devNullIntf,this); + } + else +#endif + { + ParserInterface *pIntf = Doxygen::parserManager->getParser(getDefFileExtension()); + pIntf->resetCodeParserState(); + pIntf->parseCode( devNullIntf,0, fileToString(absFilePath(),filterSourceFiles,TRUE), FALSE,0,this ); + } +} + +void FileDef::startParsing() +{ +} + +void FileDef::finishParsing() +{ + ClangParser::instance()->finish(); } void FileDef::addMembersToMemberGroup() @@ -902,14 +939,14 @@ void FileDef::addMembersToMemberGroup() { if (ml->listType()&MemberListType_declarationLists) { - ::addMembersToMemberGroup(ml,&memberGroupSDict,this); + ::addMembersToMemberGroup(ml,&m_memberGroupSDict,this); } } // add members inside sections to their groups - if (memberGroupSDict) + if (m_memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -980,14 +1017,18 @@ void FileDef::insertMember(MemberDef *md) void FileDef::insertClass(ClassDef *cd) { if (cd->isHidden()) return; - if (classSDict==0) + if (m_classSDict==0) { - classSDict = new ClassSDict(17); + m_classSDict = new ClassSDict(17); } if (Config_getBool("SORT_BRIEF_DOCS")) - classSDict->inSort(cd->name(),cd); + { + m_classSDict->inSort(cd->name(),cd); + } else - classSDict->append(cd->name(),cd); + { + m_classSDict->append(cd->name(),cd); + } } /*! Adds namespace definition \a nd to the list of all compounds of this file */ @@ -995,23 +1036,27 @@ void FileDef::insertNamespace(NamespaceDef *nd) { if (nd->isHidden()) return; if (!nd->name().isEmpty() && - (namespaceSDict==0 || namespaceSDict->find(nd->name())==0)) + (m_namespaceSDict==0 || m_namespaceSDict->find(nd->name())==0)) { - if (namespaceSDict==0) + if (m_namespaceSDict==0) { - namespaceSDict = new NamespaceSDict; + m_namespaceSDict = new NamespaceSDict; } if (Config_getBool("SORT_BRIEF_DOCS")) - namespaceSDict->inSort(nd->name(),nd); + { + m_namespaceSDict->inSort(nd->name(),nd); + } else - namespaceSDict->append(nd->name(),nd); + { + m_namespaceSDict->append(nd->name(),nd); + } } } QCString FileDef::name() const { if (Config_getBool("FULL_PATH_NAMES")) - return filename; + return m_fileName; else return Definition::name(); } @@ -1021,45 +1066,47 @@ void FileDef::addSourceRef(int line,Definition *d,MemberDef *md) //printf("FileDef::addSourceDef(%d,%p,%p)\n",line,d,md); if (d) { - if (srcDefDict==0) srcDefDict = new QIntDict<Definition>(257); - if (srcMemberDict==0) srcMemberDict = new QIntDict<MemberDef>(257); - srcDefDict->insert(line,d); - if (md) srcMemberDict->insert(line,md); + if (m_srcDefDict==0) m_srcDefDict = new QIntDict<Definition>(257); + if (m_srcMemberDict==0) m_srcMemberDict = new QIntDict<MemberDef>(257); + m_srcDefDict->insert(line,d); + if (md) m_srcMemberDict->insert(line,md); //printf("Adding member %s with anchor %s at line %d to file %s\n", // md?md->name().data():"<none>",md?md->anchor().data():"<none>",line,name().data()); } } -Definition *FileDef::getSourceDefinition(int lineNr) +Definition *FileDef::getSourceDefinition(int lineNr) const { Definition *result=0; - if (srcDefDict) + if (m_srcDefDict) { - result = srcDefDict->find(lineNr); + result = m_srcDefDict->find(lineNr); } + //printf("%s::getSourceDefinition(%d)=%s\n",name().data(),lineNr,result?result->name().data():"none"); return result; } -MemberDef *FileDef::getSourceMember(int lineNr) +MemberDef *FileDef::getSourceMember(int lineNr) const { MemberDef *result=0; - if (srcMemberDict) + if (m_srcMemberDict) { - result = srcMemberDict->find(lineNr); + result = m_srcMemberDict->find(lineNr); } + //printf("%s::getSourceMember(%d)=%s\n",name().data(),lineNr,result?result->name().data():"none"); return result; } void FileDef::addUsingDirective(NamespaceDef *nd) { - if (usingDirList==0) + if (m_usingDirList==0) { - usingDirList = new NamespaceSDict; + m_usingDirList = new NamespaceSDict; } - if (usingDirList->find(nd->qualifiedName())==0) + if (m_usingDirList->find(nd->qualifiedName())==0) { - usingDirList->append(nd->qualifiedName(),nd); + m_usingDirList->append(nd->qualifiedName(),nd); } //printf("%p: FileDef::addUsingDirective: %s:%d\n",this,name().data(),usingDirList->count()); } @@ -1067,18 +1114,18 @@ void FileDef::addUsingDirective(NamespaceDef *nd) NamespaceSDict *FileDef::getUsedNamespaces() const { //printf("%p: FileDef::getUsedNamespace: %s:%d\n",this,name().data(),usingDirList?usingDirList->count():0); - return usingDirList; + return m_usingDirList; } void FileDef::addUsingDeclaration(Definition *d) { - if (usingDeclList==0) + if (m_usingDeclList==0) { - usingDeclList = new SDict<Definition>(17); + m_usingDeclList = new SDict<Definition>(17); } - if (usingDeclList->find(d->qualifiedName())==0) + if (m_usingDeclList->find(d->qualifiedName())==0) { - usingDeclList->append(d->qualifiedName(),d); + m_usingDeclList->append(d->qualifiedName(),d); } } @@ -1087,13 +1134,13 @@ void FileDef::addIncludeDependency(FileDef *fd,const char *incName,bool local, { //printf("FileDef::addIncludeDependency(%p,%s,%d)\n",fd,incName,local); QCString iName = fd ? fd->absFilePath().data() : incName; - if (!iName.isEmpty() && (!includeDict || includeDict->find(iName)==0)) + if (!iName.isEmpty() && (!m_includeDict || m_includeDict->find(iName)==0)) { - if (includeDict==0) + if (m_includeDict==0) { - includeDict = new QDict<IncludeInfo>(61); - includeList = new QList<IncludeInfo>; - includeList->setAutoDelete(TRUE); + m_includeDict = new QDict<IncludeInfo>(61); + m_includeList = new QList<IncludeInfo>; + m_includeList->setAutoDelete(TRUE); } IncludeInfo *ii = new IncludeInfo; ii->fileDef = fd; @@ -1101,8 +1148,8 @@ void FileDef::addIncludeDependency(FileDef *fd,const char *incName,bool local, ii->local = local; ii->imported = imported; ii->indirect = indirect; - includeList->append(ii); - includeDict->insert(iName,ii); + m_includeList->append(ii); + m_includeDict->insert(iName,ii); } } @@ -1113,10 +1160,10 @@ void FileDef::addIncludedUsingDirectives() //printf("( FileDef::addIncludedUsingDirectives for file %s\n",name().data()); NamespaceList nl; - if (includeList) // file contains #includes + if (m_includeList) // file contains #includes { { - QListIterator<IncludeInfo> iii(*includeList); + QListIterator<IncludeInfo> iii(*m_includeList); IncludeInfo *ii; for (iii.toFirst();(ii=iii.current());++iii) // foreach #include... { @@ -1128,7 +1175,7 @@ void FileDef::addIncludedUsingDirectives() } } { - QListIterator<IncludeInfo> iii(*includeList); + QListIterator<IncludeInfo> iii(*m_includeList); IncludeInfo *ii; // iterate through list from last to first for (iii.toLast();(ii=iii.current());--iii) @@ -1136,7 +1183,7 @@ void FileDef::addIncludedUsingDirectives() if (ii->fileDef && ii->fileDef!=this) { // add using directives - NamespaceSDict *unl = ii->fileDef->usingDirList; + NamespaceSDict *unl = ii->fileDef->m_usingDirList; if (unl) { NamespaceSDict::Iterator nli(*unl); @@ -1144,17 +1191,17 @@ void FileDef::addIncludedUsingDirectives() for (nli.toLast();(nd=nli.current());--nli) { // append each using directive found in a #include file - if (usingDirList==0) usingDirList = new NamespaceSDict; + if (m_usingDirList==0) m_usingDirList = new NamespaceSDict; //printf("Prepending used namespace %s to the list of file %s\n", // nd->name().data(),name().data()); - if (usingDirList->find(nd->qualifiedName())==0) // not yet added + if (m_usingDirList->find(nd->qualifiedName())==0) // not yet added { - usingDirList->prepend(nd->qualifiedName(),nd); + m_usingDirList->prepend(nd->qualifiedName(),nd); } } } // add using declarations - SDict<Definition> *udl = ii->fileDef->usingDeclList; + SDict<Definition> *udl = ii->fileDef->m_usingDeclList; if (udl) { SDict<Definition>::Iterator udi(*udl); @@ -1162,13 +1209,13 @@ void FileDef::addIncludedUsingDirectives() for (udi.toLast();(d=udi.current());--udi) { //printf("Adding using declaration %s\n",d->name().data()); - if (usingDeclList==0) + if (m_usingDeclList==0) { - usingDeclList = new SDict<Definition>(17); + m_usingDeclList = new SDict<Definition>(17); } - if (usingDeclList->find(d->qualifiedName())==0) + if (m_usingDeclList->find(d->qualifiedName())==0) { - usingDeclList->prepend(d->qualifiedName(),d); + m_usingDeclList->prepend(d->qualifiedName(),d); } } } @@ -1185,13 +1232,13 @@ void FileDef::addIncludedByDependency(FileDef *fd,const char *incName, { //printf("FileDef::addIncludedByDependency(%p,%s,%d)\n",fd,incName,local); QCString iName = fd ? fd->absFilePath().data() : incName; - if (!iName.isEmpty() && (includedByDict==0 || includedByDict->find(iName)==0)) + if (!iName.isEmpty() && (m_includedByDict==0 || m_includedByDict->find(iName)==0)) { - if (includedByDict==0) + if (m_includedByDict==0) { - includedByDict = new QDict<IncludeInfo>(61); - includedByList = new QList<IncludeInfo>; - includedByList->setAutoDelete(TRUE); + m_includedByDict = new QDict<IncludeInfo>(61); + m_includedByList = new QList<IncludeInfo>; + m_includedByList->setAutoDelete(TRUE); } IncludeInfo *ii = new IncludeInfo; ii->fileDef = fd; @@ -1199,15 +1246,15 @@ void FileDef::addIncludedByDependency(FileDef *fd,const char *incName, ii->local = local; ii->imported = imported; ii->indirect = FALSE; - includedByList->append(ii); - includedByDict->insert(iName,ii); + m_includedByList->append(ii); + m_includedByDict->insert(iName,ii); } } bool FileDef::isIncluded(const QCString &name) const { if (name.isEmpty()) return FALSE; - return includeDict!=0 && includeDict->find(name)!=0; + return m_includeDict!=0 && m_includeDict->find(name)!=0; } bool FileDef::generateSourceFile() const @@ -1227,17 +1274,17 @@ bool FileDef::generateSourceFile() const void FileDef::addListReferences() { { - LockingPtr< QList<ListItemInfo> > xrefItems = xrefListItems(); - addRefItem(xrefItems.pointer(), + QList<ListItemInfo> *xrefItems = xrefListItems(); + addRefItem(xrefItems, getOutputFileBase(), theTranslator->trFile(TRUE,TRUE), getOutputFileBase(),name(), 0 ); } - if (memberGroupSDict) + if (m_memberGroupSDict) { - MemberGroupSDict::Iterator mgli(*memberGroupSDict); + MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { @@ -1506,9 +1553,9 @@ void FileDef::combineUsingRelations() { if (visited) return; // already done visited=TRUE; - if (usingDirList) + if (m_usingDirList) { - NamespaceSDict::Iterator nli(*usingDirList); + NamespaceSDict::Iterator nli(*m_usingDirList); NamespaceDef *nd; for (nli.toFirst();(nd=nli.current());++nli) { @@ -1554,24 +1601,24 @@ bool FileDef::isDocumentationFile() const void FileDef::acquireFileVersion() { QCString vercmd = Config_getString("FILE_VERSION_FILTER"); - if (!vercmd.isEmpty() && !filepath.isEmpty() && filepath!="generated") + if (!vercmd.isEmpty() && !m_filePath.isEmpty() && m_filePath!="generated") { - msg("Version of %s : ",filepath.data()); - QCString cmd = vercmd+" \""+filepath+"\""; + msg("Version of %s : ",m_filePath.data()); + QCString cmd = vercmd+" \""+m_filePath+"\""; Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",cmd.data()); FILE *f=portable_popen(cmd,"r"); if (!f) { - err("error: could not execute %s\n",vercmd.data()); + err("could not execute %s\n",vercmd.data()); return; } const int bufSize=1024; char buf[bufSize]; int numRead = (int)fread(buf,1,bufSize,f); portable_pclose(f); - if (numRead>0 && !(fileVersion=QCString(buf,numRead).stripWhiteSpace()).isEmpty()) + if (numRead>0 && !(m_fileVersion=QCString(buf,numRead).stripWhiteSpace()).isEmpty()) { - msg("%s\n",fileVersion.data()); + msg("%s\n",m_fileVersion.data()); } else { @@ -1585,11 +1632,11 @@ QCString FileDef::getSourceFileBase() const { if (Htags::useHtags) { - return Htags::path2URL(filepath); + return Htags::path2URL(m_filePath); } else { - return convertNameToFile(diskname)+"_source"; + return convertNameToFile(m_diskName)+"_source"; } } @@ -1598,11 +1645,11 @@ QCString FileDef::includeName() const { if (Htags::useHtags) { - return Htags::path2URL(filepath); + return Htags::path2URL(m_filePath); } else { - return convertNameToFile(diskname)+"_source"; + return convertNameToFile(m_diskName)+"_source"; } } @@ -1701,42 +1748,29 @@ bool FileDef::isLinkableInProject() const return hasDocumentation() && !isReference() && showFiles; } -#if 0 -bool FileDef::includes(FileDef *incFile,QDict<FileDef> *includedFiles) const +static void getAllIncludeFilesRecursively( + QDict<void> *filesVisited,const FileDef *fd,QStrList &incFiles) { - //printf("%s::includes(%s)\n",name().data(),incFile->name().data()); - if (incFile==this) return TRUE; - includedFiles->insert(absFilePath(),this); - if (includeList) + if (fd->includeFileList()) { - QListIterator<IncludeInfo> ili(*includeList); + QListIterator<IncludeInfo> iii(*fd->includeFileList()); IncludeInfo *ii; - for (;(ii=ili.current());++ili) + for (iii.toFirst();(ii=iii.current());++iii) { - //printf("ii=%s\n",ii->includeName.data()); - if ((ii->fileDef && - includedFiles->find(ii->fileDef->absFilePath())==0 && - ii->fileDef->includes(incFile,includedFiles) - ) || - incFile->absFilePath()==ii->includeName - ) return TRUE; + if (ii->fileDef && !ii->fileDef->isReference() && + !filesVisited->find(ii->fileDef->absFilePath())) + { + //printf("FileDef::addIncludeDependency(%s)\n",ii->fileDef->absFilePath().data()); + incFiles.append(ii->fileDef->absFilePath()); + filesVisited->insert(ii->fileDef->absFilePath(),(void*)0x8); + getAllIncludeFilesRecursively(filesVisited,ii->fileDef,incFiles); + } } } - return FALSE; } -bool FileDef::includesByName(const QCString &fileName) const +void FileDef::getAllIncludeFilesRecursively(QStrList &incFiles) const { - if (includeList) - { - QListIterator<IncludeInfo> ili(*includeList); - IncludeInfo *ii; - for (;(ii=ili.current());++ili) - { - //printf("ii=%s\n",ii->includeName.data()); - if (fileName==ii->includeName) return TRUE; - } - } - return FALSE; + QDict<void> includes(257); + ::getAllIncludeFilesRecursively(&includes,this,incFiles); } -#endif |