Doxygen
Loading...
Searching...
No Matches
memberdef.cpp File Reference
#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 "moduledef.h"
#include "filedef.h"
#include "config.h"
#include "definitionimpl.h"
#include "regex.h"
#include "trace.h"
+ Include dependency graph for memberdef.cpp:

Go to the source code of this file.

Classes

class  MemberDefImpl
 
class  MemberDefAliasImpl
 

Functions

std::unique_ptr< MemberDefcreateMemberDef (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.
 
std::unique_ptr< 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 combineArgsAndException (QCString args, QCString exception)
 
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 (const MemberDef *s, const MemberDef *d)
 
MemberDeftoMemberDef (Definition *d)
 
MemberDeftoMemberDef (DefinitionMutable *md)
 
const MemberDeftoMemberDef (const Definition *d)
 
MemberDefMutabletoMemberDefMutable (Definition *d)
 

Variables

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

Function Documentation

◆ addDocCrossReference()

void addDocCrossReference ( const MemberDef * s,
const MemberDef * d )

Definition at line 6386 of file memberdef.cpp.

6387{
6388 MemberDefMutable *src = toMemberDefMutable(const_cast<MemberDef*>(s));
6389 MemberDefMutable *dst = toMemberDefMutable(const_cast<MemberDef*>(d));
6390 if (src==nullptr || dst==nullptr) return;
6391 //printf("--> addDocCrossReference src=%s,dst=%s\n",qPrint(src->name()),qPrint(dst->name()));
6392 if (dst->isTypedef() || dst->isEnumerate()) return; // don't add types
6393 if ((dst->hasReferencedByRelation() || dst->hasCallerGraph()) &&
6394 src->isCallable()
6395 )
6396 {
6397 QCString sourceRefName = src->sourceRefName();
6400
6401 // ---- critical section
6402 std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
6403 dst->addSourceReferencedBy(src,sourceRefName);
6404 if (mdDef)
6405 {
6406 mdDef->addSourceReferencedBy(src,sourceRefName);
6407 }
6408 if (mdDecl)
6409 {
6410 mdDecl->addSourceReferencedBy(src,sourceRefName);
6411 }
6412 // ---- end critical section
6413 }
6414 if ((src->hasReferencesRelation() || src->hasCallGraph()) &&
6415 src->isCallable()
6416 )
6417 {
6418 QCString sourceRefName = dst->sourceRefName();
6421
6422 // ---- critical section
6423 std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
6424 src->addSourceReferences(dst,sourceRefName);
6425 if (mdDef)
6426 {
6427 mdDef->addSourceReferences(dst,sourceRefName);
6428 }
6429 if (mdDecl)
6430 {
6431 mdDecl->addSourceReferences(dst,sourceRefName);
6432 }
6433 // ---- end critical section
6434 }
6435}
virtual void addSourceReferences(MemberDef *d, const QCString &sourceRefName)=0
virtual void addSourceReferencedBy(MemberDef *d, const QCString &sourceRefName)=0
A model of a class/file/namespace member symbol.
Definition memberdef.h:48
virtual MemberDef * memberDefinition() const =0
virtual MemberDef * memberDeclaration() const =0
virtual bool hasReferencesRelation() const =0
virtual bool isTypedef() const =0
virtual bool hasCallGraph() const =0
virtual QCString sourceRefName() const =0
virtual bool hasCallerGraph() const =0
virtual bool isEnumerate() const =0
virtual bool hasReferencedByRelation() const =0
virtual bool isCallable() const =0
This is an alternative implementation of QCString.
Definition qcstring.h:101
static std::mutex g_docCrossReferenceMutex
MemberDefMutable * toMemberDefMutable(Definition *d)

References DefinitionMutable::addSourceReferencedBy(), DefinitionMutable::addSourceReferences(), g_docCrossReferenceMutex, MemberDef::hasCallerGraph(), MemberDef::hasCallGraph(), MemberDef::hasReferencedByRelation(), MemberDef::hasReferencesRelation(), MemberDef::isCallable(), MemberDef::isEnumerate(), MemberDef::isTypedef(), MemberDef::memberDeclaration(), MemberDef::memberDefinition(), MemberDef::sourceRefName(), and toMemberDefMutable().

Referenced by findMemberLink(), generateClassMemberLink(), generateClassOrGlobalLink(), generateClassOrGlobalLink(), getLink(), getLinkInScope(), getLinkInScope(), and writeObjCMethodCall().

◆ addTemplateNames()

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

Definition at line 975 of file memberdef.cpp.

976{
977 QCString result;
978 QCString clRealName=n;
979 int p=0,i=0;
980 if ((i=clRealName.find('<'))!=-1)
981 {
982 clRealName=clRealName.left(i); // strip template specialization
983 }
984 if ((i=clRealName.findRev("::"))!=-1)
985 {
986 clRealName=clRealName.right(clRealName.length()-i-2);
987 }
988 while ((i=s.find(clRealName,p))!=-1)
989 {
990 result+=s.mid(p,i-p);
991 size_t j=clRealName.length()+i;
992 if (s.length()==j || (s.at(j)!='<' && !isId(s.at(j))))
993 { // add template names
994 //printf("Adding %s+%s\n",qPrint(clRealName),qPrint(t));
995 result+=clRealName+t;
996 }
997 else
998 { // template names already present
999 //printf("Adding %s\n",qPrint(clRealName));
1000 result+=clRealName;
1001 }
1002 p=i+static_cast<int>(clRealName.length());
1003 }
1004 result+=s.right(s.length()-p);
1005 //printf("addTemplateNames(%s,%s,%s)=%s\n",qPrint(s),qPrint(n),qPrint(t),qPrint(result));
1006 return result;
1007}
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:226
char & at(size_t i)
Returns a reference to the character at index i.
Definition qcstring.h:567
QCString right(size_t len) const
Definition qcstring.h:219
int findRev(char c, int index=-1, bool cs=TRUE) const
Definition qcstring.cpp:91
QCString left(size_t len) const
Definition qcstring.h:214
bool isId(int c)
Definition util.h:202

References QCString::at(), QCString::find(), QCString::findRev(), isId(), QCString::left(), QCString::length(), QCString::mid(), and QCString::right().

Referenced by writeDefArgumentList().

◆ combineArgsAndException()

static QCString combineArgsAndException ( QCString args,
QCString exception )
static

Definition at line 2208 of file memberdef.cpp.

2209{
2210 if (exception.isEmpty()) return args; // no exception, nothing to combine args
2211 int pos = args.findRev(')');
2212 int eqPos = pos!=-1 ? args.find('=',pos) : -1; // look for '=' in '(args) = something'
2213 if (eqPos==-1) return args+" "+exception; // append exception at the end
2214 return args.left(eqPos)+" "+exception+" "+args.mid(eqPos); // insert exception before =
2215}
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150

References QCString::find(), QCString::findRev(), QCString::isEmpty(), QCString::left(), and QCString::mid().

Referenced by MemberDefImpl::writeDeclaration().

◆ combineDeclarationAndDefinition()

void combineDeclarationAndDefinition ( MemberDefMutable * mdec,
MemberDefMutable * mdef )

Definition at line 6152 of file memberdef.cpp.

6153{
6154 AUTO_TRACE("mdec='{}' mdef='{}' mdec.isPrototype={} mdef.isPrototype={}",
6155 mdec->name(), mdef->name(), mdec->isPrototype(), mdef->isPrototype());
6156 if (
6157 (mdef->isFunction() && !mdef->isStatic() && !mdef->isPrototype()) ||
6158 (mdef->isVariable() && !mdef->isExternal() && !mdef->isStatic())
6159 )
6160 {
6161 bool sameNumTemplateArgs = mdef->templateArguments().size()==mdec->templateArguments().size();
6162
6163 ArgumentList &mdefAl = const_cast<ArgumentList&>(mdef->argumentList());
6164 ArgumentList &mdecAl = const_cast<ArgumentList&>(mdec->argumentList());
6165 if (sameNumTemplateArgs &&
6166 matchArguments2(mdef->getOuterScope(),mdef->getFileDef(),&mdefAl,
6167 mdec->getOuterScope(),mdec->getFileDef(),&mdecAl,
6168 TRUE,mdef->getLanguage()
6169 )
6170 ) /* match found */
6171 {
6172 AUTO_TRACE_ADD("combining definition and declaration");
6173
6174 if (Config_getBool(RESOLVE_UNNAMED_PARAMS))
6175 {
6176 mdec->resolveUnnamedParameters(mdef);
6177 }
6178
6179 // first merge argument documentation
6180 transferArgumentDocumentation(mdecAl,mdefAl);
6181
6182 /* copy documentation between function definition and declaration */
6183 if (!mdec->briefDescription().isEmpty())
6184 {
6185 mdef->setBriefDescription(mdec->briefDescription(),mdec->briefFile(),mdec->briefLine());
6186 }
6187 else if (!mdef->briefDescription().isEmpty())
6188 {
6189 mdec->setBriefDescription(mdef->briefDescription(),mdef->briefFile(),mdef->briefLine());
6190 }
6191 if (!mdef->documentation().isEmpty())
6192 {
6193 //printf("transferring docs mdef->mdec (%s->%s)\n",mdef->argsString(),mdec->argsString());
6194 mdec->setDocumentation(mdef->documentation(),mdef->docFile(),mdef->docLine());
6196 if (mdefAl.hasParameters())
6197 {
6198 auto mdefAlComb = stringToArgumentList(mdef->getLanguage(),mdef->argsString());
6199 transferArgumentDocumentation(mdefAl,*mdefAlComb);
6200 mdec->moveArgumentList(std::move(mdefAlComb));
6201 }
6202 }
6203 else if (!mdec->documentation().isEmpty())
6204 {
6205 //printf("transferring docs mdec->mdef (%s->%s)\n",mdec->argsString(),mdef->argsString());
6206 mdef->setDocumentation(mdec->documentation(),mdec->docFile(),mdec->docLine());
6208 if (mdecAl.hasParameters())
6209 {
6210 auto mdecAlComb = stringToArgumentList(mdec->getLanguage(),mdec->argsString());
6211 transferArgumentDocumentation(mdecAl,*mdecAlComb);
6212 mdef->moveDeclArgumentList(std::move(mdecAlComb));
6213 }
6214 }
6215 if (!mdef->inbodyDocumentation().isEmpty())
6216 {
6217 mdec->setInbodyDocumentation(mdef->inbodyDocumentation(),mdef->inbodyFile(),mdef->inbodyLine());
6218 }
6219 else if (!mdec->inbodyDocumentation().isEmpty())
6220 {
6221 mdef->setInbodyDocumentation(mdec->inbodyDocumentation(),mdec->inbodyFile(),mdec->inbodyLine());
6222 }
6223 if (mdec->getStartBodyLine()!=-1 && mdef->getStartBodyLine()==-1)
6224 {
6225 //printf("body mdec->mdef %d-%d\n",mdec->getStartBodyLine(),mdef->getEndBodyLine());
6226 mdef->setBodySegment(mdec->getDefLine(),mdec->getStartBodyLine(),mdec->getEndBodyLine());
6227 mdef->setBodyDef(mdec->getBodyDef());
6228 //mdef->setBodyMember(mdec);
6229 }
6230 else if (mdef->getStartBodyLine()!=-1 && mdec->getStartBodyLine()==-1)
6231 {
6232 //printf("body mdef->mdec %d-%d\n",mdef->getStartBodyLine(),mdec->getEndBodyLine());
6233 mdec->setBodySegment(mdef->getDefLine(),mdef->getStartBodyLine(),mdef->getEndBodyLine());
6234 mdec->setBodyDef(mdef->getBodyDef());
6235 //mdec->setBodyMember(mdef);
6236 }
6239
6240 // copy group info.
6241 if (mdec->getGroupDef()==nullptr && mdef->getGroupDef()!=nullptr)
6242 {
6243 mdec->setGroupDef(mdef->getGroupDef(),
6244 mdef->getGroupPri(),
6245 mdef->docFile(),
6246 mdef->docLine(),
6247 mdef->hasDocumentation(),
6248 mdef
6249 );
6250 }
6251 else if (mdef->getGroupDef()==nullptr && mdec->getGroupDef()!=nullptr)
6252 {
6253 mdef->setGroupDef(mdec->getGroupDef(),
6254 mdec->getGroupPri(),
6255 mdec->docFile(),
6256 mdec->docLine(),
6257 mdec->hasDocumentation(),
6258 mdec
6259 );
6260 }
6261
6262
6263 mdec->mergeRefItems(mdef);
6264 mdef->mergeRefItems(mdec);
6265
6266 mdef->setMemberDeclaration(mdec);
6267 mdec->setMemberDefinition(mdef);
6268
6269 mergeMemberOverrideOptions(mdec,mdef);
6270
6271 mdef->addQualifiers(mdec->getQualifiers());
6272 mdec->addQualifiers(mdef->getQualifiers());
6273 }
6274 }
6275}
This class represents an function or template argument list.
Definition arguments.h:60
bool hasParameters() const
Definition arguments.h:69
size_t size() const
Definition arguments.h:93
virtual QCString docFile() const =0
virtual int getEndBodyLine() const =0
virtual SrcLangExt getLanguage() const =0
Returns the programming language this definition was written in.
virtual int docLine() const =0
virtual int getDefLine() const =0
virtual int inbodyLine() const =0
virtual const FileDef * getBodyDef() const =0
virtual int briefLine() const =0
virtual bool hasDocumentation() const =0
virtual QCString briefDescription(bool abbreviate=FALSE) const =0
virtual QCString documentation() const =0
virtual QCString briefFile() const =0
virtual Definition * getOuterScope() const =0
virtual int getStartBodyLine() const =0
virtual QCString inbodyDocumentation() const =0
virtual QCString inbodyFile() const =0
virtual const QCString & name() const =0
virtual void setBodySegment(int defLine, int bls, int ble)=0
virtual void setDocumentation(const QCString &d, const QCString &docFile, int docLine, bool stripWhiteSpace=TRUE)=0
virtual void setInbodyDocumentation(const QCString &d, const QCString &docFile, int docLine)=0
virtual void mergeRefItems(Definition *d)=0
virtual void setBodyDef(const FileDef *fd)=0
virtual void setBriefDescription(const QCString &b, const QCString &briefFile, int briefLine)=0
virtual const ArgumentList & templateArguments() const =0
virtual GroupDef * getGroupDef()=0
virtual const FileDef * getFileDef() const =0
virtual const ArgumentList & argumentList() const =0
virtual bool isFunction() const =0
virtual bool isExternal() const =0
virtual bool isStatic() const =0
virtual StringVector getQualifiers() const =0
virtual bool isDocsForDefinition() const =0
virtual Grouping::GroupPri_t getGroupPri() const =0
virtual TypeSpecifier getMemberSpecifiers() const =0
virtual bool isVariable() const =0
virtual QCString argsString() const =0
virtual bool isPrototype() const =0
virtual void setMemberDeclaration(MemberDef *md)=0
virtual void resolveUnnamedParameters(const MemberDef *md)=0
virtual void setDocsForDefinition(bool b)=0
virtual void mergeMemberSpecifiers(TypeSpecifier s)=0
virtual void addQualifiers(const StringVector &qualifiers)=0
virtual void moveDeclArgumentList(std::unique_ptr< ArgumentList > al)=0
virtual void setGroupDef(GroupDef *gd, Grouping::GroupPri_t pri, const QCString &fileName, int startLine, bool hasDocs, MemberDef *member=nullptr)=0
virtual void setMemberDefinition(MemberDef *md)=0
virtual void moveArgumentList(std::unique_ptr< ArgumentList > al)=0
#define Config_getBool(name)
Definition config.h:33
std::unique_ptr< ArgumentList > stringToArgumentList(SrcLangExt lang, const QCString &argsString, QCString *extraTypeChars=nullptr)
Definition defargs.l:814
#define AUTO_TRACE_ADD(...)
Definition docnode.cpp:47
#define AUTO_TRACE(...)
Definition docnode.cpp:46
static void transferArgumentDocumentation(ArgumentList &decAl, ArgumentList &defAl)
#define TRUE
Definition qcstring.h:37
bool matchArguments2(const Definition *srcScope, const FileDef *srcFileScope, const ArgumentList *srcAl, const Definition *dstScope, const FileDef *dstFileScope, const ArgumentList *dstAl, bool checkCV, SrcLangExt lang)
Definition util.cpp:1931
void mergeMemberOverrideOptions(MemberDefMutable *md1, MemberDefMutable *md2)
Definition util.cpp:7188

References MemberDefMutable::addQualifiers(), MemberDef::argsString(), MemberDef::argumentList(), AUTO_TRACE, AUTO_TRACE_ADD, Definition::briefDescription(), Definition::briefFile(), Definition::briefLine(), Config_getBool, Definition::docFile(), Definition::docLine(), Definition::documentation(), Definition::getBodyDef(), Definition::getDefLine(), Definition::getEndBodyLine(), MemberDef::getFileDef(), MemberDef::getGroupDef(), MemberDef::getGroupPri(), Definition::getLanguage(), MemberDef::getMemberSpecifiers(), Definition::getOuterScope(), MemberDef::getQualifiers(), Definition::getStartBodyLine(), Definition::hasDocumentation(), ArgumentList::hasParameters(), Definition::inbodyDocumentation(), Definition::inbodyFile(), Definition::inbodyLine(), MemberDef::isDocsForDefinition(), QCString::isEmpty(), MemberDef::isExternal(), MemberDef::isFunction(), MemberDef::isPrototype(), MemberDef::isStatic(), MemberDef::isVariable(), matchArguments2(), mergeMemberOverrideOptions(), MemberDefMutable::mergeMemberSpecifiers(), DefinitionMutable::mergeRefItems(), MemberDefMutable::moveArgumentList(), MemberDefMutable::moveDeclArgumentList(), Definition::name(), MemberDefMutable::resolveUnnamedParameters(), DefinitionMutable::setBodyDef(), DefinitionMutable::setBodySegment(), DefinitionMutable::setBriefDescription(), MemberDefMutable::setDocsForDefinition(), DefinitionMutable::setDocumentation(), MemberDefMutable::setGroupDef(), DefinitionMutable::setInbodyDocumentation(), MemberDefMutable::setMemberDeclaration(), MemberDefMutable::setMemberDefinition(), ArgumentList::size(), stringToArgumentList(), MemberDef::templateArguments(), transferArgumentDocumentation(), and TRUE.

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

◆ createMemberDef()

std::unique_ptr< MemberDef > 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.

Definition at line 516 of file memberdef.cpp.

521{
522 return std::make_unique<MemberDefImpl>(defFileName,defLine,defColumn,type,name,args,excp,prot,virt,
523 stat,related,t,tal,al,metaData);
524}

Referenced by addEnumValuesToEnums(), addInstance(), addLocalObjCMethod(), addMemberSpecialization(), addOverloaded(), addVariableToClass(), addVariableToFile(), buildDefineList(), createTagLessInstance(), MemberDefImpl::createTemplateInstanceMember(), findDefineDocumentation(), findEnums(), findMember(), and findUsingDeclImports().

◆ createMemberDefAlias()

std::unique_ptr< MemberDef > createMemberDefAlias ( const Definition * newScope,
const MemberDef * aliasMd )

Definition at line 966 of file memberdef.cpp.

967{
968 auto amd = std::make_unique<MemberDefAliasImpl>(newScope,aliasMd);
969 //printf("amd: name=%s displayName=%s\n",qPrint(amd->name()),qPrint(amd->displayName()));
970 return amd;
971}

Referenced by MemberDefAliasImpl::deepCopy(), findUsingDeclImports(), NamespaceDefImpl::insertMember(), and insertMemberAlias().

◆ invalidateCachedTypesInArgumentList()

static void invalidateCachedTypesInArgumentList ( ArgumentList & al)
static

Definition at line 6089 of file memberdef.cpp.

6090{
6091 for (Argument &a : al)
6092 {
6093 a.canType.clear();
6094 }
6095}
This class contains the information about the argument of a function or template.
Definition arguments.h:27

Referenced by MemberDefImpl::invalidateCachedArgumentTypes().

◆ simplifyTypeForTable()

static QCString simplifyTypeForTable ( const QCString & s)
static

Definition at line 3908 of file memberdef.cpp.

3909{
3911 if (ts.endsWith("::")) ts = ts.left(ts.length()-2);
3912 static const reg::Ex re1(R"(\a\w*::)"); // non-template version
3913 static const reg::Ex re2(R"(\a\w*<[^>]*>::)"); // template version
3915 std::string t = ts.str();
3916 while (reg::search(t,match,re2) || reg::search(t,match,re1))
3917 {
3918 t = match.prefix().str() + match.suffix().str(); // remove the matched part
3919 }
3920 //printf("simplifyTypeForTable(%s)->%s\n",qPrint(s),t.c_str());
3921 return QCString(t);
3922}
bool endsWith(const char *s) const
Definition qcstring.h:504
const std::string & str() const
Definition qcstring.h:526
Class representing a regular expression.
Definition regex.h:39
Object representing the matching results.
Definition regex.h:153
bool search(std::string_view 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:748
bool match(std::string_view str, Match &match, const Ex &re)
Matches a given string str for a match against regular expression re.
Definition regex.cpp:759
QCString removeAnonymousScopes(const QCString &str)
Definition util.cpp:172

References QCString::endsWith(), QCString::left(), QCString::length(), removeAnonymousScopes(), reg::search(), and QCString::str().

Referenced by MemberDefImpl::fieldType().

◆ stripTrailingReturn()

static QCString stripTrailingReturn ( const QCString & trailRet)
static

Definition at line 4155 of file memberdef.cpp.

4156{
4157 QCString ret = trailRet;
4158
4159 ret = ret.stripWhiteSpace();
4160 if (ret.startsWith("->"))
4161 {
4162 ret = ret.mid(2).stripWhiteSpace();
4163 return ret;
4164 }
4165 return trailRet;
4166}
bool startsWith(const char *s) const
Definition qcstring.h:492
QCString stripWhiteSpace() const
returns a copy of this string with leading and trailing whitespace removed
Definition qcstring.h:245

References QCString::mid(), QCString::startsWith(), and QCString::stripWhiteSpace().

Referenced by MemberDefImpl::warnIfUndocumentedParams().

◆ toMemberDef() [1/3]

const MemberDef * toMemberDef ( const Definition * d)

Definition at line 6464 of file memberdef.cpp.

6465{
6466 if (d && (typeid(*d)==typeid(MemberDefImpl) || typeid(*d)==typeid(MemberDefAliasImpl)))
6467 {
6468 return static_cast<const MemberDef*>(d);
6469 }
6470 else
6471 {
6472 return nullptr;
6473 }
6474}

◆ toMemberDef() [2/3]

◆ toMemberDef() [3/3]

MemberDef * toMemberDef ( DefinitionMutable * md)

Definition at line 6451 of file memberdef.cpp.

6452{
6453 Definition *d = toDefinition(md);
6454 if (d && typeid(*d)==typeid(MemberDefImpl))
6455 {
6456 return static_cast<MemberDef*>(d);
6457 }
6458 else
6459 {
6460 return nullptr;
6461 }
6462}
The common base class of all entity definitions found in the sources.
Definition definition.h:76
Definition * toDefinition(DefinitionMutable *dm)

References toDefinition().

◆ toMemberDefMutable()

MemberDefMutable * toMemberDefMutable ( Definition * d)

Definition at line 6476 of file memberdef.cpp.

6477{
6478 if (d && typeid(*d)==typeid(MemberDefImpl))
6479 {
6480 return static_cast<MemberDefMutable*>(d);
6481 }
6482 else
6483 {
6484 return nullptr;
6485 }
6486}

Referenced by addDocCrossReference(), addEnumValuesToEnums(), addInstance(), MemberList::addListReferences(), addLocalObjCMethod(), addMemberFunction(), addMemberSpecialization(), addMembersToMemberGroup(), ClassDefImpl::addMembersToTemplateInstance(), addMemberToGroups(), ClassDefImpl::addMemberToList(), FileDefImpl::addMemberToList(), ModuleDefImpl::addMemberToList(), NamespaceDefImpl::addMemberToList(), ModuleDefImpl::addMemberToModule(), ModuleManager::addMemberToModule(), addOverloaded(), addVariableToClass(), addVariableToFile(), buildDefineList(), computeMemberRelationsForBaseClass(), createTagLessInstance(), MemberDefImpl::createTemplateInstanceMember(), ClassDefImpl::deepCopy(), MemberGroup::distributeMemberGroupDocumentation(), findDefineDocumentation(), findDEV(), findEnumDocumentation(), findEnums(), findGlobalMember(), findMember(), MemberList::findSectionsInDocumentation(), findUsingDeclImports(), flushCachedTemplateRelations(), flushUnresolvedRelations(), generateClassMemberLink(), getLinkInScope(), incrementFlowKeyWordCount(), incrementFlowKeyWordCount(), inheritDocumentation(), GroupDefImpl::insertMember(), MemberGroup::insertMember(), NamespaceDefImpl::insertMember(), MemberDefImpl::insertReimplementedBy(), ClassDefImpl::mergeCategory(), SymbolResolver::Private::newResolveTypedef(), processTagLessClasses(), MemberList::setAnchors(), MemberList::setAnonymousEnumType(), ClassDefImpl::setGroupDefForAllMembers(), transferFunctionDocumentation(), transferFunctionReferences(), transferRelatedFunctionDocumentation(), transferStaticInstanceInitializers(), tryAddEnumDocsToGroupMember(), vhdlCorrectMemberProperties(), MemberDefImpl::writeDeclaration(), MemberList::writeDocumentation(), MemberList::writeDocumentationPage(), VhdlDocGen::writePlainVHDLDeclarations(), MemberList::writeSimpleDocumentation(), VhdlDocGen::writeSource(), and MemberList::writeTagFile().

◆ transferArgumentDocumentation()

static void transferArgumentDocumentation ( ArgumentList & decAl,
ArgumentList & defAl )
static

Definition at line 6122 of file memberdef.cpp.

6123{
6124 for (auto decIt = decAl.begin(), defIt = defAl.begin();
6125 decIt!= decAl.end() && defIt!= defAl.end();
6126 ++decIt, ++defIt)
6127 {
6128 Argument &decA = *decIt;
6129 Argument &defA = *defIt;
6130 if (decA.docs.isEmpty() && !defA.docs.isEmpty())
6131 {
6132 decA.docs = defA.docs;
6133 }
6134 else if (defA.docs.isEmpty() && !decA.docs.isEmpty())
6135 {
6136 defA.docs = decA.docs;
6137 }
6138 if (Config_getBool(RESOLVE_UNNAMED_PARAMS))
6139 {
6140 if (decA.name.isEmpty() && !defA.name.isEmpty())
6141 {
6142 decA.name = defA.name;
6143 }
6144 else if (defA.name.isEmpty() && !decA.name.isEmpty())
6145 {
6146 defA.name = decA.name;
6147 }
6148 }
6149 }
6150}
iterator end()
Definition arguments.h:87
iterator begin()
Definition arguments.h:86
QCString name
Definition arguments.h:39
QCString docs
Definition arguments.h:42

References ArgumentList::begin(), Config_getBool, Argument::docs, ArgumentList::end(), QCString::isEmpty(), and Argument::name.

Referenced by combineDeclarationAndDefinition().

◆ writeDefArgumentList()

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

Definition at line 1048 of file memberdef.cpp.

1049{
1050 const ArgumentList &defArgList=(md->isDocsForDefinition()) ?
1051 md->argumentList() : md->declArgumentList();
1052 //printf("writeDefArgumentList '%s' isDocsForDefinition()=%d hasParameters()=%d (%s)\n",
1053 // qPrint(md->name()),md->isDocsForDefinition(),defArgList.hasParameters(),qPrint(argListToString(defArgList)));
1054 if (!defArgList.hasParameters() || md->isProperty() || md->isTypedef())
1055 {
1056 return FALSE; // member has no function like argument list
1057 }
1058
1059 if (!md->isDefine()) ol.docify(" ");
1060
1061 //printf("writeDefArgList(%d)\n",defArgList->count());
1062 ol.endMemberDocName();
1064 //printf("===> name=%s isDefine=%d\n",qPrint(md->name()),md->isDefine());
1065
1066 QCString cName;
1067 if (scope)
1068 {
1069 cName=scope->name();
1070 int il=cName.find('<');
1071 int ir=cName.findRev('>');
1072 if (il!=-1 && ir!=-1 && ir>il)
1073 {
1074 cName=cName.mid(il,ir-il+1);
1075 //printf("1. cName=%s\n",qPrint(cName));
1076 }
1077 else if (scope->definitionType()==Definition::TypeClass)
1078 {
1079 cName=tempArgListToString((toClassDef(scope))->templateArguments(),
1080 scope->getLanguage());
1081 //printf("2. cName=%s\n",qPrint(cName));
1082 }
1083 else // no template specifier
1084 {
1085 cName.clear();
1086 }
1087 }
1088 //printf("~~~ %s cName=%s\n",qPrint(md->name()),qPrint(cName));
1089
1091
1092 bool first=TRUE;
1093 bool paramTypeStarted=FALSE;
1094 bool isDefine = md->isDefine();
1095 auto alIt = defArgList.begin();
1096 while (alIt!=defArgList.end())
1097 {
1098 Argument a = *alIt;
1099 if (isDefine || first)
1100 {
1101 ol.startParameterType(first,QCString());
1102 paramTypeStarted=true;
1103 if (isDefine)
1104 {
1105 ol.endParameterType();
1107 }
1108 }
1109
1110 if (!a.attrib.isEmpty() && !md->isObjCMethod()) // argument has an IDL attribute
1111 {
1112 ol.docify(a.attrib+" ");
1113 }
1114
1115 QCString atype = a.type;
1116 if (sep!="::") { atype=substitute(atype,"::",sep); }
1117
1118 int funcPtrPos=-1;
1119 {
1120 if (md->isObjCMethod()) { atype.prepend("("); atype.append(")"); }
1121 if (atype!="...")
1122 {
1123 if (!cName.isEmpty() && scope && scope!=Doxygen::globalScope)
1124 {
1125 atype=addTemplateNames(atype,scope->name(),cName);
1126 }
1127 funcPtrPos = atype.find("*)(");
1128 if (funcPtrPos!=-1) funcPtrPos++;
1129 linkifyText(TextGeneratorOLImpl(ol),scope,md->getBodyDef(),md,
1130 funcPtrPos==-1 ? atype : atype.left(funcPtrPos));
1131 }
1132 }
1133
1134 if (!isDefine)
1135 {
1136 if (paramTypeStarted)
1137 {
1138 ol.endParameterType();
1139 paramTypeStarted=FALSE;
1140 }
1141 ol.startParameterName(defArgList.size()<2);
1142 }
1143 else
1144 {
1145 ol.endParameterName();
1146 }
1147
1148 if (atype=="...")
1149 {
1150 ol.docify(atype);
1151 }
1152 else if (!a.name.isEmpty()) // argument has a name
1153 {
1154 ol.docify(a.name);
1155 }
1156 if (!isDefine)
1157 {
1158 if (funcPtrPos!=-1)
1159 {
1161 }
1162 ol.endParameterName();
1163 }
1165 if (funcPtrPos!=-1)
1166 {
1167 linkifyText(TextGeneratorOLImpl(ol),scope,md->getBodyDef(),md,
1168 atype.mid(funcPtrPos));
1169 }
1170 if (!a.array.isEmpty())
1171 {
1172 ol.docify(a.array);
1173 }
1174 if (!a.defval.isEmpty()) // write the default value
1175 {
1176 QCString n=a.defval;
1177 if (scope && scope!=Doxygen::globalScope && !cName.isEmpty())
1178 {
1179 n=addTemplateNames(n,scope->name(),cName);
1180 }
1181 ol.startParameterDefVal(" = ");
1183 ol.endParameterDefVal();
1184 }
1185 ++alIt;
1186 if (alIt!=defArgList.end())
1187 {
1188 a = *alIt;
1189 if (!md->isObjCMethod()) ol.docify(", "); // there are more arguments
1190 if (!isDefine)
1191 {
1192 QCString key;
1193 if (md->isObjCMethod() && a.attrib.length()>=2)
1194 {
1195 //printf("Found parameter keyword %s\n",a.qPrint(attrib));
1196 // strip [ and ]
1197 key=a.attrib.mid(1,a.attrib.length()-2);
1198 if (key!=",") key+=":"; // for normal keywords add colon
1199 }
1200 ol.endParameterExtra(false,false,!md->isObjCMethod());
1201 if (paramTypeStarted)
1202 {
1203 ol.endParameterType();
1204 }
1205 ol.startParameterType(FALSE,key);
1206 paramTypeStarted=TRUE;
1207 }
1208 else // isDefine
1209 {
1210 ol.endParameterExtra(false,false,true);
1211 }
1212 }
1213 first=FALSE;
1214 }
1215 if (first)
1216 {
1217 ol.startParameterName(defArgList.size()<2);
1218 ol.endParameterName();
1220 }
1221 ol.endParameterExtra(TRUE,defArgList.size()<2,!md->isObjCMethod());
1222 if (!md->extraTypeChars().isEmpty())
1223 {
1224 ol.docify(md->extraTypeChars());
1225 }
1226 if (defArgList.constSpecifier())
1227 {
1228 ol.docify(" const");
1229 }
1230 if (defArgList.volatileSpecifier())
1231 {
1232 ol.docify(" volatile");
1233 }
1234 if (defArgList.refQualifier()==RefQualifierType::LValue)
1235 {
1236 ol.docify(" &");
1237 }
1238 else if (defArgList.refQualifier()==RefQualifierType::RValue)
1239 {
1240 ol.docify(" &&");
1241 }
1242 if (!defArgList.trailingReturnType().isEmpty())
1243 {
1245 scope, // scope
1246 md->getBodyDef(), // fileScope
1247 md, // self
1248 defArgList.trailingReturnType(), // text
1249 FALSE // autoBreak
1250 );
1251
1252 }
1253 return TRUE;
1254}
RefQualifierType refQualifier() const
Definition arguments.h:109
QCString trailingReturnType() const
Definition arguments.h:107
bool constSpecifier() const
Definition arguments.h:104
bool volatileSpecifier() const
Definition arguments.h:105
virtual DefType definitionType() const =0
static NamespaceDefMutable * globalScope
Definition doxygen.h:121
virtual bool isObjCMethod() const =0
virtual QCString extraTypeChars() const =0
virtual bool isDefine() const =0
virtual const ArgumentList & declArgumentList() const =0
virtual bool isProperty() const =0
void endParameterExtra(bool last, bool one, bool bracket)
Definition outputlist.h:693
void endMemberDocName()
Definition outputlist.h:681
void startParameterExtra()
Definition outputlist.h:691
void startParameterList(bool openBracket)
Definition outputlist.h:699
void docify(const QCString &s)
Definition outputlist.h:438
void startParameterDefVal(const char *separator)
Definition outputlist.h:695
void endParameterDefVal()
Definition outputlist.h:697
void startParameterType(bool first, const QCString &key)
Definition outputlist.h:683
void endParameterName()
Definition outputlist.h:689
void endParameterType()
Definition outputlist.h:685
void startParameterName(bool one)
Definition outputlist.h:687
void writeNonBreakableSpace(int num)
Definition outputlist.h:625
QCString & prepend(const char *s)
Definition qcstring.h:407
QCString & append(char c)
Definition qcstring.h:381
void clear()
Definition qcstring.h:169
Implements TextGeneratorIntf for an OutputDocInterface stream.
Definition util.h:77
ClassDef * toClassDef(Definition *d)
static QCString addTemplateNames(const QCString &s, const QCString &n, const QCString &t)
QCString substitute(const QCString &s, const QCString &src, const QCString &dst)
substitute all occurrences of src in s by dst
Definition qcstring.cpp:477
#define FALSE
Definition qcstring.h:34
QCString type
Definition arguments.h:37
QCString defval
Definition arguments.h:41
QCString array
Definition arguments.h:40
QCString attrib
Definition arguments.h:36
QCString tempArgListToString(const ArgumentList &al, SrcLangExt lang, bool includeDefault)
Definition util.cpp:1219
QCString getLanguageSpecificSeparator(SrcLangExt lang, bool classScope)
Returns the scope separator to use given the programming language lang.
Definition util.cpp:6229
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:904

References addTemplateNames(), QCString::append(), MemberDef::argumentList(), Argument::array, Argument::attrib, ArgumentList::begin(), QCString::clear(), ArgumentList::constSpecifier(), MemberDef::declArgumentList(), Definition::definitionType(), Argument::defval, OutputList::docify(), ArgumentList::end(), OutputList::endMemberDocName(), OutputList::endParameterDefVal(), OutputList::endParameterExtra(), OutputList::endParameterName(), OutputList::endParameterType(), MemberDef::extraTypeChars(), FALSE, QCString::find(), QCString::findRev(), Definition::getBodyDef(), Definition::getLanguage(), getLanguageSpecificSeparator(), Doxygen::globalScope, ArgumentList::hasParameters(), MemberDef::isDefine(), MemberDef::isDocsForDefinition(), QCString::isEmpty(), MemberDef::isObjCMethod(), MemberDef::isProperty(), MemberDef::isTypedef(), QCString::left(), QCString::length(), linkifyText(), LValue, QCString::mid(), Argument::name, Definition::name(), QCString::prepend(), ArgumentList::refQualifier(), RValue, ArgumentList::size(), OutputList::startParameterDefVal(), OutputList::startParameterExtra(), OutputList::startParameterList(), OutputList::startParameterName(), OutputList::startParameterType(), substitute(), tempArgListToString(), toClassDef(), ArgumentList::trailingReturnType(), TRUE, Argument::type, Definition::TypeClass, ArgumentList::volatileSpecifier(), and OutputList::writeNonBreakableSpace().

Referenced by MemberDefImpl::writeDocumentation().

◆ writeExceptionList()

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

Definition at line 1295 of file memberdef.cpp.

1296{
1297 QCString exception(QCString(md->excpString()).stripWhiteSpace());
1298 if ('{'==exception.at(0))
1299 {
1300 // this is an UNO IDL attribute - need special handling
1301 int index = exception.find(';');
1302 int oldIndex = 1;
1303 while (-1 != index) // there should be no more than 2 (set / get)
1304 {
1305 // omit '{' and ';' -> "set raises (...)"
1306 writeExceptionListImpl(ol,cd,md,exception.mid(oldIndex,index-oldIndex));
1307 oldIndex=index+1;
1308 index = exception.find(';',oldIndex);
1309 }
1310 // the rest is now just '}' - omit that
1311 }
1312 else
1313 {
1314 writeExceptionListImpl(ol,cd,md,exception);
1315 }
1316}
virtual QCString excpString() const =0
static void writeExceptionListImpl(OutputList &ol, const ClassDef *cd, const MemberDef *md, QCString const &exception)

References QCString::at(), MemberDef::excpString(), QCString::find(), QCString::mid(), QCString::stripWhiteSpace(), and writeExceptionListImpl().

Referenced by MemberDefImpl::writeDocumentation().

◆ writeExceptionListImpl()

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

Definition at line 1256 of file memberdef.cpp.

1258{
1259 // this is ordinary exception spec - there must be a '('
1260 //printf("exception='%s'\n",qPrint(exception));
1261 int index = exception.find('(');
1262 if (index!=-1)
1263 {
1264 ol.exceptionEntry(exception.left(index),false);
1265 ++index; // paren in second column so skip it here
1266 for (int comma = exception.find(',', index); comma!=-1; )
1267 {
1268 ++comma; // include comma
1270 exception.mid(index,comma-index));
1271 ol.exceptionEntry(QCString(),false);
1272 index=comma;
1273 comma = exception.find(',', index);
1274 }
1275 int close = exception.find(')', index);
1276 if (close!=-1)
1277 {
1278 QCString type=removeRedundantWhiteSpace(exception.mid(index,close-index));
1279 linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(),md,type);
1280 ol.exceptionEntry(QCString(),true);
1281 }
1282 else
1283 {
1284 warn(md->getDefFileName(),md->getDefLine(),
1285 "missing ) in exception list on member %s",qPrint(md->name()));
1286 }
1287 }
1288 else // Java Exception
1289 {
1290 ol.docify(" ");
1291 linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(),md,exception);
1292 }
1293}
virtual QCString getDefFileName() const =0
void exceptionEntry(const QCString &prefix, bool closeBracket)
Definition outputlist.h:703
#define warn(file, line, fmt,...)
Definition message.h:59
const char * qPrint(const char *s)
Definition qcstring.h:661
QCString removeRedundantWhiteSpace(const QCString &s)
Definition util.cpp:578

References OutputList::docify(), OutputList::exceptionEntry(), QCString::find(), Definition::getBodyDef(), Definition::getDefFileName(), Definition::getDefLine(), QCString::left(), linkifyText(), QCString::mid(), Definition::name(), qPrint(), removeRedundantWhiteSpace(), and warn.

Referenced by writeExceptionList().

Variable Documentation

◆ g_cachedAnonymousTypeMutex

std::mutex g_cachedAnonymousTypeMutex
static

Definition at line 1979 of file memberdef.cpp.

Referenced by MemberDefImpl::getClassDefOfAnonymousType().

◆ g_detectUndocumentedParamsMutex

std::mutex g_detectUndocumentedParamsMutex
static

Definition at line 4168 of file memberdef.cpp.

Referenced by MemberDefImpl::detectUndocumentedParams().

◆ g_docCrossReferenceMutex

std::mutex g_docCrossReferenceMutex
static

Definition at line 6384 of file memberdef.cpp.

Referenced by addDocCrossReference().

◆ g_hasDetailedDescriptionMutex

std::mutex g_hasDetailedDescriptionMutex
static

Definition at line 2662 of file memberdef.cpp.

Referenced by MemberDefImpl::hasDetailedDescription().

◆ reAnonymous

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