Doxygen
memberdef.cpp 文件参考
#include <stdio.h>
#include <assert.h>
#include <mutex>
#include "md5.h"
#include "memberdef.h"
#include "membername.h"
#include "doxygen.h"
#include "util.h"
#include "code.h"
#include "message.h"
#include "htmlhelp.h"
#include "language.h"
#include "outputlist.h"
#include "example.h"
#include "membergroup.h"
#include "groupdef.h"
#include "defargs.h"
#include "docparser.h"
#include "dot.h"
#include "dotcallgraph.h"
#include "searchindex.h"
#include "parserintf.h"
#include "vhdldocgen.h"
#include "arguments.h"
#include "memberlist.h"
#include "namespacedef.h"
#include "filedef.h"
#include "config.h"
#include "definitionimpl.h"
#include "regex.h"
+ memberdef.cpp 的引用(Include)关系图:

浏览源代码.

class  MemberDefImpl
 
class  MemberDefAliasImpl
 
class  MemberDefImpl::IMPL
 

函数

MemberDefMutablecreateMemberDef (const QCString &defFileName, int defLine, int defColumn, const QCString &type, const QCString &name, const QCString &args, const QCString &excp, Protection prot, Specifier virt, bool stat, Relationship related, MemberType t, const ArgumentList &tal, const ArgumentList &al, const QCString &metaData)
 Factory method to create a new instance of a MemberDef 更多...
 
MemberDefcreateMemberDefAlias (const Definition *newScope, const MemberDef *aliasMd)
 
static QCString addTemplateNames (const QCString &s, const QCString &n, const QCString &t)
 
static bool writeDefArgumentList (OutputList &ol, const Definition *scope, const MemberDef *md)
 
static void writeExceptionListImpl (OutputList &ol, const ClassDef *cd, const MemberDef *md, QCString const &exception)
 
static void writeExceptionList (OutputList &ol, const ClassDef *cd, const MemberDef *md)
 
static QCString simplifyTypeForTable (const QCString &s)
 
static QCString stripTrailingReturn (const QCString &trailRet)
 
static void invalidateCachedTypesInArgumentList (ArgumentList &al)
 
static void transferArgumentDocumentation (ArgumentList &decAl, ArgumentList &defAl)
 
void combineDeclarationAndDefinition (MemberDefMutable *mdec, MemberDefMutable *mdef)
 
void addDocCrossReference (MemberDefMutable *src, MemberDefMutable *dst)
 
MemberDeftoMemberDef (Definition *d)
 
MemberDeftoMemberDef (DefinitionMutable *md)
 
const MemberDeftoMemberDef (const Definition *d)
 
MemberDefMutabletoMemberDefMutable (Definition *d)
 
MemberDefMutabletoMemberDefMutable (const Definition *d)
 

变量

static std::mutex g_cachedAnonymousTypeMutex
 
static const reg::Ex reAnonymous (R"([\w:@]*@\d+)")
 

函数说明

◆ addDocCrossReference()

void addDocCrossReference ( MemberDefMutable src,
MemberDefMutable dst 
)

在文件 memberdef.cpp6047 行定义.

6048 {
6049  if (src==0 || dst==0) return;
6050  //printf("--> addDocCrossReference src=%s,dst=%s\n",qPrint(src->name()),qPrint(dst->name()));
6051  if (dst->isTypedef() || dst->isEnumerate()) return; // don't add types
6052  if ((dst->hasReferencedByRelation() || dst->hasCallerGraph()) &&
6053  src->showInCallGraph()
6054  )
6055  {
6056  dst->addSourceReferencedBy(src);
6058  if (mdDef)
6059  {
6060  mdDef->addSourceReferencedBy(src);
6061  }
6063  if (mdDecl)
6064  {
6065  mdDecl->addSourceReferencedBy(src);
6066  }
6067  }
6068  if ((src->hasReferencesRelation() || src->hasCallGraph()) &&
6069  src->showInCallGraph()
6070  )
6071  {
6072  src->addSourceReferences(dst);
6074  if (mdDef)
6075  {
6076  mdDef->addSourceReferences(dst);
6077  }
6079  if (mdDecl)
6080  {
6081  mdDecl->addSourceReferences(dst);
6082  }
6083  }
6084 }

引用了 DefinitionMutable::addSourceReferencedBy(), DefinitionMutable::addSourceReferences(), MemberDef::hasCallerGraph(), MemberDef::hasCallGraph(), MemberDef::hasReferencedByRelation(), MemberDef::hasReferencesRelation(), MemberDef::isEnumerate(), MemberDef::isTypedef(), MemberDef::memberDeclaration(), MemberDef::memberDefinition(), MemberDef::showInCallGraph() , 以及 toMemberDefMutable().

◆ addTemplateNames()

static QCString addTemplateNames ( const QCString s,
const QCString n,
const QCString t 
)
static

在文件 memberdef.cpp790 行定义.

791 {
792  QCString result;
793  QCString clRealName=n;
794  int p=0,i;
795  if ((i=clRealName.find('<'))!=-1)
796  {
797  clRealName=clRealName.left(i); // strip template specialization
798  }
799  if ((i=clRealName.findRev("::"))!=-1)
800  {
801  clRealName=clRealName.right(clRealName.length()-i-2);
802  }
803  while ((i=s.find(clRealName,p))!=-1)
804  {
805  result+=s.mid(p,i-p);
806  uint j=clRealName.length()+i;
807  if (s.length()==j || (s.at(j)!='<' && !isId(s.at(j))))
808  { // add template names
809  //printf("Adding %s+%s\n",qPrint(clRealName),qPrint(t));
810  result+=clRealName+t;
811  }
812  else
813  { // template names already present
814  //printf("Adding %s\n",qPrint(clRealName));
815  result+=clRealName;
816  }
817  p=i+clRealName.length();
818  }
819  result+=s.right(s.length()-p);
820  //printf("addTemplateNames(%s,%s,%s)=%s\n",qPrint(s),qPrint(n),qPrint(t),qPrint(result));
821  return result;
822 }

引用了 QCString::at(), QCString::find(), QCString::findRev(), isId(), QCString::left(), QCString::length(), QCString::mid() , 以及 QCString::right().

