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

📄 doxygen.cpp

📁 doxygen(一个自动从源代码生成文档的工具)的源代码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    //  static QRegExp r("[a-z_A-Z][a-z_A-Z0-9]*");    //  int i,l;    //  if ((i=r.match(type,8,&l))!=-1)    //  {    //    //printf(">>> inserting typedef `%s'->`%s'\n",type.mid(i,l).data(),name.data());    //    if (getClass(type.mid(i,l))!=0)    //    {    //      typedefDict.insert(name,new QCString(type.mid(i,l)));     //    }    //  }    //}  }nextMember:  EntryListIterator eli(*root->sublist);  Entry *e;  for (;(e=eli.current());++eli)  {    if (e->section!=Entry::ENUM_SEC) buildVarList(e);  }}//----------------------------------------------------------------------// Searches the Entry tree for Function sections.// If found they are stored in their class or in the global list.static void buildFunctionList(Entry *root){  if (root->section==Entry::FUNCTION_SEC)  {    Debug::print(Debug::Functions,0,                 "FUNCTION_SEC:\n"                 "  `%s' `%s'::`%s' `%s' relates=`%s' file=`%s' line=`%d' bodyLine=`%d' #tArgLists=%d mGrpId=%d memSpec=%d\n",                 root->type.data(),                 root->parent->name.data(),                 root->name.data(),                 root->args.data(),                 root->relates.data(),                 root->fileName.data(),                 root->startLine,                 root->bodyLine,                 root->tArgLists ? (int)root->tArgLists->count() : -1,                 //root->tArgList ? (int)root->tArgList->count() : -1,                 //root->mtArgList ? (int)root->mtArgList->count() : -1,                 root->mGrpId,                 root->memSpec                );    bool isFriend=root->type.find("friend ")!=-1;    QCString rname = removeRedundantWhiteSpace(root->name);    if (!rname.isEmpty())    {            ClassDef *cd=0;      // check if this function's parent is a class      QRegExp re("([a-z_A-Z0-9: ]*[ *]*[ ]*");      //printf("root->parent=`%s' cd=%p root->type.find(re,0)=%d\n",      //    root->parent->name.data(),getClass(root->parent->name),      //    root->type.find(re,0));      QCString scope=stripAnonymousNamespaceScope(root->parent->name.copy());      scope=stripTemplateSpecifiersFromScope(scope,FALSE);      bool isMember=FALSE;      int memIndex=rname.find("::");      if (memIndex!=-1)      {        int ts=rname.find('<');        int te=rname.find('>');        if (ts==-1 || te==-1)        {          isMember=TRUE;        }        else        {          isMember=memIndex<ts || memIndex>te;        }      }            int i;      if (root->parent &&           !root->parent->name.isEmpty() &&          (root->parent->section & Entry::COMPOUND_MASK) &&           (cd=getClass(scope)) &&          // do some fuzzy things to exclude function pointers           (root->type.isEmpty() || root->type.find(re,0)==-1 ||            root->type.find(")(")!=-1 || root->type.find("operator")!=-1          )         )      {        int l;        if (!root->type.isEmpty() && (i=re.match(root->type,0,&l))!=-1) // function variable        {          root->args+=root->type.right(root->type.length()-i-l);          root->type=root->type.left(i+l);        }        QCString name=removeRedundantWhiteSpace(rname);        if (name.left(2)=="::") name=name.right(name.length()-2);        MemberDef::MemberType mtype;        if (isFriend)                 mtype=MemberDef::Friend;        else if (root->mtype==Signal) mtype=MemberDef::Signal;        else if (root->mtype==Slot)   mtype=MemberDef::Slot;        else if (root->mtype==DCOP)   mtype=MemberDef::DCOP;        else                          mtype=MemberDef::Function;        // strip redundant template specifier for constructors        if ((i=name.find('<'))!=-1 && name.find('>')!=-1)        {          name=name.left(i);         }                     //if (Config::instance()->get("") && !root->body.isEmpty())        //{        //  printf("Function: %s\n-----------------\n%s\n------------------\n",        //         rname.data(),root->body.data());        //}        // new member function, signal or slot.        //printf("new member: %s member template args=`%s'\n",        //          root->args.data(),        //          argListToString(root->mtArgList).data());        MemberDef *md=new MemberDef(            root->fileName,root->startLine,            root->type,name,root->args,root->exception,            root->protection,root->virt,root->stat,!root->relates.isEmpty(),            mtype,root->tArgLists ? root->tArgLists->last() : 0,root->argList);        if (root->tagInfo)         {          md->setAnchor(root->tagInfo->anchor);          md->setReference(root->tagInfo->tagName);        }        md->setMemberClass(cd);        md->setDocumentation(root->doc);        md->setBriefDescription(root->brief);        md->setBodySegment(root->bodyLine,root->endBodyLine);        md->setMemberSpecifiers(root->memSpec);        md->setMemberGroupId(root->mGrpId);        bool ambig;        md->setBodyDef(findFileDef(Doxygen::inputNameDict,root->fileName,ambig));        //md->setScopeTemplateArguments(root->tArgList);        md->addSectionsToDefinition(root->anchors);        QCString def;        if (!root->relates.isEmpty() || isFriend || Config_getBool("HIDE_SCOPE_NAMES"))        {          if (!root->type.isEmpty())          {            if (root->argList)            {              def=root->type+" "+name;            }            else            {              def=root->type+" "+name+root->args;            }          }          else          {            if (root->argList)            {              def=name;            }            else            {              def=name+root->args;            }          }        }        else        {          QCString qualScope = cd->qualifiedNameWithTemplateParameters();          if (!root->type.isEmpty())          {            if (root->argList)            {              def=root->type+" "+qualScope+"::"+name;            }            else            {              def=root->type+" "+qualScope+"::"+name+root->args;            }          }          else          {            if (root->argList)            {              def=qualScope+"::"+name;            }            else            {              def=qualScope+"::"+name+root->args;            }          }        }        if (def.left(7)=="friend ") def=def.right(def.length()-7);        md->setDefinition(def);        Debug::print(Debug::Functions,0,                     "  Func Member:\n"                     "    `%s' `%s'::`%s' `%s' proto=%d\n"                     "    def=`%s'\n",                     root->type.data(),                     scope.data(),                     rname.data(),                     root->args.data(),                     root->proto,                     def.data()                    );        // add member to the global list of all members        //printf("Adding member=%s class=%s\n",md->name().data(),cd->name().data());        MemberName *mn;        if ((mn=Doxygen::memberNameSDict[name]))        {          mn->append(md);        }        else        {          mn = new MemberName(name);          mn->append(md);          //Doxygen::memberNameDict.insert(name,mn);          //Doxygen::memberNameList.append(mn);          Doxygen::memberNameSDict.append(name,mn);        }        // add member to the class cd        cd->insertMember(md);        // add file to list of used files        cd->insertUsedFile(root->fileName);        addMemberToGroups(root,md);        root->section = Entry::EMPTY_SEC;        md->setRefItems(root->todoId,root->testId,root->bugId);      }      else if (root->parent &&                !(root->parent->section & Entry::COMPOUND_MASK) &&               !isMember &&               root->relates.isEmpty() &&               root->type.left(7)!="extern " &&               root->type.left(8)!="typedef "               )      // no member => unrelated function       {        /* check the uniqueness of the function name in the file.         * A file could contain a function prototype and a function definition         * or even multiple function prototypes.         */        bool found=FALSE;        MemberName *mn;        //MemberDef *fmd;        if ((mn=Doxygen::functionNameSDict[rname]))        {          //printf("--> function %s already found!\n",rname.data());          MemberNameIterator mni(*mn);          MemberDef *md;          for (mni.toFirst();((md=mni.current()) && !found);++mni)          {            NamespaceDef *nd = md->getNamespaceDef();            NamespaceDef *rnd = 0;            if (!root->parent->name.isEmpty())            {              rnd = getResolvedNamespace(root->parent->name);            }            FileDef *fd = md->getFileDef();            QCString nsName,rnsName;            if (nd)  nsName  = nd->name().copy();            if (rnd) rnsName = rnd->name().copy();            //printf("matching arguments for %s\n",md->name().data());            if (                 matchArguments(md->argumentList(),root->argList,0,nsName)               )            {              //printf("match!\n");              // see if we need to create a new member              found=(nd && rnd && nsName==rnsName) ||   // members are in the same namespace                    ((fd!=0 &&                          // no external reference and                      fd->absFilePath()==root->fileName // prototype in the same file                     )                     );               // otherwise, allow a duplicate global member with the same argument list                            //printf("combining function with prototype found=%d `%s'<->`%s'!\n",              //    found,fd->absFilePath().data(),root->fileName.data());              // merge argument lists              mergeArguments(root->argList,md->argumentList());              // merge documentation              if (!md->documentation() && !root->doc.isEmpty())              {                md->setDocumentation(root->doc);              }              if (!md->briefDescription() && !root->brief.isEmpty())              {                md->setBriefDescription(root->brief);              }              // merge body definitions              if (md->getStartBodyLine()==-1 && root->bodyLine!=-1)              {                md->setBodySegment(root->bodyLine,root->endBodyLine);                bool ambig;                md->setBodyDef(findFileDef(Doxygen::inputNameDict,root->fileName,ambig));              }               md->addSectionsToDefinition(root->anchors);              // merge ingroup specifiers              if (md->getGroupDef()==0 && root->groups->first())              {                GroupDef *gd=Doxygen::groupSDict[root->groups->first()->groupname.data()];                md->setGroupDef(gd, root->groups->first()->pri, root->fileName, root->startLine, root->doc.length() != 0);              }              else if (md->getGroupDef()!=0 && root->groups->count()==0)              {                root->groups->append(new Grouping(md->getGroupDef()->name(), md->getGroupPri()));              }            }          }        }        if (!found) /* global function is unique with respect to the file */        {          //printf("New function type=`%s' name=`%s' args=`%s' bodyLine=%d\n",          //       root->type.data(),rname.data(),root->args.data(),root->bodyLine);                    // new global function          ArgumentList *tArgList = root->tArgLists ? root->tArgLists->last() : 0;          QCString name=removeRedundantWhiteSpace(rname);          MemberDef *md=new MemberDef(              root->fileName,root->startLine,              root->type,name,root->args,root->exception,              root->protection,root->virt,root->stat,FALSE,              MemberDef::Function,tArgList,root->argList);          if (root->tagInfo)           {            md->setAnchor(root->tagInfo->anchor);            md->setReference(root->tagInfo->tagName);          }          //md->setDefFile(root->fileName);          //md->setDefLine(root->startLine);          md->setDocumentation(root->doc);          md->setBriefDescription(root->brief);          md->setPrototype(root->proto);          //md->setBody(root->body);          md->setBodySegment(root->bodyLine,root->endBodyLine);          bool ambig;          FileDef *fd=findFileDef(Doxygen::inputNameDict,root->fileName,ambig);          md->setBodyDef(fd);          md->addSectionsToDefinition(root->anchors);          md->setMemberSpecifiers(root->memSpec);          md->setMemberGroupId(root->mGrpId);          QCString def;          if (!root->type.isEmpty())          {            if (root->argList)            {              def=root->type+" "+name;            }            else            {              def=root->type+" "+name+root->args;            }          }          else          {            if (root->argList)            {              def=name.copy();            }            else            {              def=name+root->args;            }          }          Debug::print(Debug::Functions,0,                     "  Global Function:\n"                     "    `%s' `%s'::`%s' `%s' proto=%d\n"                     "    def=`%s'\n",                     root->type.data(),                     root->parent->name.data(),                     rname.data(),                     root->args.data(),                     root->proto,                     def.data()                    );          md->setDefinition(def);          //if (root->mGrpId!=-1)           //{          //  md->setMemberGroup(memberGroupDict[root->mGrpId]);          //}          // see if the function is inside a namespace          NamespaceDef *nd = 0;          if (root->parent->section == Entry::NAMESPACE_SEC )          {            QCString nscope=removeAnonymousScopes(root->parent->name);            if (!nscope.isEmpty())            {              nd = getRes

⌨️ 快捷键说明

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