My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 4960 of file memberdef.cpp.

References MemberDef::argsString(), MemberDef::argumentList(), MemberDef::briefDescription(), Definition::briefFile(), Definition::briefLine(), Definition::docFile(), Definition::docLine(), MemberDef::documentation(), MemberDef::enableCallerGraph(), MemberDef::enableCallGraph(), Definition::getBodyDef(), Definition::getEndBodyLine(), MemberDef::getFileDef(), MemberDef::getGroupDef(), MemberDef::getGroupPri(), MemberDef::getMemberSpecifiers(), Definition::getOuterScope(), Definition::getStartBodyLine(), MemberDef::hasCallerGraph(), MemberDef::hasCallGraph(), MemberDef::hasDocumentation(), Definition::inbodyDocumentation(), Definition::inbodyFile(), Definition::inbodyLine(), MemberDef::isDocsForDefinition(), MemberDef::isExternal(), MemberDef::isFunction(), MemberDef::isPrototype(), MemberDef::isStatic(), MemberDef::isVariable(), matchArguments2(), MemberDef::mergeMemberSpecifiers(), Definition::mergeRefItems(), MemberDef::setArgumentList(), Definition::setBodyDef(), Definition::setBodySegment(), MemberDef::setBriefDescription(), MemberDef::setDeclArgumentList(), MemberDef::setDocsForDefinition(), MemberDef::setDocumentation(), MemberDef::setGroupDef(), MemberDef::setInbodyDocumentation(), MemberDef::setMemberDeclaration(), MemberDef::setMemberDefinition(), stringToArgumentList(), and transferArgumentDocumentation().

Referenced by ClassDef::mergeCategory(), and transferFunctionDocumentation().

{
//printf("mdec=%s isPrototype()=%d\n",mdec->name().data(),mdec->isPrototype());
if (
(mdef->isFunction() && !mdef->isStatic() && !mdef->isPrototype()) ||
(mdef->isVariable() && !mdef->isExternal() && !mdef->isStatic())
)
{
//printf("mdef=(%p,%s) mdec=(%p,%s)\n",
// mdef, mdef ? mdef->name().data() : "",
// mdec, mdec ? mdec->name().data() : "");
ArgumentList *mdefAl = mdef->argumentList();
ArgumentList *mdecAl = mdec->argumentList();
if (matchArguments2(mdef->getOuterScope(),mdef->getFileDef(),mdefAl,
mdec->getOuterScope(),mdec->getFileDef(),mdecAl,
TRUE
)
) /* match found */
{
//printf("Found member %s: definition in %s (doc=`%s') and declaration in %s (doc=`%s')\n",
// mn->memberName(),
// mdef->getFileDef()->name().data(),mdef->documentation().data(),
// mdec->getFileDef()->name().data(),mdec->documentation().data()
// );
// first merge argument documentation
/* copy documentation between function definition and declaration */
if (!mdec->briefDescription().isEmpty())
{
mdef->setBriefDescription(mdec->briefDescription(),mdec->briefFile(),mdec->briefLine());
}
else if (!mdef->briefDescription().isEmpty())
{
mdec->setBriefDescription(mdef->briefDescription(),mdef->briefFile(),mdef->briefLine());
}
if (!mdef->documentation().isEmpty())
{
//printf("transferring docs mdef->mdec (%s->%s)\n",mdef->argsString(),mdec->argsString());
mdec->setDocumentation(mdef->documentation(),mdef->docFile(),mdef->docLine());
if (mdefAl!=0)
{
ArgumentList *mdefAlComb = new ArgumentList;
stringToArgumentList(mdef->argsString(),mdefAlComb);
transferArgumentDocumentation(mdefAl,mdefAlComb);
mdec->setArgumentList(mdefAlComb);
}
}
else if (!mdec->documentation().isEmpty())
{
//printf("transferring docs mdec->mdef (%s->%s)\n",mdec->argsString(),mdef->argsString());
mdef->setDocumentation(mdec->documentation(),mdec->docFile(),mdec->docLine());
if (mdecAl!=0)
{
ArgumentList *mdecAlComb = new ArgumentList;
stringToArgumentList(mdec->argsString(),mdecAlComb);
transferArgumentDocumentation(mdecAl,mdecAlComb);
mdef->setDeclArgumentList(mdecAlComb);
}
}
if (!mdef->inbodyDocumentation().isEmpty())
{
}
else if (!mdec->inbodyDocumentation().isEmpty())
{
}
if (mdec->getStartBodyLine()!=-1 && mdef->getStartBodyLine()==-1)
{
//printf("body mdec->mdef %d-%d\n",mdec->getStartBodyLine(),mdef->getEndBodyLine());
mdef->setBodyDef(mdec->getBodyDef());
//mdef->setBodyMember(mdec);
}
else if (mdef->getStartBodyLine()!=-1 && mdec->getStartBodyLine()==-1)
{
//printf("body mdef->mdec %d-%d\n",mdef->getStartBodyLine(),mdec->getEndBodyLine());
mdec->setBodyDef(mdef->getBodyDef());
//mdec->setBodyMember(mdef);
}
// copy group info.
if (mdec->getGroupDef()==0 && mdef->getGroupDef()!=0)
{
mdec->setGroupDef(mdef->getGroupDef(),
mdef->getGroupPri(),
mdef->docFile(),
mdef->docLine(),
mdef
);
}
else if (mdef->getGroupDef()==0 && mdec->getGroupDef()!=0)
{
mdef->setGroupDef(mdec->getGroupDef(),
mdec->getGroupPri(),
mdec->docFile(),
mdec->docLine(),
mdec
);
}
mdec->mergeRefItems(mdef);
mdef->mergeRefItems(mdec);
mdef->setMemberDeclaration(mdec);
mdec->setMemberDefinition(mdef);
mdef->enableCallGraph(mdec->hasCallGraph() || mdef->hasCallGraph());
mdef->enableCallerGraph(mdec->hasCallerGraph() || mdef->hasCallerGraph());
mdec->enableCallGraph(mdec->hasCallGraph() || mdef->hasCallGraph());
mdec->enableCallerGraph(mdec->hasCallerGraph() || mdef->hasCallerGraph());
}
}
}