被这些函数引用 writeDefArgumentList().

◆ combineDeclarationAndDefinition()

void combineDeclarationAndDefinition ( MemberDefMutable mdec,
MemberDefMutable mdef 
)

在文件 memberdef.cpp5818 行定义.

5819 {
5820  //printf("mdec=%s isPrototype()=%d\n",qPrint(mdec->name()),mdec->isPrototype());
5821  if (
5822  (mdef->isFunction() && !mdef->isStatic() && !mdef->isPrototype()) ||
5823  (mdef->isVariable() && !mdef->isExternal() && !mdef->isStatic())
5824  )
5825  {
5826  //printf("mdef=(%p,%s) mdec=(%p,%s)\n",
5827  // mdef, mdef ? qPrint(mdef->name()) : "",
5828  // mdec, mdec ? qPrint(mdec->name()) : "");
5829 
5830  ArgumentList &mdefAl = const_cast<ArgumentList&>(mdef->argumentList());
5831  ArgumentList &mdecAl = const_cast<ArgumentList&>(mdec->argumentList());
5832  if (matchArguments2(mdef->getOuterScope(),mdef->getFileDef(),&mdefAl,
5833  mdec->getOuterScope(),mdec->getFileDef(),&mdecAl,
5834  TRUE
5835  )
5836  ) /* match found */
5837  {
5838  //printf("Found member %s: definition in %s (doc='%s') and declaration in %s (doc='%s')\n",
5839  // mn->memberName(),
5840  // qPrint(mdef->getFileDef()->name()),qPrint(mdef->documentation()),
5841  // qPrint(mdec->getFileDef()->name()),qPrint(mdec->documentation())
5842  // );
5843 
5844  if (Config_getBool(RESOLVE_UNNAMED_PARAMS))
5845  {
5846  mdec->resolveUnnamedParameters(mdef);
5847  }
5848 
5849  // first merge argument documentation
5850  transferArgumentDocumentation(mdecAl,mdefAl);
5851 
5852  /* copy documentation between function definition and declaration */
5853  if (!mdec->briefDescription().isEmpty())
5854  {
5855  mdef->setBriefDescription(mdec->briefDescription(),mdec->briefFile(),mdec->briefLine());
5856  }
5857  else if (!mdef->briefDescription().isEmpty())
5858  {
5859  mdec->setBriefDescription(mdef->briefDescription(),mdef->briefFile(),mdef->briefLine());
5860  }
5861  if (!mdef->documentation().isEmpty())
5862  {
5863  //printf("transferring docs mdef->mdec (%s->%s)\n",mdef->argsString(),mdec->argsString());
5864  mdec->setDocumentation(mdef->documentation(),mdef->docFile(),mdef->docLine());
5866  if (mdefAl.hasParameters())
5867  {
5868  auto mdefAlComb = stringToArgumentList(mdef->getLanguage(),mdef->argsString());
5869  transferArgumentDocumentation(mdefAl,*mdefAlComb);
5870  mdec->moveArgumentList(std::move(mdefAlComb));
5871  }
5872  }
5873  else if (!mdec->documentation().isEmpty())
5874  {
5875  //printf("transferring docs mdec->mdef (%s->%s)\n",mdec->argsString(),mdef->argsString());
5876  mdef->setDocumentation(mdec->documentation(),mdec->docFile(),mdec->docLine());
5878  if (mdecAl.hasParameters())
5879  {
5880  auto mdecAlComb = stringToArgumentList(mdec->getLanguage(),mdec->argsString());
5881  transferArgumentDocumentation(mdecAl,*mdecAlComb);
5882  mdef->moveDeclArgumentList(std::move(mdecAlComb));
5883  }
5884  }
5885  if (!mdef->inbodyDocumentation().isEmpty())
5886  {
5887  mdec->setInbodyDocumentation(mdef->inbodyDocumentation(),mdef->inbodyFile(),mdef->inbodyLine());
5888  }
5889  else if (!mdec->inbodyDocumentation().isEmpty())
5890  {
5891  mdef->setInbodyDocumentation(mdec->inbodyDocumentation(),mdec->inbodyFile(),mdec->inbodyLine());
5892  }
5893  if (mdec->getStartBodyLine()!=-1 && mdef->getStartBodyLine()==-1)
5894  {
5895  //printf("body mdec->mdef %d-%d\n",mdec->getStartBodyLine(),mdef->getEndBodyLine());
5896  mdef->setBodySegment(mdec->getDefLine(),mdec->getStartBodyLine(),mdec->getEndBodyLine());
5897  mdef->setBodyDef(mdec->getBodyDef());
5898  //mdef->setBodyMember(mdec);
5899  }
5900  else if (mdef->getStartBodyLine()!=-1 && mdec->getStartBodyLine()==-1)
5901  {
5902  //printf("body mdef->mdec %d-%d\n",mdef->getStartBodyLine(),mdec->getEndBodyLine());
5903  mdec->setBodySegment(mdef->getDefLine(),mdef->getStartBodyLine(),mdef->getEndBodyLine());
5904  mdec->setBodyDef(mdef->getBodyDef());
5905  //mdec->setBodyMember(mdef);
5906  }
5909 
5910  // copy group info.
5911  if (mdec->getGroupDef()==0 && mdef->getGroupDef()!=0)
5912  {
5913  mdec->setGroupDef(mdef->getGroupDef(),
5914  mdef->getGroupPri(),
5915  mdef->docFile(),
5916  mdef->docLine(),
5917  mdef->hasDocumentation(),
5918  mdef
5919  );
5920  }
5921  else if (mdef->getGroupDef()==0 && mdec->getGroupDef()!=0)
5922  {
5923  mdef->setGroupDef(mdec->getGroupDef(),
5924  mdec->getGroupPri(),
5925  mdec->docFile(),
5926  mdec->docLine(),
5927  mdec->hasDocumentation(),
5928  mdec
5929  );
5930  }
5931 
5932 
5933  mdec->mergeRefItems(mdef);
5934  mdef->mergeRefItems(mdec);
5935 
5936  mdef->setMemberDeclaration(mdec);
5937  mdec->setMemberDefinition(mdef);
5938 
5939  mdef->enableCallGraph(mdec->hasCallGraph() || mdef->hasCallGraph());
5940  mdef->enableCallerGraph(mdec->hasCallerGraph() || mdef->hasCallerGraph());
5941  mdec->enableCallGraph(mdec->hasCallGraph() || mdef->hasCallGraph());
5942  mdec->enableCallerGraph(mdec->hasCallerGraph() || mdef->hasCallerGraph());
5943 
5948  }
5949  }
5950 }

引用了 MemberDef::argsString(), MemberDef::argumentList(), MemberDef::briefDescription(), Definition::briefFile(), Definition::briefLine(), Config_getBool, Definition::docFile(), Definition::docLine(), MemberDef::documentation(), MemberDefMutable::enableCallerGraph(), MemberDefMutable::enableCallGraph(), MemberDefMutable::enableReferencedByRelation(), MemberDefMutable::enableReferencesRelation(), Definition::getBodyDef(), Definition::getDefLine(), Definition::getEndBodyLine(), MemberDef::getFileDef(), MemberDef::getGroupDef(), MemberDef::getGroupPri(), Definition::getLanguage(), MemberDef::getMemberSpecifiers(), Definition::getOuterScope(), Definition::getStartBodyLine(), MemberDef::hasCallerGraph(), MemberDef::hasCallGraph(), MemberDef::hasDocumentation(), ArgumentList::hasParameters(), MemberDef::hasReferencedByRelation(), MemberDef::hasReferencesRelation(), Definition::inbodyDocumentation(), Definition::inbodyFile(), Definition::inbodyLine(), MemberDef::isDocsForDefinition(), QCString::isEmpty(), MemberDef::isExternal(), MemberDef::isFunction(), MemberDef::isPrototype(), MemberDef::isStatic(), MemberDef::isVariable(), matchArguments2(), MemberDefMutable::mergeMemberSpecifiers(), DefinitionMutable::mergeRefItems(), MemberDefMutable::moveArgumentList(), MemberDefMutable::moveDeclArgumentList(), MemberDefMutable::resolveUnnamedParameters(), DefinitionMutable::setBodyDef(), DefinitionMutable::setBodySegment(), MemberDefMutable::setBriefDescription(), MemberDefMutable::setDocsForDefinition(), MemberDefMutable::setDocumentation(), MemberDefMutable::setGroupDef(), MemberDefMutable::setInbodyDocumentation(), MemberDefMutable::setMemberDeclaration(), MemberDefMutable::setMemberDefinition(), stringToArgumentList(), transferArgumentDocumentation() , 以及 TRUE.

被这些函数引用 ClassDefImpl::mergeCategory() , 以及 transferFunctionDocumentation().

◆ createMemberDef()

MemberDefMutable* createMemberDef ( const QCString defFileName,
int  defLine,
int  defColumn,
const QCString type,
const QCString name,
const QCString args,
const QCString excp,
Protection  prot,
Specifier  virt,
bool  stat,
Relationship  related,
MemberType  t,
const ArgumentList tal,
const ArgumentList al,
const QCString metaData 
)

Factory method to create a new instance of a MemberDef

在文件 memberdef.cpp373 行定义.

378 {
379  return new MemberDefImpl(defFileName,defLine,defColumn,type,name,args,excp,prot,virt,
380  stat,related,t,tal,al,metaData);
381 }

被这些函数引用 addEnumValuesToEnums(), addInstance(), addLocalObjCMethod(), addMemberSpecialization(), addOverloaded(), addVariableToClass(), addVariableToFile(), buildDefineList(), createTagLessInstance(), MemberDefImpl::createTemplateInstanceMember(), findDefineDocumentation(), findEnums(), findMember() , 以及 findUsingDeclImports().

◆ createMemberDefAlias()

MemberDef* createMemberDefAlias ( const Definition newScope,
const MemberDef aliasMd 
)

在文件 memberdef.cpp781 行定义.

782 {
783  MemberDef *amd = new MemberDefAliasImpl(newScope,aliasMd);
784  //printf("amd: name=%s displayName=%s\n",qPrint(amd->name()),qPrint(amd->displayName()));
785  return amd;
786 }

被这些函数引用 MemberDefAliasImpl::deepCopy() , 以及 NamespaceDefImpl::insertMember().

◆ invalidateCachedTypesInArgumentList()

static void invalidateCachedTypesInArgumentList ( ArgumentList al)
static

在文件 memberdef.cpp5755 行定义.

5756 {
5757  for (Argument &a : al)
5758  {
5759  a.canType.resize(0);
5760  }
5761 }

被这些函数引用 MemberDefImpl::invalidateCachedArgumentTypes().

◆ simplifyTypeForTable()

static QCString simplifyTypeForTable ( const QCString s)
static

在文件 memberdef.cpp3697 行定义.

3698 {
3700  if (ts.right(2)=="::") ts = ts.left(ts.length()-2);
3701  static const reg::Ex re1(R"(\a\w*::)"); // non-template version
3702  static const reg::Ex re2(R"(\a\w*<[^>]*>::)"); // template version
3703  reg::Match match;
3704  std::string t = ts.str();
3705  while (reg::search(t,match,re2) || reg::search(t,match,re1))
3706  {
3707  t = match.prefix().str() + match.suffix().str(); // remove the matched part
3708  }
3709  //printf("simplifyTypeForTable(%s)->%s\n",qPrint(s),t.c_str());
3710  return QCString(t);
3711 }

引用了 QCString::left(), QCString::length(), reg::match(), removeAnonymousScopes(), QCString::right(), reg::search() , 以及 QCString::str().

被这些函数引用 MemberDefImpl::fieldType().

◆ stripTrailingReturn()

static QCString stripTrailingReturn ( const QCString trailRet)
static

在文件 memberdef.cpp3907 行定义.

3908 {
3909  QCString ret = trailRet;
3910 
3911  ret = ret.stripWhiteSpace();
3912  if (ret.startsWith("->"))
3913  {
3914  ret = ret.mid(2).stripWhiteSpace();
3915  return ret;
3916  }
3917  return trailRet;
3918 }

引用了 QCString::mid(), QCString::startsWith() , 以及 QCString::stripWhiteSpace().

被这些函数引用 MemberDefImpl::detectUndocumentedParams().

◆ toMemberDef() [1/3]

const MemberDef* toMemberDef ( const Definition d)

在文件 memberdef.cpp6113 行定义.

6114 {
6115  if (d && (typeid(*d)==typeid(MemberDefImpl) || typeid(*d)==typeid(MemberDefAliasImpl)))
6116  {
6117  return static_cast<const MemberDef*>(d);
6118  }
6119  else
6120  {
6121  return 0;
6122  }
6123 }

◆ toMemberDef() [2/3]

◆ toMemberDef() [3/3]

MemberDef* toMemberDef ( DefinitionMutable md)

在文件 memberdef.cpp6100 行定义.

6101 {
6102  Definition *d = toDefinition(md);
6103  if (d && typeid(*d)==typeid(MemberDefImpl))
6104  {
6105  return static_cast<MemberDef*>(d);
6106  }
6107  else
6108  {
6109  return 0;
6110  }
6111 }

引用了 toDefinition().

◆ toMemberDefMutable() [1/2]

MemberDefMutable* toMemberDefMutable ( const Definition d)

在文件 memberdef.cpp6137 行定义.

6138 {
6139  if (d && typeid(*d)==typeid(MemberDefImpl))
6140  {
6141  return const_cast<MemberDefMutable*>(static_cast<const MemberDefMutable*>(d));
6142  }
6143  else
6144  {
6145  return 0;
6146  }
6147 }

◆ toMemberDefMutable() [2/2]

MemberDefMutable* toMemberDefMutable ( Definition d)

在文件 memberdef.cpp6125 行定义.

6126 {
6127  if (d && typeid(*d)==typeid(MemberDefImpl))
6128  {
6129  return static_cast<MemberDefMutable*>(d);
6130  }
6131  else
6132  {
6133  return 0;
6134  }
6135 }

被这些函数引用 addDocCrossReference(), addEnumValuesToEnums(), MemberList::addListReferences(), addMemberFunction(), addMembersToMemberGroup(), addMemberToGroups(), NamespaceDefImpl::addMemberToList(), FileDefImpl::addMemberToList(), ClassDefImpl::addMemberToList(), addVariableToClass(), addVariableToFile(), computeMemberRelations(), MemberGroup::distributeMemberGroupDocumentation(), findDefineDocumentation(), findDEV(), findEnumDocumentation(), findGlobalMember(), findMember(), MemberList::findSectionsInDocumentation(), flushCachedTemplateRelations(), flushUnresolvedRelations(), inheritDocumentation(), MemberGroup::insertMember(), NamespaceDefImpl::insertMember(), GroupDefImpl::insertMember(), MemberDefImpl::insertReimplementedBy(), ClassDefImpl::mergeCategory(), SymbolResolver::Private::newResolveTypedef(), processTagLessClasses(), MemberList::setAnchors(), MemberList::setAnonymousEnumType(), ClassDefImpl::setGroupDefForAllMembers(), transferFunctionDocumentation(), transferFunctionReferences(), transferRelatedFunctionDocumentation(), vhdlCorrectMemberProperties(), MemberDefImpl::writeDeclaration(), MemberList::writeDocumentation(), MemberList::writeDocumentationPage(), MemberDefImpl::writeEnumDeclaration(), MemberList::writePlainDeclarations(), VhdlDocGen::writePlainVHDLDeclarations(), MemberList::writeSimpleDocumentation() , 以及 MemberList::writeTagFile().

◆ transferArgumentDocumentation()

static void transferArgumentDocumentation ( ArgumentList decAl,
ArgumentList defAl 
)
static

在文件 memberdef.cpp5788 行定义.

5789 {
5790  for (auto decIt = decAl.begin(), defIt = defAl.begin();
5791  decIt!= decAl.end() && defIt!= defAl.end();
5792  ++decIt, ++defIt)
5793  {
5794  Argument &decA = *decIt;
5795  Argument &defA = *defIt;
5796  if (decA.docs.isEmpty() && !defA.docs.isEmpty())
5797  {
5798  decA.docs = defA.docs;
5799  }
5800  else if (defA.docs.isEmpty() && !decA.docs.isEmpty())
5801  {
5802  defA.docs = decA.docs;
5803  }
5804  if (Config_getBool(RESOLVE_UNNAMED_PARAMS))
5805  {
5806  if (decA.name.isEmpty() && !defA.name.isEmpty())
5807  {
5808  decA.name = defA.name;
5809  }
5810  else if (defA.name.isEmpty() && !decA.name.isEmpty())
5811  {
5812  defA.name = decA.name;
5813  }
5814  }
5815  }
5816 }

引用了 ArgumentList::begin(), Config_getBool, Argument::docs, ArgumentList::end(), QCString::isEmpty() , 以及 Argument::name.

被这些函数引用 combineDeclarationAndDefinition().

◆ writeDefArgumentList()

static bool writeDefArgumentList ( OutputList ol,
const Definition scope,
const MemberDef md 
)
static

在文件 memberdef.cpp857 行定义.

858 {
859  const ArgumentList &defArgList=(md->isDocsForDefinition()) ?
860  md->argumentList() : md->declArgumentList();
861  //printf("writeDefArgumentList '%s' isDocsForDefinition()=%d\n",qPrint(md->name()),md->isDocsForDefinition());
862  if (!defArgList.hasParameters() || md->isProperty() || md->isTypedef())
863  {
864  return FALSE; // member has no function like argument list
865  }
866 
867  if (!md->isDefine()) ol.docify(" ");
868 
869  //printf("writeDefArgList(%d)\n",defArgList->count());
870  ol.pushGeneratorState();
871  //ol.disableAllBut(OutputGenerator::Html);
872  bool htmlOn = ol.isEnabled(OutputGenerator::Html);
873  bool latexOn = ol.isEnabled(OutputGenerator::Latex);
874  bool docbookOn = ol.isEnabled(OutputGenerator::Docbook);
875  {
876  // html and latex
877  if (htmlOn) ol.enable(OutputGenerator::Html);
878  if (latexOn) ol.enable(OutputGenerator::Latex);
879  if (docbookOn) ol.enable(OutputGenerator::Docbook);
880 
881  ol.endMemberDocName();
882  ol.startParameterList(!md->isObjCMethod());
883  }
884  ol.enableAll();
888  {
889  // other formats
890  if (!md->isObjCMethod()) ol.docify("("); // start argument list
891  ol.endMemberDocName();
892  }
893  ol.popGeneratorState();
894  //printf("===> name=%s isDefine=%d\n",qPrint(md->name()),md->isDefine());
895 
896  QCString cName;
897  if (scope)
898  {
899  cName=scope->name();
900  int il=cName.find('<');
901  int ir=cName.findRev('>');
902  if (il!=-1 && ir!=-1 && ir>il)
903  {
904  cName=cName.mid(il,ir-il+1);
905  //printf("1. cName=%s\n",qPrint(cName));
906  }
907  else if (scope->definitionType()==Definition::TypeClass)
908  {
909  cName=tempArgListToString((toClassDef(scope))->templateArguments(),
910  scope->getLanguage());
911  //printf("2. cName=%s\n",qPrint(cName));
912  }
913  else // no template specifier
914  {
915  cName.resize(0);
916  }
917  }
918  //printf("~~~ %s cName=%s\n",qPrint(md->name()),qPrint(cName));
919 
920  bool first=TRUE;
921  bool paramTypeStarted=FALSE;
922  bool isDefine = md->isDefine();
923  auto alIt = defArgList.begin();
924  while (alIt!=defArgList.end())
925  {
926  Argument a = *alIt;
927  if (isDefine || first)
928  {
929  ol.startParameterType(first,QCString());
930  paramTypeStarted=TRUE;
931  if (isDefine)
932  {
933  ol.endParameterType();
935  }
936  }
937 
938  if (!a.attrib.isEmpty() && !md->isObjCMethod()) // argument has an IDL attribute
939  {
940  ol.docify(a.attrib+" ");
941  }
942 
943  {
944  QCString n=a.type;
945  if (md->isObjCMethod()) { n.prepend("("); n.append(")"); }
946  if (a.type!="...")
947  {
948  if (!cName.isEmpty()) n=addTemplateNames(n,scope->name(),cName);
949  linkifyText(TextGeneratorOLImpl(ol),scope,md->getBodyDef(),md,n);
950  }
951  }
952 
953  if (!isDefine)
954  {
955  if (paramTypeStarted)
956  {
957  ol.endParameterType();
958  paramTypeStarted=FALSE;
959  }
960  ol.startParameterName(defArgList.size()<2);
961  }
962  if (!a.name.isEmpty() || a.type=="...") // argument has a name
963  {
967  ol.docify(" "); /* man page */
968  if (htmlOn) ol.enable(OutputGenerator::Html);
970  ol.startEmphasis();
972  if (latexOn) ol.enable(OutputGenerator::Latex);
973  if (docbookOn) ol.enable(OutputGenerator::Docbook);
974  if (a.name.isEmpty()) ol.docify(a.type); else ol.docify(a.name);
978  ol.endEmphasis();
980  if (latexOn) ol.enable(OutputGenerator::Latex);
981  if (docbookOn) ol.enable(OutputGenerator::Docbook);
982  }
983  if (!a.array.isEmpty())
984  {
985  ol.docify(a.array);
986  }
987  if (!a.defval.isEmpty()) // write the default value
988  {
989  QCString n=a.defval;
990  if (!cName.isEmpty()) n=addTemplateNames(n,scope->name(),cName);
991  ol.docify(" = ");
992 
993  ol.startTypewriter();
995  ol.endTypewriter();
996 
997  }
998  ++alIt;
999  if (alIt!=defArgList.end())
1000  {
1001  a = *alIt;
1002  if (!md->isObjCMethod()) ol.docify(", "); // there are more arguments
1003  if (!isDefine)
1004  {
1005  QCString key;
1006  if (md->isObjCMethod() && a.attrib.length()>=2)
1007  {
1008  //printf("Found parameter keyword %s\n",a.qPrint(attrib));
1009  // strip [ and ]
1010  key=a.attrib.mid(1,a.attrib.length()-2);
1011  if (key!=",") key+=":"; // for normal keywords add colon
1012  }
1014  if (paramTypeStarted)
1015  {
1016  ol.endParameterType();
1017  }
1018  ol.startParameterType(FALSE,key);
1019  paramTypeStarted=TRUE;
1020  }
1021  else // isDefine
1022  {
1024  }
1025  }
1026  first=FALSE;
1027  }
1028  ol.pushGeneratorState();
1032  if (!md->isObjCMethod()) ol.docify(")"); // end argument list
1033  ol.enableAll();
1034  if (htmlOn) ol.enable(OutputGenerator::Html);
1035  if (latexOn) ol.enable(OutputGenerator::Latex);
1036  if (docbookOn) ol.enable(OutputGenerator::Docbook);
1037  if (first) ol.startParameterName(defArgList.size()<2);
1038  ol.endParameterName(TRUE,defArgList.size()<2,!md->isObjCMethod());
1039  ol.popGeneratorState();
1040  if (!md->extraTypeChars().isEmpty())
1041  {
1042  ol.docify(md->extraTypeChars());
1043  }
1044  if (defArgList.constSpecifier())
1045  {
1046  ol.docify(" const");
1047  }
1048  if (defArgList.volatileSpecifier())
1049  {
1050  ol.docify(" volatile");
1051  }
1052  if (defArgList.refQualifier()==RefQualifierLValue)
1053  {
1054  ol.docify(" &");
1055  }
1056  else if (defArgList.refQualifier()==RefQualifierRValue)
1057  {
1058  ol.docify(" &&");
1059  }
1060  if (!defArgList.trailingReturnType().isEmpty())
1061  {
1062  linkifyText(TextGeneratorOLImpl(ol), // out
1063  scope, // scope
1064  md->getBodyDef(), // fileScope
1065  md, // self
1066  defArgList.trailingReturnType(), // text
1067  FALSE // autoBreak
1068  );
1069 
1070  }
1071  return TRUE;
1072 }

引用了 addTemplateNames(), QCString::append(), MemberDef::argumentList(), Argument::array, Argument::attrib, ArgumentList::begin(), ArgumentList::constSpecifier(), MemberDef::declArgumentList(), Definition::definitionType(), Argument::defval, OutputList::disable(), OutputGenerator::Docbook, OutputList::docify(), OutputList::enable(), OutputList::enableAll(), ArgumentList::end(), OutputList::endEmphasis(), OutputList::endMemberDocName(), OutputList::endParameterName(), OutputList::endParameterType(), OutputList::endTypewriter(), MemberDef::extraTypeChars(), FALSE, QCString::find(), QCString::findRev(), Definition::getBodyDef(), Definition::getLanguage(), ArgumentList::hasParameters(), OutputGenerator::Html, MemberDef::isDefine(), MemberDef::isDocsForDefinition(), QCString::isEmpty(), OutputList::isEnabled(), MemberDef::isObjCMethod(), MemberDef::isProperty(), MemberDef::isTypedef(), OutputGenerator::Latex, QCString::length(), linkifyText(), OutputGenerator::Man, QCString::mid(), Argument::name, Definition::name(), OutputList::popGeneratorState(), QCString::prepend(), OutputList::pushGeneratorState(), ArgumentList::refQualifier(), RefQualifierLValue, RefQualifierRValue, QCString::resize(), ArgumentList::size(), OutputList::startEmphasis(), OutputList::startParameterList(), OutputList::startParameterName(), OutputList::startParameterType(), OutputList::startTypewriter(), tempArgListToString(), toClassDef(), ArgumentList::trailingReturnType(), TRUE, Argument::type, Definition::TypeClass , 以及 ArgumentList::volatileSpecifier().

被这些函数引用 MemberDefImpl::writeDocumentation().

◆ writeExceptionList()

static void writeExceptionList ( OutputList ol,
const ClassDef cd,
const MemberDef md 
)
static

在文件 memberdef.cpp1113 行定义.

1114 {
1115  QCString exception(QCString(md->excpString()).stripWhiteSpace());
1116  if ('{'==exception.at(0))
1117  {
1118  // this is an UNO IDL attribute - need special handling
1119  int index = exception.find(';');
1120  int oldIndex = 1;
1121  while (-1 != index) // there should be no more than 2 (set / get)
1122  {
1123  // omit '{' and ';' -> "set raises (...)"
1124  writeExceptionListImpl(ol,cd,md,exception.mid(oldIndex,index-oldIndex));
1125  oldIndex=index+1;
1126  index = exception.find(';',oldIndex);
1127  }
1128  // the rest is now just '}' - omit that
1129  }
1130  else
1131  {
1132  writeExceptionListImpl(ol,cd,md,exception);
1133  }
1134 }

引用了 QCString::at(), MemberDef::excpString(), QCString::find(), QCString::mid(), QCString::stripWhiteSpace() , 以及 writeExceptionListImpl().

被这些函数引用 MemberDefImpl::writeDocumentation().

◆ writeExceptionListImpl()

static void writeExceptionListImpl ( OutputList ol,
const ClassDef cd,
const MemberDef md,
QCString const &  exception 
)
static

在文件 memberdef.cpp1074 行定义.

1076 {
1077  // this is ordinary exception spec - there must be a '('
1078  //printf("exception='%s'\n",qPrint(exception));
1079  int index = exception.find('(');
1080  if (index!=-1)
1081  {
1082  ol.exceptionEntry(exception.left(index),false);
1083  ++index; // paren in second column so skip it here
1084  for (int comma = exception.find(',', index); comma!=-1; )
1085  {
1086  ++comma; // include comma
1087  linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(),md,
1088  exception.mid(index,comma-index));
1089  ol.exceptionEntry(QCString(),false);
1090  index=comma;
1091  comma = exception.find(',', index);
1092  }
1093  int close = exception.find(')', index);
1094  if (close!=-1)
1095  {
1096  QCString type=removeRedundantWhiteSpace(exception.mid(index,close-index));
1097  linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(),md,type);
1098  ol.exceptionEntry(QCString(),true);
1099  }
1100  else
1101  {
1102  warn(md->getDefFileName(),md->getDefLine(),
1103  "missing ) in exception list on member %s",qPrint(md->name()));
1104  }
1105  }
1106  else // Java Exception
1107  {
1108  ol.docify(" ");
1109  linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(),md,exception);
1110  }
1111 }

引用了 OutputList::docify(), OutputList::exceptionEntry(), QCString::find(), Definition::getBodyDef(), Definition::getDefFileName(), Definition::getDefLine(), QCString::left(), linkifyText(), QCString::mid(), Definition::name(), qPrint(), removeRedundantWhiteSpace() , 以及 warn().

被这些函数引用 writeExceptionList().

变量说明

◆ g_cachedAnonymousTypeMutex

std::mutex g_cachedAnonymousTypeMutex
static

在文件 memberdef.cpp1822 行定义.

被这些函数引用 MemberDefImpl::getClassDefOfAnonymousType().

◆ reAnonymous

const reg::Ex reAnonymous(R"([\w:@]*@\d+)")
static
toDefinition
Definition * toDefinition(DefinitionMutable *dm)
Definition: definition.cpp:1950
OutputList::startParameterType
void startParameterType(bool first, const QCString &key)
Definition: outputlist.h:423
ArgumentList::refQualifier
RefQualifierType refQualifier() const
Definition: arguments.h:109
DefinitionMutable::addSourceReferences
virtual void addSourceReferences(const MemberDef *d)=0
ArgumentList::trailingReturnType
QCString trailingReturnType() const
Definition: arguments.h:107
OutputList::startParameterName
void startParameterName(bool one)
Definition: outputlist.h:427
MemberDef::isTypedef
virtual bool isTypedef() const =0
Definition::docLine
virtual int docLine() const =0
MemberDefMutable::mergeMemberSpecifiers
virtual void mergeMemberSpecifiers(uint64 s)=0
toMemberDefMutable
MemberDefMutable * toMemberDefMutable(Definition *d)
Definition: memberdef.cpp:6125
MemberDef::hasReferencedByRelation
virtual bool hasReferencedByRelation() const =0
MemberDef::argsString
virtual QCString argsString() const =0
MemberDef::briefDescription
virtual QCString briefDescription(bool abbr=FALSE) const =0
Definition
The common base class of all entity definitions found in the sources.
Definition: definition.h:76
MemberDef::documentation
virtual QCString documentation() const =0
writeExceptionListImpl
static void writeExceptionListImpl(OutputList &ol, const ClassDef *cd, const MemberDef *md, QCString const &exception)
Definition: memberdef.cpp:1074
MemberDef::isStatic
virtual bool isStatic() const =0
OutputList::docify
void docify(const QCString &s)
Definition: outputlist.h:137
MemberDef::getGroupPri
virtual Grouping::GroupPri_t getGroupPri() const =0
QCString::length
uint length() const
Returns the length of the string, not counting the 0-terminator.
Definition: qcstring.h:147
DefinitionMutable::mergeRefItems
virtual void mergeRefItems(Definition *d)=0
ArgumentList
This class represents an function or template argument list.
Definition: arguments.h:59
Definition::getDefLine
virtual int getDefLine() const =0
QCString::findRev
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition: qcstring.cpp:86
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
reg::match
bool match(const std::string &str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition: regex.cpp:729
TextGeneratorOLImpl
Implements TextGeneratorIntf for an OutputDocInterface stream.
Definition: util.h:72
MemberDef::isPrototype
virtual bool isPrototype() const =0
QCString::str
std::string str() const
Definition: qcstring.h:442
RefQualifierRValue
@ RefQualifierRValue
Definition: arguments.h:50
OutputList::endParameterName
void endParameterName(bool last, bool one, bool bracket)
Definition: outputlist.h:429
Definition::inbodyLine
virtual int inbodyLine() const =0
MemberDefMutable::setDocsForDefinition
virtual void setDocsForDefinition(bool b)=0
QCString::at
char & at(size_t i)
Returns a reference to the character at index i.
Definition: qcstring.h:477
QCString::find
int find(char c, int index=0, bool cs=TRUE) const
Definition: qcstring.cpp:38
Definition::briefLine
virtual int briefLine() const =0
MemberDefMutable::setBriefDescription
virtual void setBriefDescription(const QCString &b, const QCString &briefFile, int briefLine)=0
MemberDefMutable
Definition: memberdef.h:296
transferArgumentDocumentation
static void transferArgumentDocumentation(ArgumentList &decAl, ArgumentList &defAl)
Definition: memberdef.cpp:5788
ArgumentList::volatileSpecifier
bool volatileSpecifier() const
Definition: arguments.h:105
OutputList::endTypewriter
void endTypewriter()
Definition: outputlist.h:167
MemberDef::isProperty
virtual bool isProperty() const =0
ArgumentList::end
iterator end()
Definition: arguments.h:87
Definition::docFile
virtual QCString docFile() const =0
warn
void warn(const QCString &file, int line, const char *fmt,...)
Definition: message.cpp:151
Definition::getLanguage
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
ArgumentList::begin
iterator begin()
Definition: arguments.h:86
MemberDef::showInCallGraph
virtual bool showInCallGraph() const =0
ArgumentList::hasParameters
bool hasParameters() const
Definition: arguments.h:69
MemberDef::isObjCMethod
virtual bool isObjCMethod() const =0
OutputList::startTypewriter
void startTypewriter()
Definition: outputlist.h:165
DefinitionMutable::setBodyDef
virtual void setBodyDef(const FileDef *fd)=0
Argument::type
QCString type
Definition: arguments.h:50
uint
unsigned uint
Definition: qcstring.h:40
MemberDefImpl
Definition: memberdef.cpp:51
Definition::getBodyDef
virtual const FileDef * getBodyDef() const =0
MemberDef::memberDeclaration
virtual MemberDef * memberDeclaration() const =0
MemberDef
A model of a class/file/namespace member symbol.
Definition: memberdef.h:45
OutputGenerator::Latex
@ Latex
Definition: outputgen.h:333
MemberDef::hasCallerGraph
virtual bool hasCallerGraph() const =0
MemberDefMutable::setMemberDefinition
virtual void setMemberDefinition(MemberDef *md)=0
OutputList::startParameterList
void startParameterList(bool openBracket)
Definition: outputlist.h:431
Argument::array
QCString array
Definition: arguments.h:53
QCString::stripWhiteSpace
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition: qcstring.h:243
RefQualifierLValue
@ RefQualifierLValue
Definition: arguments.h:49
OutputList::disable
void disable(OutputGenerator::OutputType o)
Definition: outputlist.cpp:100
isId
bool isId(int c)
Definition: util.h:172
OutputList::exceptionEntry
void exceptionEntry(const QCString &prefix, bool closeBracket)
Definition: outputlist.h:435
QCString::left
QCString left(size_t len) const
Definition: qcstring.h:212
MemberDef::excpString
virtual QCString excpString() const =0
MemberDef::isDefine
virtual bool isDefine() const =0
MemberDef::isVariable
virtual bool isVariable() const =0
removeRedundantWhiteSpace
QCString removeRedundantWhiteSpace(const QCString &s)
Definition: util.cpp:544
Definition::inbodyDocumentation
virtual QCString inbodyDocumentation() const =0
MemberDefMutable::setMemberDeclaration
virtual void setMemberDeclaration(MemberDef *md)=0
Definition::name
virtual QCString name() const =0
Definition::inbodyFile
virtual QCString inbodyFile() const =0
Argument
This class contains the information about the argument of a function or template
Definition: arguments.h:26
MemberDefMutable::setInbodyDocumentation
virtual void setInbodyDocumentation(const QCString &d, const QCString &inbodyFile, int inbodyLine)=0
MemberDef::hasDocumentation
virtual bool hasDocumentation() const =0
MemberDefMutable::enableReferencesRelation
virtual void enableReferencesRelation(bool e)=0
MemberDef::isFunction
virtual bool isFunction() const =0
MemberDefMutable::setGroupDef
virtual void setGroupDef(const GroupDef *gd, Grouping::GroupPri_t pri, const QCString &fileName, int startLine, bool hasDocs, MemberDef *member=0)=0
OutputList::endMemberDocName
void endMemberDocName()
Definition: outputlist.h:421
addTemplateNames
static QCString addTemplateNames(const QCString &s, const QCString &n, const QCString &t)
Definition: memberdef.cpp:790
reg::Match
Object representing the matching results.
Definition: regex.h:163
linkifyText
void linkifyText(const TextGeneratorIntf &out, const Definition *scope, const FileDef *fileScope, const Definition *self, const QCString &text, bool autoBreak, bool external, bool keepSpaces, int indentLevel)
Definition: util.cpp:886
TRUE
#define TRUE
Definition: qcstring.h:36
Definition::getStartBodyLine
virtual int getStartBodyLine() const =0
Definition::getEndBodyLine
virtual int getEndBodyLine() const =0
tempArgListToString
QCString tempArgListToString(const ArgumentList &al, SrcLangExt lang, bool includeDefault)
Definition: util.cpp:1194
Argument::attrib
QCString attrib
Definition: arguments.h:49
ArgumentList::constSpecifier
bool constSpecifier() const
Definition: arguments.h:104
OutputGenerator::Html
@ Html
Definition: outputgen.h:333
toClassDef
ClassDef * toClassDef(Definition *d)
Definition: classdef.cpp:4907
OutputList::enableAll
void enableAll()
Definition: outputlist.cpp:84
OutputList::isEnabled
bool isEnabled(OutputGenerator::OutputType o)
Definition: outputlist.cpp:116
Definition::TypeClass
@ TypeClass
Definition: definition.h:87
Definition::definitionType
virtual DefType definitionType() const =0
MemberDef::memberDefinition
virtual MemberDef * memberDefinition() const =0
OutputList::popGeneratorState
void popGeneratorState()
Definition: outputlist.cpp:134
Definition::briefFile
virtual QCString briefFile() const =0
DefinitionMutable::addSourceReferencedBy
virtual void addSourceReferencedBy(const MemberDef *d)=0
OutputGenerator::Docbook
@ Docbook
Definition: outputgen.h:333
OutputList::startEmphasis
void startEmphasis()
Definition: outputlist.h:252
ArgumentList::size
size_t size() const
Definition: arguments.h:93
MemberDef::getMemberSpecifiers
virtual uint64 getMemberSpecifiers() const =0
QCString::mid
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition: qcstring.h:224
Argument::defval
QCString defval
Definition: arguments.h:54
MemberDefMutable::enableReferencedByRelation
virtual void enableReferencedByRelation(bool e)=0
MemberDefMutable::enableCallGraph
virtual void enableCallGraph(bool e)=0
Config_getBool
#define Config_getBool(name)
Definition: config.h:33
QCString::append
QCString & append(char c)
Definition: qcstring.h:318
MemberDefMutable::moveDeclArgumentList
virtual void moveDeclArgumentList(std::unique_ptr< ArgumentList > al)=0
MemberDefAliasImpl
Definition: memberdef.cpp:385
MemberDef::isDocsForDefinition
virtual bool isDocsForDefinition() const =0
reg::Ex
Class representing a regular expression.
Definition: regex.h:48
MemberDefMutable::setDocumentation
virtual void setDocumentation(const QCString &d, const QCString &docFile, int docLine, bool stripWhiteSpace=TRUE)=0
MemberDef::isEnumerate
virtual bool isEnumerate() const =0
MemberDef::isExternal
virtual bool isExternal() const =0
MemberDef::declArgumentList
virtual const ArgumentList & declArgumentList() const =0
Definition::getOuterScope
virtual Definition * getOuterScope() const =0
QCString::startsWith
bool startsWith(const char *s) const
Definition: qcstring.h:408
Argument::docs
QCString docs
Definition: arguments.h:55
qPrint
const char * qPrint(const char *s)
Definition: qcstring.h:589
MemberDef::getFileDef
virtual const FileDef * getFileDef() const =0
DefinitionMutable::setBodySegment
virtual void setBodySegment(int defLine, int bls, int ble)=0
Definition::getDefFileName
virtual QCString getDefFileName() const =0
MemberDef::hasCallGraph
virtual bool hasCallGraph() const =0
Argument::name
QCString name
Definition: arguments.h:52
MemberDef::argumentList
virtual const ArgumentList & argumentList() const =0
OutputList::endEmphasis
void endEmphasis()
Definition: outputlist.h:254
removeAnonymousScopes
QCString removeAnonymousScopes(const QCString &str)
Definition: util.cpp:166
MemberDef::extraTypeChars
virtual QCString extraTypeChars() const =0
OutputList::pushGeneratorState
void pushGeneratorState()
Definition: outputlist.cpp:126
MemberDefMutable::resolveUnnamedParameters
virtual void resolveUnnamedParameters(const MemberDef *md)=0
MemberDefMutable::moveArgumentList
virtual void moveArgumentList(std::unique_ptr< ArgumentList > al)=0
OutputList::endParameterType
void endParameterType()
Definition: outputlist.h:425
reg::search
bool search(const std::string &str, Match &match, const Ex &re, size_t pos)
Search in a given string str starting at position pos for a match against regular expression re.
Definition: regex.cpp:718
MemberDef::hasReferencesRelation
virtual bool hasReferencesRelation() const =0
MemberDefMutable::enableCallerGraph
virtual void enableCallerGraph(bool e)=0
OutputList::enable
void enable(OutputGenerator::OutputType o)
Definition: outputlist.cpp:108
stringToArgumentList
std::unique_ptr< ArgumentList > stringToArgumentList(SrcLangExt lang, const QCString &argsString, QCString *extraTypeChars=0)
matchArguments2
bool matchArguments2(const Definition *srcScope, const FileDef *srcFileScope, const ArgumentList *srcAl, const Definition *dstScope, const FileDef *dstFileScope, const ArgumentList *dstAl, bool checkCV)
Definition: util.cpp:1919
QCString::right
QCString right(size_t len) const
Definition: qcstring.h:217
QCString::prepend
QCString & prepend(const char *s)
Definition: qcstring.h:339
QCString::resize
bool resize(size_t newlen)
Resizes the string to hold newlen characters (this value should also count the 0-terminator).
Definition: qcstring.h:164
MemberDef::getGroupDef
virtual const GroupDef * getGroupDef() const =0
FALSE
#define FALSE
Definition: qcstring.h:33
OutputGenerator::Man
@ Man
Definition: outputgen.h:333
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108