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

📄 index.cpp

📁 doxygen(一个自动从源代码生成文档的工具)的源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
      //printf("Found filedef %s\n",fd->name().data());      bool doc = fd->isLinkableInProject();      bool src = fd->generateSourceFile();      bool nameOk = fd->name().right(4)!=".doc" &&                     fd->name().right(4)!=".txt";      if (nameOk && (doc || src) &&               !fd->isReference())      {        QCString path;        if (Config_getBool("FULL_PATH_NAMES"))         {          path=stripFromPath(fd->getPath().copy());        }        QCString fullName=fd->name();        if (!path.isEmpty()) fullName.prepend(path+"/");        // --------------- LaTeX/RTF only -------------------------#if 0        if (doc)        {          ol.pushGeneratorState();          ol.disable(OutputGenerator::Html);          ol.writeStartAnnoItem("file",              fd->getOutputFileBase(),              path,              fd->name()                               );          if (!fd->briefDescription().isEmpty())          {            ol.docify(" (");            parseDoc(ol,fd->absFilePath(),1,                0,0,                abbreviate(fd->briefDescription(),fd->name()));            ol.docify(")");          }          ol.writeEndAnnoItem(fd->getOutputFileBase());          ol.popGeneratorState();        }#endif        // --------------------------------------------------------        // ----------------- HTML only ----------------------------        //ol.pushGeneratorState();        //ol.disableAllBut(OutputGenerator::Html);        //ol.writeListItem();        ol.startIndexKey();        ol.docify(path);        if (doc)        {          ol.writeObjectLink(0,fd->getOutputFileBase(),0,fd->name());          if (hasHtmlHelp)          {            htmlHelp->addContentsItem(FALSE,fullName,fd->getOutputFileBase());          }          if (hasFtvHelp)          {            ftvHelp->addContentsItem(FALSE,fd->getReference(),fd->getOutputFileBase(),0,fullName);          }        }        else        {          ol.startBold();          ol.docify(fd->name());          ol.endBold();          if (hasHtmlHelp)          {            htmlHelp->addContentsItem(FALSE,fd->name(),0);          }          if (hasFtvHelp)          {            ftvHelp->addContentsItem(FALSE,0,0,0,fd->name());          }        }        if (src)        {          ol.pushGeneratorState();          ol.disableAllBut(OutputGenerator::Html);          ol.docify(" ");          ol.startTextLink(fd->includeName(),0);          ol.docify("[");          parseText(ol,theTranslator->trCode());          ol.docify("]");          ol.endTextLink();          ol.popGeneratorState();        }        ol.endIndexKey();        bool hasBrief = !fd->briefDescription().isEmpty();        ol.startIndexValue(hasBrief);        if (hasBrief)        {          //ol.docify(" (");          parseDoc(ol,              fd->absFilePath(),1,              0,0,              abbreviate(fd->briefDescription(),fd->name()));          //ol.docify(")");        }        ol.endIndexValue(fd->getOutputFileBase(),hasBrief);        //ol.popGeneratorState();        // --------------------------------------------------------      }      fd=fl->next();    }    if (Config_getBool("FULL_PATH_NAMES"))    {      fl=outputNameList.next();    }    else    {      fl=Doxygen::inputNameList.next();    }  }  ol.endIndexList();  if (hasHtmlHelp)  {    htmlHelp->decContentsDepth();  }  if (hasFtvHelp)  {    ftvHelp->decContentsDepth();  }  endFile(ol);  ol.popGeneratorState();}//----------------------------------------------------------------------------int countNamespaces(){  int count=0;  NamespaceSDict::Iterator nli(Doxygen::namespaceSDict);  NamespaceDef *nd;  for (;(nd=nli.current());++nli)  {    if (nd->isLinkableInProject()) count++;  }  return count;}//----------------------------------------------------------------------------void writeNamespaceIndex(OutputList &ol){  if (documentedNamespaces==0) return;  ol.pushGeneratorState();  ol.disable(OutputGenerator::Man);  startFile(ol,"namespaces",0,"Namespace Index");  startTitle(ol,0);  QCString title = theTranslator->trNamespaceList();  QCString htmlHelpTitle = title;  QCString ftvHelpTitle  = title;  if (!Config_getString("PROJECT_NAME").isEmpty()) title.prepend(Config_getString("PROJECT_NAME")+" ");  parseText(ol,title);  endTitle(ol,0,0);  ol.startTextBlock();  HtmlHelp *htmlHelp = 0;  FTVHelp  *ftvHelp  = 0;  bool &generateHtml = Config_getBool("GENERATE_HTML") ;  bool hasHtmlHelp = generateHtml && Config_getBool("GENERATE_HTMLHELP");  bool hasFtvHelp =  generateHtml && Config_getBool("GENERATE_TREEVIEW");  if (hasHtmlHelp)  {    htmlHelp = HtmlHelp::getInstance();    htmlHelp->addContentsItem(TRUE,htmlHelpTitle,"namespaces");     htmlHelp->incContentsDepth();  }  if (hasFtvHelp)  {    ftvHelp = FTVHelp::getInstance();    ftvHelp->addContentsItem(TRUE,0,"namespaces",0,ftvHelpTitle);     ftvHelp->incContentsDepth();  }  //ol.newParagraph();  parseText(ol,theTranslator->trNamespaceListDescription(Config_getBool("EXTRACT_ALL")));  //ol.newParagraph();  ol.endTextBlock();  bool first=TRUE;  NamespaceSDict::Iterator nli(Doxygen::namespaceSDict);  NamespaceDef *nd;  for (nli.toFirst();(nd=nli.current());++nli)  {    if (nd->isLinkableInProject())    {      if (first)      {        ol.startIndexList();        first=FALSE;      }      //ol.writeStartAnnoItem("namespace",nd->getOutputFileBase(),0,nd->name());      ol.startIndexKey();      ol.writeObjectLink(0,nd->getOutputFileBase(),0,nd->name());      ol.endIndexKey();      bool hasBrief = !nd->briefDescription().isEmpty();      ol.startIndexValue(hasBrief);      if (hasBrief)      {        //ol.docify(" (");        parseDoc(ol,                 nd->getDefFileName(),nd->getDefLine(),                 nd->name(),0,                 abbreviate(nd->briefDescription(),nd->name()));        //ol.docify(")");      }      ol.endIndexValue(nd->getOutputFileBase(),hasBrief);      //ol.writeEndAnnoItem(nd->getOutputFileBase());      if (hasHtmlHelp)      {        htmlHelp->addContentsItem(FALSE,nd->name(),nd->getOutputFileBase());      }      if (hasFtvHelp)      {        ftvHelp->addContentsItem(FALSE,nd->getReference(),nd->getOutputFileBase(),0,nd->name());      }    }  }  if (!first) ol.endIndexList();  if (hasHtmlHelp)  {    htmlHelp->decContentsDepth();  }  if (hasFtvHelp)  {    ftvHelp->decContentsDepth();  }  endFile(ol);  ol.popGeneratorState();}//----------------------------------------------------------------------------int countAnnotatedClasses(){  int count=0;  //ClassDef *cd=Doxygen::classList.first();  ClassSDict::Iterator cli(Doxygen::classSDict);  ClassDef *cd;  for (;(cd=cli.current());++cli)  {    if (cd->isLinkableInProject() && cd->templateMaster()==0)     {       //printf("Annotated class %s\n",cd->name().data());       count++;     }  }  return count;}//----------------------------------------------------------------------void writeAnnotatedClassList(OutputList &ol){  bool &generateHtml = Config_getBool("GENERATE_HTML") ;  bool hasHtmlHelp = generateHtml && Config_getBool("GENERATE_HTMLHELP");  bool hasFtvHelp =  generateHtml && Config_getBool("GENERATE_TREEVIEW");  ol.startIndexList();   //ClassDef *cd=Doxygen::classList.first();  //while (cd)  ClassSDict::Iterator cli(Doxygen::classSDict);  ClassDef *cd;  for (;(cd=cli.current());++cli)  {    if (cd->isLinkableInProject() && cd->templateMaster()==0)    {      QCString type=cd->compoundTypeString();      //ol.writeStartAnnoItem(type,cd->getOutputFileBase(),0,cd->displayName());      ol.startIndexKey();      ol.writeObjectLink(0,cd->getOutputFileBase(),0,cd->displayName());      ol.endIndexKey();      bool hasBrief = !cd->briefDescription().isEmpty();      ol.startIndexValue(hasBrief);      if (hasBrief)      {        //ol.docify(" (");        parseDoc(ol,                 cd->getDefFileName(),cd->getDefLine(),                 cd->name(),0,                 abbreviate(cd->briefDescription(),cd->name()));        //ol.docify(")");      }      ol.endIndexValue(cd->getOutputFileBase(),hasBrief);      //ol.writeEndAnnoItem(cd->getOutputFileBase());      if (hasHtmlHelp)      {        HtmlHelp::getInstance()->addContentsItem(FALSE,cd->name(),cd->getOutputFileBase());      }      if (hasFtvHelp)      {        FTVHelp::getInstance()->addContentsItem(FALSE,cd->getReference(),cd->getOutputFileBase(),0,cd->name());      }    }  }  ol.endIndexList();}//----------------------------------------------------------------------------void writePackageList(OutputList &ol){  bool &generateHtml = Config_getBool("GENERATE_HTML") ;  bool hasHtmlHelp = generateHtml && Config_getBool("GENERATE_HTMLHELP");  bool hasFtvHelp =  generateHtml && Config_getBool("GENERATE_TREEVIEW");  ol.startIndexList();   PackageSDict::Iterator pdi(Doxygen::packageDict);  PackageDef *pd;  for (;(pd=pdi.current());++pdi)  {    if (!pd->isReference())    {      //ol.writeStartAnnoItem("package",pd->getOutputFileBase(),0,pd->name());      ol.startIndexKey();      ol.writeObjectLink(0,pd->getOutputFileBase(),0,pd->name());      ol.endIndexKey();      bool hasBrief = !pd->briefDescription().isEmpty();      ol.startIndexValue(hasBrief);      if (hasBrief)      {        //ol.docify(" (");        parseDoc(ol,            pd->getDefFileName(),pd->getDefLine(),            pd->name(),0,            abbreviate(pd->briefDescription(),pd->name()));        //ol.docify(")");      }      ol.endIndexValue(pd->getOutputFileBase(),hasBrief);            //ol.writeEndAnnoItem(pd->getOutputFileBase());      if (hasHtmlHelp)      {        HtmlHelp::getInstance()->addContentsItem(FALSE,pd->name(),pd->getOutputFileBase());      }      if (hasFtvHelp)      {        FTVHelp::getInstance()->addContentsItem(FALSE,pd->getReference(),pd->getOutputFileBase(),0,pd->name());      }    }  }  ol.endIndexList();}//----------------------------------------------------------------------------// write an alphabetical index of all class with a header for each lettervoid writeAlphabeticalClassList(OutputList &ol){  ol.startAlphabeticalIndexList();   // first count the number of headers  ClassSDict::Iterator cli(Doxygen::classSDict);  ClassDef *cd;  char startLetter=0;  int headerItems=0;  for (;(cd=cli.current());++cli)  {    if (cd->isLinkableInProject() && cd->templateMaster()==0)    {      int index = getPrefixIndex(cd->className());      if (toupper(cd->className().at(index))!=startLetter) // new begin letter => new header      {        startLetter=toupper(cd->className().at(index));        headerItems++;      }    }  }  // the number of columns in the table  const int columns = Config_getInt("COLS_IN_ALPHA_INDEX");  int i,j;  int totalItems = headerItems + annotatedClasses;            // number of items in the table  int rows = (totalItems + columns - 1)/columns;              // number of rows in the table  int itemsInLastRow = (totalItems + columns -1)%columns + 1; // number of items in the last row  //printf("headerItems=%d totalItems=%d columns=%d rows=%d itemsInLastRow=%d\n",  //    headerItems,totalItems,columns,rows,itemsInLastRow);  // create one class list for each column   ClassList *colList = new ClassList[columns];  // fill the columns with the class list (row elements in each column,  // expect for the columns with number >= itemsInLastRow, which get on  // item less.  int col=0,row=0;  //int icount=0;  startLetter=0;  for (cli.toFirst();(cd=cli.current());++cli)  {    if (cd->isLinkableInProject() && cd->templateMaster()==0)    {      int index = getPrefixIndex(cd->className());      if (toupper(cd->className().at(index))!=startLetter)      {        // insert a new header using a dummy class pointer.        startLetter=toupper(cd->className().at(index));        colList[col].append((ClassDef *)8); // insert dummy for the header        row++;        if ( row >= rows + ((col<itemsInLastRow) ? 0 : -1))         {           // if the header is the last item in the row, we add an extra          // row to make it easier to find the text of the header (this          // is then contained in the next cell)          colList[col].append(cd);           col++;           row=0;         }      }      // add the class definition to the correct column list      colList[col].append(cd);      row++;      if ( row >= rows + ((col<itemsInLastRow) ? 0 : -1)) { col++; row=0; }    }  }  // create iterators for each column  ClassListIterator **colIterators = new ClassListIterator*[columns];  for (i=0;i<columns;i++)  {    colIterators[i] = new ClassListIterator(colList[i]);  }  // generate table  for (i=0;i<rows;i++) // foreach table row  {    ol.nextTableRow();    // the last column may contain less items then the others    int colsInRow = (i<rows-1) ? columns : itemsInLastRow;     //printf("row [%d]\n",i);    for (j=0;j<colsInRow;j++) // foreach table column    {      ClassDef *cd = colIterators[j]->current();      //printf("columns [%d] cd=%p\n",j,cd);      if (cd==(ClassDef *)8) // the class pointer is really a header      {        cd=++(*colIterators[j]); // get the next item        if (cd)        {          //printf("head ClassDef=%p %s\n",cd,cd ? cd->name().data() : "<none>");          int index = getPrefixIndex(cd->className());          startLetter=toupper(cd->className().at(index));          char s[2]; s[0]=startLetter; s[1]=0;          ol.writeIndexHeading(s);        }      }      else if (cd) // a real class, insert a link      {        QCString cname;        QCString namesp;        if (cd->getNamespaceDef()) namesp=cd->getNamespaceDef()->name();        if (Config_getBool("HIDE_SCOPE_NAMES"))        {          cname=cd->displayName();        }

⌨️ 快捷键说明

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