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

📄 doxygen.cpp

📁 doxygen(一个自动从源代码生成文档的工具)的源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
/****************************************************************************** * * $Id: doxygen.cpp,v 1.87 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 <qfileinfo.h>#include <qfile.h>#include <qdir.h>#include <qdict.h>#include <qregexp.h>#include <qstrlist.h>#include <stdio.h>#include <stdlib.h>#include <sys/stat.h>#include "version.h"#include "doxygen.h"#include "scanner.h"#include "doc.h"#include "entry.h"#include "index.h"#include "logos.h"#include "instdox.h"#include "message.h"#include "code.h"#include "config.h"#include "util.h"#include "pre.h"#include "tagreader.h"#include "dot.h"#include "outputlist.h"#include "declinfo.h"#include "htmlgen.h"#include "latexgen.h"#include "mangen.h"#include "language.h"#include "debug.h"#include "htmlhelp.h"#include "ftvhelp.h"#include "defargs.h"#include "rtfgen.h"#include "xmlgen.h"#include "reflist.h"#include "page.h"#include "packagedef.h"#include "bufstr.h"#if defined(_MSC_VER) || defined(__BORLANDC__)#define popen _popen#define pclose _pclose#endifstatic QDict<Entry> classEntries(1009);ClassSDict     Doxygen::classSDict(1009);         ClassSDict     Doxygen::hiddenClasses(257);//NamespaceList  Doxygen::namespaceList;           // all namespaces//NamespaceDict  Doxygen::namespaceDict(257);      NamespaceSDict  Doxygen::namespaceSDict(20);      //MemberNameList Doxygen::memberNameList;          // class member + related functions//MemberNameDict Doxygen::memberNameDict(10007);   MemberNameSDict Doxygen::memberNameSDict(10000);   //MemberNameList Doxygen::functionNameList;        // all global function/namespace members//MemberNameDict Doxygen::functionNameDict(10007); MemberNameSDict Doxygen::functionNameSDict(10000);   FileNameList   Doxygen::inputNameList;           // all input filesFileNameDict  *Doxygen::inputNameDict;          //GroupList      Doxygen::groupList;               // all groupsGroupSDict      Doxygen::groupSDict(17);          FormulaList    Doxygen::formulaList;             // all formulasFormulaDict    Doxygen::formulaDict(1009);       // all formulasFormulaDict    Doxygen::formulaNameDict(1009);   // the label name of all formulasPackageSDict   Doxygen::packageDict(257);         // java packagesPageSDict      *Doxygen::pageSDict = new PageSDict(1009);          // all doc pagesPageSDict      *Doxygen::exampleSDict = new PageSDict(1009);       // all examplesSectionDict    Doxygen::sectionDict(257);        // all page sectionsStringDict     Doxygen::aliasDict(257);          // aliasesFileNameDict   *Doxygen::includeNameDict;        // include namesFileNameDict   *Doxygen::exampleNameDict;        // examplesFileNameDict   *Doxygen::imageNameDict;          // imagesFileNameDict   *Doxygen::dotFileNameDict;        // dot filesStringDict     Doxygen::namespaceAliasDict(257); // all namespace aliasesStringDict     Doxygen::tagDestinationDict(257); // all tag locations                                        // a member groupQDict<void>    Doxygen::expandAsDefinedDict(257); // all macros that should be expandedQIntDict<QCString> Doxygen::memberHeaderDict(1009); // dictionary of the member groups headingQIntDict<QCString> Doxygen::memberDocDict(1009);    // dictionary of the member groups headingPageInfo      *Doxygen::mainPage = 0;           QTextStream    Doxygen::tagFile;NamespaceDef  *Doxygen::globalScope = new NamespaceDef("<globalScope>",1,"<globalScope>");  static StringList     inputFiles;         static StringDict     excludeNameDict(1009);   // sectionsstatic QDict<void>    compoundKeywordDict(7);  // keywords recognised as compoundsstatic OutputList     *outputList = 0;         // list of output generating objectsvoid clearAll(){  inputFiles.clear();        excludeNameDict.clear();    delete outputList; outputList=0;  Doxygen::classSDict.clear();         Doxygen::namespaceSDict.clear();     Doxygen::pageSDict->clear();           Doxygen::exampleSDict->clear();        //Doxygen::memberNameList.clear();    //Doxygen::functionNameList.clear();  Doxygen::inputNameList.clear();     //Doxygen::groupList.clear();         Doxygen::formulaList.clear();       Doxygen::classSDict.clear();          //Doxygen::memberNameDict.clear();    //Doxygen::functionNameDict.clear();  Doxygen::sectionDict.clear();         Doxygen::inputNameDict->clear();      Doxygen::includeNameDict->clear();    Doxygen::exampleNameDict->clear();    Doxygen::imageNameDict->clear();       Doxygen::dotFileNameDict->clear();       //Doxygen::groupDict.clear();           Doxygen::formulaDict.clear();        Doxygen::formulaNameDict.clear();    Doxygen::tagDestinationDict.clear();  delete Doxygen::mainPage; Doxygen::mainPage=0;}void statistics(){  fprintf(stderr,"--- inputNameDict stats ----\n");  Doxygen::inputNameDict->statistics();  fprintf(stderr,"--- includeNameDict stats ----\n");  Doxygen::includeNameDict->statistics();  fprintf(stderr,"--- exampleNameDict stats ----\n");  Doxygen::exampleNameDict->statistics();  fprintf(stderr,"--- imageNameDict stats ----\n");  Doxygen::imageNameDict->statistics();  fprintf(stderr,"--- dotFileNameDict stats ----\n");  Doxygen::dotFileNameDict->statistics();  //fprintf(stderr,"--- memberNameDict stats ----\n");  //Doxygen::memberNameDict.statistics();  //fprintf(stderr,"--- functionNameDict stats ----\n");  //Doxygen::functionNameDict.statistics();  fprintf(stderr,"--- excludeNameDict stats ----\n");  excludeNameDict.statistics();  fprintf(stderr,"--- aliasDict stats ----\n");  Doxygen::aliasDict.statistics();  fprintf(stderr,"--- typedefDict stats ----\n");  //Doxygen::typedefDict.statistics();  fprintf(stderr,"--- namespaceAliasDict stats ----\n");  Doxygen::namespaceAliasDict.statistics();  //fprintf(stderr,"--- groupDict stats ----\n");  //Doxygen::groupDict.statistics();  fprintf(stderr,"--- formulaDict stats ----\n");  Doxygen::formulaDict.statistics();  fprintf(stderr,"--- formulaNameDict stats ----\n");  Doxygen::formulaNameDict.statistics();  fprintf(stderr,"--- tagDestinationDict stats ----\n");  Doxygen::tagDestinationDict.statistics();  fprintf(stderr,"--- compoundKeywordDict stats ----\n");  compoundKeywordDict.statistics();  fprintf(stderr,"--- expandAsDefinedDict stats ----\n");  Doxygen::expandAsDefinedDict.statistics();  fprintf(stderr,"--- memberHeaderDict stats ----\n");  Doxygen::memberHeaderDict.statistics();  fprintf(stderr,"--- memberDocDict stats ----\n");  Doxygen::memberDocDict.statistics();}static void addMemberDocs(Entry *root,MemberDef *md, const char *funcDecl,                   ArgumentList *al,bool over_load,NamespaceList *nl=0);const char idMask[] = "[A-Za-z_][A-Za-z_0-9]*";QCString spaces;//----------------------------------------------------------------------------static void addRelatedPage(Entry *root){  GroupDef *gd=0;  QListIterator<Grouping> gli(*root->groups);  Grouping *g;  for (;(g=gli.current());++gli)  {    if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname])) break;  }  addRelatedPage(root->name,root->args,root->doc,root->anchors,      root->fileName,root->startLine,root->todoId,      root->testId,root->bugId,gd,root->tagInfo     );}static void buildGroupList(Entry *root){  if (root->section==Entry::GROUPDOC_SEC && !root->name.isEmpty())  {    //printf("Found group %s title=`%s'\n",root->name.data(),root->type.data());        GroupDef *gd;        if ((gd=Doxygen::groupSDict[root->name]))    {      if ( root->groupdoctype==Entry::GROUPDOC_NORMAL )      {        warn(root->fileName,root->startLine,             "Warning: group %s already documented. "             "Skipping documentation.",             root->name.data());      }      else      {	if ( !gd->hasGroupTitle() )          gd->setGroupTitle( root->type );        else if ( root->type.length() > 0 && root->name != root->type && gd->groupTitle() != root->type )          warn( root->fileName,root->startLine,		"group %s: ignoring title \"%s\" that does not match old title \"%s\"\n",		root->name.data(), root->type.data(), gd->groupTitle() );        if ( gd->briefDescription().isEmpty() )	  gd->setBriefDescription(root->brief);        if ( !root->doc.stripWhiteSpace().isEmpty() )	  gd->setDocumentation( gd->documentation().isEmpty() ? root->doc :				gd->documentation() + "\n\n" + root->doc );        gd->addSectionsToDefinition(root->anchors);        gd->setRefItems(root->todoId,root->testId,root->bugId);        addGroupToGroups(root,gd);      }    }    else    {      gd = new GroupDef(root->fileName,root->startLine,root->name,root->type);      if (root->tagInfo)      {        gd->setReference(root->tagInfo->tagName);      }      gd->setBriefDescription(root->brief);      gd->setDocumentation(root->doc);      gd->addSectionsToDefinition(root->anchors);      //Doxygen::groupList.append(gd);      //Doxygen::groupDict.insert(root->name,gd);      Doxygen::groupSDict.append(root->name,gd);      gd->setRefItems(root->todoId,root->testId,root->bugId);    }  }  EntryListIterator eli(*root->sublist);  Entry *e;  for (;(e=eli.current());++eli)  {    buildGroupList(e);  }}static void organizeSubGroups(Entry *root){  if (root->section==Entry::GROUPDOC_SEC && !root->name.isEmpty())  {    GroupDef *gd;    if ((gd=Doxygen::groupSDict[root->name]))    {      addGroupToGroups(root,gd);    }  }  EntryListIterator eli(*root->sublist);  Entry *e;  for (;(e=eli.current());++eli)  {    organizeSubGroups(e);  }}//----------------------------------------------------------------------static void buildFileList(Entry *root){  if (((root->section==Entry::FILEDOC_SEC) ||        ((root->section & Entry::FILE_MASK) && Config_getBool("EXTRACT_ALL"))) &&      !root->name.isEmpty() && !root->tagInfo // skip any file coming from tag files     )  {    bool ambig;    FileDef *fd=findFileDef(Doxygen::inputNameDict,root->name,ambig);    if (fd && !ambig)    {      if ((!root->doc.isEmpty() && !fd->documentation().isEmpty()) ||          (!root->brief.isEmpty() && !fd->briefDescription().isEmpty()))      {        warn(            root->fileName,root->startLine,            "Warning: file %s already documented. "            "Skipping documentation.",            root->name.data()            );      }      else      {        // using FALSE in setDocumentation is small hack to make sure a file         // is documented even if a \file command is used without further         // documentation        fd->setDocumentation(root->doc,FALSE);        fd->setBriefDescription(root->brief);         fd->addSectionsToDefinition(root->anchors);        fd->setRefItems(root->todoId,root->testId,root->bugId);        QListIterator<Grouping> gli(*root->groups);        Grouping *g;        for (;(g=gli.current());++gli)        {          GroupDef *gd=0;          if (!g->groupname.isEmpty() && (gd=Doxygen::groupSDict[g->groupname]))          {            gd->addFile(fd);            //printf("File %s: in group %s\n",fd->name().data(),s->data());          }        }      }    }    else    {      const char *fn = root->fileName.data();      QCString text;      text.sprintf("Warning: the name `%s' supplied as "          "the second argument in the \\file statement ",          root->name.data()                  );      if (ambig) // name is ambigious      {        text+="matches the following input files:\n";        text+=showFileDefMatches(Doxygen::inputNameDict,root->name);        text+="Please use a more specific name by "          "including a (larger) part of the path!";      }      else // name is not an input file      {        text+="is not an input file";      }      warn(fn,root->startLine,text);    }  }  EntryListIterator eli(*root->sublist);  Entry *e;  for (;(e=eli.current());++eli)  {    buildFileList(e);  }}static void addIncludeFile(ClassDef *cd,FileDef *ifd,Entry *root){  if (       (!root->doc.stripWhiteSpace().isEmpty() ||        !root->brief.stripWhiteSpace().isEmpty() ||        Config_getBool("EXTRACT_ALL")      ) && root->protection!=Private     )  {     //printf(">>>>>> includeFile=%s\n",root->includeFile.data());    bool ambig;    FileDef *fd=0;    // see if we need to include a verbatim copy of the header file    //printf("root->includeFile=%s\n",root->includeFile.data());    if (!root->includeFile.isEmpty() &&         (fd=findFileDef(Doxygen::inputNameDict,root->includeFile,ambig))==0       )    { // explicit request      QCString text;      text.sprintf("Warning: the name `%s' supplied as "                  "the second argument in the \\class statement ",                  root->includeFile.data()                 );      if (ambig) // name is ambigious

⌨️ 快捷键说明

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