⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filedef.cpp

📁 doxygen(一个自动从源代码生成文档的工具)的源代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/****************************************************************************** * * $Id: filedef.cpp,v 1.55 2001/03/19 19:27:40 root Exp $ * * Copyright (C) 1997-2001 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 "qtbc.h"#include "memberlist.h"#include "classlist.h"#include "filedef.h"#include "doc.h"#include "doxygen.h"#include "memberdef.h"#include "classdef.h"#include "namespacedef.h"#include "util.h"#include "language.h"#include "outputlist.h"#include "dot.h"#include "message.h"#include "code.h"//#include "xml.h"/*! create a new file definition, where \a p is the file path,     \a the file name, and \a ref is an HTML anchor name if the    file was read from a tag file or 0 otherwise*/FileDef::FileDef(const char *p,const char *nm,const char *lref)   : Definition((QCString)p+nm,1,nm){  path=p;  filepath=path+nm;  filename=nm;  diskname=nm;  setReference(lref);  classSDict     = new ClassSDict(17);  includeList   = new QList<IncludeInfo>;  includeList->setAutoDelete(TRUE);  includeDict   = new QDict<IncludeInfo>(61);  includedByList = new QList<IncludeInfo>;  includedByList->setAutoDelete(TRUE);  includedByDict = new QDict<IncludeInfo>(61);  namespaceList = new NamespaceList;  namespaceDict = new NamespaceDict(7);  srcDefDict = 0;  srcMemberDict = 0;  usingDirList = 0;  usingDeclList = 0;  package = 0;  isSource = FALSE;   docname = nm;  if (Config_getBool("FULL_PATH_NAMES"))  {    docname.prepend(stripFromPath(path.copy()));  }  memberGroupList = new MemberGroupList;  memberGroupList->setAutoDelete(TRUE);  memberGroupDict = new MemberGroupDict(1009);}/*! destroy the file definition */FileDef::~FileDef(){  delete classSDict;  delete includeDict;  delete includeList;  delete namespaceList;  delete namespaceDict;  delete srcDefDict;  delete srcMemberDict;  delete usingDirList;  delete usingDeclList;  delete memberGroupList;  delete memberGroupDict;}/*! Compute the HTML anchor names for all members in the class */ void FileDef::computeAnchors(){  setAnchors('a',&allMemberList);}void FileDef::distributeMemberGroupDocumentation(){  MemberGroupListIterator mgli(*memberGroupList);  MemberGroup *mg;  for (;(mg=mgli.current());++mgli)  {    mg->distributeMemberGroupDocumentation();  }}/*! Write the documentation page for this file to the file of output    generators \a ol. */void FileDef::writeDocumentation(OutputList &ol){  //funcList->countDecMembers();    //QCString fn = name();  //if (Config_getBool("FULL_PATH_NAMES"))  //{  //  fn.prepend(stripFromPath(getPath().copy()));  //}  //printf("WriteDocumentation diskname=%s\n",diskname.data());    QCString pageTitle=name()+" File Reference";  startFile(ol,getOutputFileBase(),name(),pageTitle);  startTitle(ol,getOutputFileBase());  parseText(ol,theTranslator->trFileReference(docname));  endTitle(ol,getOutputFileBase(),docName());  //ol.newParagraph();    if (!Config_getString("GENERATE_TAGFILE").isEmpty())   {    Doxygen::tagFile << "  <compound kind=\"file\">" << endl;    Doxygen::tagFile << "    <name>" << convertToXML(name()) << "</name>" << endl;    Doxygen::tagFile << "    <path>" << convertToXML(getPath()) << "</path>" << endl;    Doxygen::tagFile << "    <filename>" << convertToXML(getOutputFileBase()) << ".html</filename>" << endl;  }    ol.startTextBlock();  //brief=brief.stripWhiteSpace();  //int bl=brief.length();  OutputList briefOutput(&ol);   if (briefDescription())   {    //if (brief.at(bl-1)!='.' && brief.at(bl-1)!='!' && brief.at(bl!='?'))     //  brief+='.';    parseDoc(briefOutput,filepath,1,0,0,briefDescription());    ol+=briefOutput;    ol.writeString(" \n");    ol.disableAllBut(OutputGenerator::Html);    ol.startTextLink(0,"_details");    parseText(ol,theTranslator->trMore());    ol.endTextLink();    ol.enableAll();    ol.disable(OutputGenerator::Man);    ol.newParagraph();    ol.enable(OutputGenerator::Man);  }  ol.writeSynopsis();   if (Config_getBool("SHOW_INCLUDE_FILES"))  {    ol.startTextBlock(TRUE);    QListIterator<IncludeInfo> ili(*includeList);    IncludeInfo *ii;    for (;(ii=ili.current());++ili)    {      FileDef *fd=ii->fileDef;      ol.startTypewriter();      ol.docify("#include ");      if (ii->local)        ol.docify("\"");      else        ol.docify("<");      ol.disable(OutputGenerator::Html);      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      if (fd && fd->isLinkable() && fd->generateSourceFile())      {        ol.writeObjectLink(fd->getReference(),fd->includeName(),0,ii->includeName);      }      else      {        ol.docify(ii->includeName);      }            ol.enableAll();      if (ii->local)        ol.docify("\"");      else        ol.docify(">");      ol.endTypewriter();      ol.disable(OutputGenerator::RTF);      ol.lineBreak();      ol.enableAll();      ol.disableAllBut(OutputGenerator::RTF);      ol.newParagraph();      ol.enableAll();    }    ol.endTextBlock();  }    if (Config_getBool("HAVE_DOT") && Config_getBool("INCLUDE_GRAPH"))  {    //printf("Graph for file %s\n",name().data());    DotInclDepGraph incDepGraph(this,FALSE);    if (!incDepGraph.isTrivial())    {      ol.disable(OutputGenerator::Man);      ol.newParagraph();      ol.startInclDepGraph();      parseText(ol,theTranslator->trInclDepGraph(name()));      ol.endInclDepGraph(incDepGraph);      ol.enableAll();    }    //incDepGraph.writeGraph(Config_getString("HTML_OUTPUT"),fd->getOutputFileBase());  }  if (Config_getBool("HAVE_DOT") && Config_getBool("INCLUDED_BY_GRAPH"))  {    //printf("Graph for file %s\n",name().data());    DotInclDepGraph incDepGraph(this,TRUE);    if (!incDepGraph.isTrivial())    {      ol.disable(OutputGenerator::Man);      ol.newParagraph();      ol.startInclDepGraph();      parseText(ol,theTranslator->trInclByDepGraph());      ol.endInclDepGraph(incDepGraph);      ol.enableAll();    }    //incDepGraph.writeGraph(Config_getString("HTML_OUTPUT"),fd->getOutputFileBase());  }  //printf("%s: generateSourceFile()=%d\n",name().data(),generateSourceFile());  if (generateSourceFile())  {    ol.disableAllBut(OutputGenerator::Html);    ol.newParagraph();    ol.startTextLink(includeName(),0);    parseText(ol,theTranslator->trGotoSourceCode());    ol.endTextLink();    ol.enableAll();  }    //ol.disableAllBut(OutputGenerator::Html);  //ol.writeString((QCString)"<p>Interface collaboration diagram for "  //               "<a href=\"usage_intf_graph_"+name()+".html\">here</a>");  //ol.writeString((QCString)"<p>Include dependency diagram for "+fn+" can be found "+  //               "<a href=\""+diskname+"_incldep.html\">here</a>.");  //ol.enableAll();  ol.endTextBlock();    ol.startMemberSections();  if (namespaceList->count()>0)  {    NamespaceDef *nd=namespaceList->first();    bool found=FALSE;    while (nd)    {      if (nd->name().find('@')==-1)      {        if (!found)        {          ol.startMemberHeader();          parseText(ol,theTranslator->trNamespaces());          ol.endMemberHeader();          ol.startMemberList();          found=TRUE;        }        ol.startMemberItem(0);        ol.writeString("namespace ");        ol.insertMemberAlign();        if (nd->isLinkable())         {          ol.writeObjectLink(nd->getReference(),              nd->getOutputFileBase(),              0,              nd->name()          );          if (!Config_getString("GENERATE_TAGFILE").isEmpty())           {            Doxygen::tagFile << "    <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl;          }        }        else        {          ol.startBold();          ol.docify(nd->name());          ol.endBold();        }        ol.endMemberItem(FALSE);      }      nd=namespaceList->next();    }    if (found) ol.endMemberList();  }  classSDict->writeDeclaration(ol);    /* write user defined member groups */  MemberGroupListIterator mgli(*memberGroupList);  MemberGroup *mg;  for (;(mg=mgli.current());++mgli)  {    if (mg->header()!="[NOHEADER]")    {      mg->writeDeclarations(ol,0,0,this,0);    }  }  //allMemberList.writeDeclarations(ol,0,0,this,0,0,0);  decDefineMembers.writeDeclarations(ol,0,0,this,0,theTranslator->trDefines(),0);  decProtoMembers.writeDeclarations(ol,0,0,this,0,theTranslator->trFuncProtos(),0);  decTypedefMembers.writeDeclarations(ol,0,0,this,0,theTranslator->trTypedefs(),0);  decEnumMembers.writeDeclarations(ol,0,0,this,0,theTranslator->trEnumerations(),0);  decFuncMembers.writeDeclarations(ol,0,0,this,0,theTranslator->trFunctions(),0);  decVarMembers.writeDeclarations(ol,0,0,this,0,theTranslator->trVariables(),0);  ol.endMemberSections();  //doc=doc.stripWhiteSpace();  //int bl=brief.length();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -