Classes | Functions
memberdef.h File Reference
#include <qlist.h>
#include <sys/types.h>
#include "types.h"
#include "definition.h"

Go to the source code of this file.

Classes

class  MemberDef
 

Functions

void combineDeclarationAndDefinition (MemberDef *mdec, MemberDef *mdef)
 

Function Documentation

void combineDeclarationAndDefinition ( MemberDef mdec,
MemberDef mdef 
)

Definition at line 4946 of file memberdef.cpp.

4947 {
4948  //printf("mdec=%s isPrototype()=%d\n",mdec->name().data(),mdec->isPrototype());
4949  if (
4950  (mdef->isFunction() && !mdef->isStatic() && !mdef->isPrototype()) ||
4951  (mdef->isVariable() && !mdef->isExternal() && !mdef->isStatic())
4952  )
4953  {
4954  //printf("mdef=(%p,%s) mdec=(%p,%s)\n",
4955  // mdef, mdef ? mdef->name().data() : "",
4956  // mdec, mdec ? mdec->name().data() : "");
4957 
4958  ArgumentList *mdefAl = mdef->argumentList();
4959  ArgumentList *mdecAl = mdec->argumentList();
4960  if (matchArguments2(mdef->getOuterScope(),mdef->getFileDef(),mdefAl,
4961  mdec->getOuterScope(),mdec->getFileDef(),mdecAl,
4962  TRUE
4963  )
4964  ) /* match found */
4965  {
4966  //printf("Found member %s: definition in %s (doc=`%s') and declaration in %s (doc=`%s')\n",
4967  // mn->memberName(),
4968  // mdef->getFileDef()->name().data(),mdef->documentation().data(),
4969  // mdec->getFileDef()->name().data(),mdec->documentation().data()
4970  // );
4971 
4972  // first merge argument documentation
4973  transferArgumentDocumentation(mdecAl,mdefAl);
4974 
4975  /* copy documentation between function definition and declaration */
4976  if (!mdec->briefDescription().isEmpty())
4977  {
4978  mdef->setBriefDescription(mdec->briefDescription(),mdec->briefFile(),mdec->briefLine());
4979  }
4980  else if (!mdef->briefDescription().isEmpty())
4981  {
4982  mdec->setBriefDescription(mdef->briefDescription(),mdef->briefFile(),mdef->briefLine());
4983  }
4984  if (!mdef->documentation().isEmpty())
4985  {
4986  //printf("transferring docs mdef->mdec (%s->%s)\n",mdef->argsString(),mdec->argsString());
4987  mdec->setDocumentation(mdef->documentation(),mdef->docFile(),mdef->docLine());
4989  if (mdefAl!=0)
4990  {
4991  ArgumentList *mdefAlComb = new ArgumentList;
4992  stringToArgumentList(mdef->argsString(),mdefAlComb);
4993  transferArgumentDocumentation(mdefAl,mdefAlComb);
4994  mdec->setArgumentList(mdefAlComb);
4995  }
4996  }
4997  else if (!mdec->documentation().isEmpty())
4998  {
4999  //printf("transferring docs mdec->mdef (%s->%s)\n",mdec->argsString(),mdef->argsString());
5000  mdef->setDocumentation(mdec->documentation(),mdec->docFile(),mdec->docLine());
5002  if (mdecAl!=0)
5003  {
5004  ArgumentList *mdecAlComb = new ArgumentList;
5005  stringToArgumentList(mdec->argsString(),mdecAlComb);
5006  transferArgumentDocumentation(mdecAl,mdecAlComb);
5007  mdef->setDeclArgumentList(mdecAlComb);
5008  }
5009  }
5010  if (!mdef->inbodyDocumentation().isEmpty())
5011  {
5012  mdec->setInbodyDocumentation(mdef->inbodyDocumentation(),mdef->inbodyFile(),mdef->inbodyLine());
5013  }
5014  else if (!mdec->inbodyDocumentation().isEmpty())
5015  {
5016  mdef->setInbodyDocumentation(mdec->inbodyDocumentation(),mdec->inbodyFile(),mdec->inbodyLine());
5017  }
5018  if (mdec->getStartBodyLine()!=-1 && mdef->getStartBodyLine()==-1)
5019  {
5020  //printf("body mdec->mdef %d-%d\n",mdec->getStartBodyLine(),mdef->getEndBodyLine());
5021  mdef->setBodySegment(mdec->getStartBodyLine(),mdec->getEndBodyLine());
5022  mdef->setBodyDef(mdec->getBodyDef());
5023  //mdef->setBodyMember(mdec);
5024  }
5025  else if (mdef->getStartBodyLine()!=-1 && mdec->getStartBodyLine()==-1)
5026  {
5027  //printf("body mdef->mdec %d-%d\n",mdef->getStartBodyLine(),mdec->getEndBodyLine());
5028  mdec->setBodySegment(mdef->getStartBodyLine(),mdef->getEndBodyLine());
5029  mdec->setBodyDef(mdef->getBodyDef());
5030  //mdec->setBodyMember(mdef);
5031  }
5034 
5035 
5036  // copy group info.
5037  if (mdec->getGroupDef()==0 && mdef->getGroupDef()!=0)
5038  {
5039  mdec->setGroupDef(mdef->getGroupDef(),
5040  mdef->getGroupPri(),
5041  mdef->docFile(),
5042  mdef->docLine(),
5043  mdef->hasDocumentation(),
5044  mdef
5045  );
5046  }
5047  else if (mdef->getGroupDef()==0 && mdec->getGroupDef()!=0)
5048  {
5049  mdef->setGroupDef(mdec->getGroupDef(),
5050  mdec->getGroupPri(),
5051  mdec->docFile(),
5052  mdec->docLine(),
5053  mdec->hasDocumentation(),
5054  mdec
5055  );
5056  }
5057 
5058 
5059  mdec->mergeRefItems(mdef);
5060  mdef->mergeRefItems(mdec);
5061 
5062  mdef->setMemberDeclaration(mdec);
5063  mdec->setMemberDefinition(mdef);
5064 
5065  mdef->enableCallGraph(mdec->hasCallGraph() || mdef->hasCallGraph());
5066  mdef->enableCallerGraph(mdec->hasCallerGraph() || mdef->hasCallerGraph());
5067  mdec->enableCallGraph(mdec->hasCallGraph() || mdef->hasCallGraph());
5068  mdec->enableCallerGraph(mdec->hasCallerGraph() || mdef->hasCallerGraph());
5069  }
5070  }
5071 }
void setArgumentList(ArgumentList *al)
Definition: memberdef.cpp:3876
QCString docFile() const
bool isDocsForDefinition() const
Definition: memberdef.cpp:4482
This class represents an function or template argument list.
Definition: arguments.h:82
bool matchArguments2(Definition *srcScope, FileDef *srcFileScope, ArgumentList *srcAl, Definition *dstScope, FileDef *dstFileScope, ArgumentList *dstAl, bool checkCV)
Definition: util.cpp:3647
void setMemberDefinition(MemberDef *md)
Definition: memberdef.cpp:4786
bool isEmpty() const
Definition: qcstring.h:189
bool hasDocumentation() const
Definition: memberdef.cpp:3274
Grouping::GroupPri_t getGroupPri() const
Definition: memberdef.cpp:4100
void setBodyDef(FileDef *fd)
bool isPrototype() const
Definition: memberdef.cpp:4507
QCString inbodyDocumentation() const
FileDef * getBodyDef() const
void enableCallGraph(bool e)
Definition: memberdef.cpp:3923
void enableCallerGraph(bool e)
Definition: memberdef.cpp:3929
int briefLine() const
bool isVariable() const
Definition: memberdef.cpp:4140
bool hasCallerGraph() const
Definition: memberdef.cpp:4562
bool hasCallGraph() const
Definition: memberdef.cpp:4557
void mergeMemberSpecifiers(uint64 s)
Definition: memberdef.cpp:4643
FileDef * getFileDef() const
Definition: memberdef.cpp:4075
QCString inbodyFile() const
void setDocumentation(const char *d, const char *docFile, int docLine, bool stripWhiteSpace=TRUE)
Definition: memberdef.cpp:1126
void setInbodyDocumentation(const char *d, const char *inbodyFile, int inbodyLine)
Definition: memberdef.cpp:1138
QCString briefDescription(bool abbr=FALSE) const
Definition: memberdef.cpp:5073
static void transferArgumentDocumentation(ArgumentList *decAl, ArgumentList *defAl)
Definition: memberdef.cpp:4919
void stringToArgumentList(const char *argsString, ArgumentList *al, QCString *extraTypeChars)
Definition: defargs.cpp:2922
QCString briefFile() const
uint64 getMemberSpecifiers() const
Definition: memberdef.cpp:4065
int inbodyLine() const
void setDocsForDefinition(bool b)
Definition: memberdef.cpp:4771
virtual Definition * getOuterScope() const
QCString documentation() const
Definition: memberdef.cpp:5085
int getEndBodyLine() const
GroupDef * getGroupDef() const
Definition: memberdef.cpp:4095
ArgumentList * argumentList() const
Definition: memberdef.cpp:4512
int getStartBodyLine() const
void setMemberDeclaration(MemberDef *md)
Definition: memberdef.cpp:4791
void mergeRefItems(Definition *d)
void setDeclArgumentList(ArgumentList *al)
Definition: memberdef.cpp:3882
bool isFunction() const
Definition: memberdef.cpp:4160
void setGroupDef(GroupDef *gd, Grouping::GroupPri_t pri, const QCString &fileName, int startLine, bool hasDocs, MemberDef *member=0)
Definition: memberdef.cpp:3363
int docLine() const
const char * argsString() const
Definition: memberdef.cpp:4040
bool isStatic() const
Definition: memberdef.cpp:4205
bool isExternal() const
Definition: memberdef.cpp:4438
void setBriefDescription(const char *b, const char *briefFile, int briefLine)
Definition: memberdef.cpp:1132
const bool TRUE
Definition: qglobal.h:371
void setBodySegment(int bls, int ble)