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 6382 of file memberdef.cpp.

6383{
6384 MemberDefMutable *src = toMemberDefMutable(const_cast<MemberDef*>(s));
6385 MemberDefMutable *dst = toMemberDefMutable(const_cast<MemberDef*>(d));
6386 if (src==nullptr || dst==nullptr) return;
6387 //printf("--> addDocCrossReference src=%s,dst=%s\n",qPrint(src->name()),qPrint(dst->name()));
6388 if (dst->isTypedef() || dst->isEnumerate()) return; // don't add types
6389 if ((dst->hasReferencedByRelation() || dst->hasCallerGraph()) &&
6390 src->isCallable()
6391 )
6392 {
6393 QCString sourceRefName = src->sourceRefName();
6396
6397 // ---- critical section
6398 std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
6399 dst->addSourceReferencedBy(src,sourceRefName);
6400 if (mdDef)
6401 {
6402 mdDef->addSourceReferencedBy(src,sourceRefName);
6403 }
6404 if (mdDecl)
6405 {
6406 mdDecl->addSourceReferencedBy(src,sourceRefName);
6407 }
6408 // ---- end critical section
6409 }
6410 if ((src->hasReferencesRelation() || src->hasCallGraph()) &&
6411 src->isCallable()
6412 )
6413 {
6414 QCString sourceRefName = dst->sourceRefName();
6417
6418 // ---- critical section
6419 std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
6420 src->addSourceReferences(dst,sourceRefName);
6421 if (mdDef)
6422 {
6423 mdDef->addSourceReferences(dst,sourceRefName);
6424 }
6425 if (mdDecl)
6426 {
6427 mdDecl->addSourceReferences(dst,sourceRefName);
6428 }
6429 // ---- end critical section
6430 }
6431}
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(), MemberDefMutable::setFromAnonymousScope(), 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:578
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 2207 of file memberdef.cpp.

2208{
2209 if (exception.isEmpty()) return args; // no exception, nothing to combine args
2210 int pos = args.findRev(')');
2211 int eqPos = pos!=-1 ? args.find('=',pos) : -1; // look for '=' in '(args) = something'
2212 if (eqPos==-1) return args+" "+exception; // append exception at the end
2213 return args.left(eqPos)+" "+exception+" "+args.mid(eqPos); // insert exception before =
2214}
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 6148 of file memberdef.cpp.

6149{
6150 AUTO_TRACE("mdec='{}' mdef='{}' mdec.isPrototype={} mdef.isPrototype={}",
6151 mdec->name(), mdef->name(), mdec->isPrototype(), mdef->isPrototype());
6152 if (
6153 (mdef->isFunction() && !mdef->isStatic() && !mdef->isPrototype()) ||
6154 (mdef->isVariable() && !mdef->isExternal() && !mdef->isStatic())
6155 )
6156 {
6157 bool sameNumTemplateArgs = mdef->templateArguments().size()==mdec->templateArguments().size();
6158
6159 ArgumentList &mdefAl = const_cast<ArgumentList&>(mdef->argumentList());
6160 ArgumentList &mdecAl = const_cast<ArgumentList&>(mdec->argumentList());
6161 if (sameNumTemplateArgs &&
6162 matchArguments2(mdef->getOuterScope(),mdef->getFileDef(),&mdefAl,
6163 mdec->getOuterScope(),mdec->getFileDef(),&mdecAl,
6164 TRUE,mdef->getLanguage()
6165 )
6166 ) /* match found */
6167 {
6168 AUTO_TRACE_ADD("combining definition and declaration");
6169
6170 if (Config_getBool(RESOLVE_UNNAMED_PARAMS))
6171 {
6172 mdec->resolveUnnamedParameters(mdef);
6173 }
6174
6175 // first merge argument documentation
6176 transferArgumentDocumentation(mdecAl,mdefAl);
6177
6178 /* copy documentation between function definition and declaration */
6179 if (!mdec->briefDescription().isEmpty())
6180 {
6181 mdef->setBriefDescription(mdec->briefDescription(),mdec->briefFile(),mdec->briefLine());
6182 }
6183 else if (!mdef->briefDescription().isEmpty())
6184 {
6185 mdec->setBriefDescription(mdef->briefDescription(),mdef->briefFile(),mdef->briefLine());
6186 }
6187 if (!mdef->documentation().isEmpty())
6188 {
6189 //printf("transferring docs mdef->mdec (%s->%s)\n",mdef->argsString(),mdec->argsString());
6190 mdec->setDocumentation(mdef->documentation(),mdef->docFile(),mdef->docLine());
6192 if (mdefAl.hasParameters())
6193 {
6194 auto mdefAlComb = stringToArgumentList(mdef->getLanguage(),mdef->argsString());
6195 transferArgumentDocumentation(mdefAl,*mdefAlComb);
6196 mdec->moveArgumentList(std::move(mdefAlComb));
6197 }
6198 }
6199 else if (!mdec->documentation().isEmpty())
6200 {
6201 //printf("transferring docs mdec->mdef (%s->%s)\n",mdec->argsString(),mdef->argsString());
6202 mdef->setDocumentation(mdec->documentation(),mdec->docFile(),mdec->docLine());
6204 if (mdecAl.hasParameters())
6205 {
6206 auto mdecAlComb = stringToArgumentList(mdec->getLanguage(),mdec->argsString());
6207 transferArgumentDocumentation(mdecAl,*mdecAlComb);
6208 mdef->moveDeclArgumentList(std::move(mdecAlComb));
6209 }
6210 }
6211 if (!mdef->inbodyDocumentation().isEmpty())
6212 {
6213 mdec->setInbodyDocumentation(mdef->inbodyDocumentation(),mdef->inbodyFile(),mdef->inbodyLine());
6214 }
6215 else if (!mdec->inbodyDocumentation().isEmpty())
6216 {
6217 mdef->setInbodyDocumentation(mdec->inbodyDocumentation(),mdec->inbodyFile(),mdec->inbodyLine());
6218 }
6219 if (mdec->getStartBodyLine()!=-1 && mdef->getStartBodyLine()==-1)
6220 {
6221 //printf("body mdec->mdef %d-%d\n",mdec->getStartBodyLine(),mdef->getEndBodyLine());
6222 mdef->setBodySegment(mdec->getDefLine(),mdec->getStartBodyLine(),mdec->getEndBodyLine());
6223 mdef->setBodyDef(mdec->getBodyDef());
6224 //mdef->setBodyMember(mdec);
6225 }
6226 else if (mdef->getStartBodyLine()!=-1 && mdec->getStartBodyLine()==-1)
6227 {
6228 //printf("body mdef->mdec %d-%d\n",mdef->getStartBodyLine(),mdec->getEndBodyLine());
6229 mdec->setBodySegment(mdef->getDefLine(),mdef->getStartBodyLine(),mdef->getEndBodyLine());
6230 mdec->setBodyDef(mdef->getBodyDef());
6231 //mdec->setBodyMember(mdef);
6232 }
6235
6236 // copy group info.
6237 if (mdec->getGroupDef()==nullptr && mdef->getGroupDef()!=nullptr)
6238 {
6239 mdec->setGroupDef(mdef->getGroupDef(),
6240 mdef->getGroupPri(),
6241 mdef->docFile(),
6242 mdef->docLine(),
6243 mdef->hasDocumentation(),
6244 mdef
6245 );
6246 }
6247 else if (mdef->getGroupDef()==nullptr && mdec->getGroupDef()!=nullptr)
6248 {
6249 mdef->setGroupDef(mdec->getGroupDef(),
6250 mdec->getGroupPri(),
6251 mdec->docFile(),
6252 mdec->docLine(),
6253 mdec->hasDocumentation(),
6254 mdec
6255 );
6256 }
6257
6258
6259 mdec->mergeRefItems(mdef);
6260 mdef->mergeRefItems(mdec);
6261
6262 mdef->setMemberDeclaration(mdec);
6263 mdec->setMemberDefinition(mdef);
6264
6265 mergeMemberOverrideOptions(mdec,mdef);
6266
6267 mdef->addQualifiers(mdec->getQualifiers());
6268 mdec->addQualifiers(mdef->getQualifiers());
6269 }
6270 }
6271}
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:7189

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(), MemberDefMutable::setFromAnonymousScope(), 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 )

◆ 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(), insertMemberAlias(), and MemberDefMutable::setFromAnonymousScope().

◆ invalidateCachedTypesInArgumentList()

static void invalidateCachedTypesInArgumentList ( ArgumentList & al)
static

Definition at line 6085 of file memberdef.cpp.

6086{
6087 for (Argument &a : al)
6088 {
6089 a.canType.clear();
6090 }
6091}
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 3904 of file memberdef.cpp.

3905{
3907 if (ts.endsWith("::")) ts = ts.left(ts.length()-2);
3908 static const reg::Ex re1(R"(\a\w*::)"); // non-template version
3909 static const reg::Ex re2(R"(\a\w*<[^>]*>::)"); // template version
3911 std::string t = ts.str();
3912 while (reg::search(t,match,re2) || reg::search(t,match,re1))
3913 {
3914 t = match.prefix().str() + match.suffix().str(); // remove the matched part
3915 }
3916 //printf("simplifyTypeForTable(%s)->%s\n",qPrint(s),t.c_str());
3917 return QCString(t);
3918}
bool endsWith(const char *s) const
Definition qcstring.h:509
const std::string & str() const
Definition qcstring.h:537
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 4151 of file memberdef.cpp.

4152{
4153 QCString ret = trailRet;
4154
4155 ret = ret.stripWhiteSpace();
4156 if (ret.startsWith("->"))
4157 {
4158 ret = ret.mid(2).stripWhiteSpace();
4159 return ret;
4160 }
4161 return trailRet;
4162}
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 6460 of file memberdef.cpp.

6461{
6462 if (d && (typeid(*d)==typeid(MemberDefImpl) || typeid(*d)==typeid(MemberDefAliasImpl)))
6463 {
6464 return static_cast<const MemberDef*>(d);
6465 }
6466 else
6467 {
6468 return nullptr;
6469 }
6470}

◆ toMemberDef() [2/3]

◆ toMemberDef() [3/3]

MemberDef * toMemberDef ( DefinitionMutable * md)

Definition at line 6447 of file memberdef.cpp.

6448{
6449 Definition *d = toDefinition(md);
6450 if (d && typeid(*d)==typeid(MemberDefImpl))
6451 {
6452 return static_cast<MemberDef*>(d);
6453 }
6454 else
6455 {
6456 return nullptr;
6457 }
6458}
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 6472 of file memberdef.cpp.

6473{
6474 if (d && typeid(*d)==typeid(MemberDefImpl))
6475 {
6476 return static_cast<MemberDefMutable*>(d);
6477 }
6478 else
6479 {
6480 return nullptr;
6481 }
6482}

Referenced by addDocCrossReference(), addEnumValuesToEnums(), addGlobalFunction(), addInstance(), addInterfaceOrServiceToServiceOrSingleton(), MemberList::addListReferences(), addLocalObjCMethod(), addMemberFunction(), addMemberSpecialization(), addMembersToMemberGroup(), ClassDefImpl::addMembersToTemplateInstance(), addMemberToGroups(), ClassDefImpl::addMemberToList(), FileDefImpl::addMemberToList(), ModuleDefImpl::addMemberToList(), NamespaceDefImpl::addMemberToList(), ModuleDefImpl::addMemberToModule(), ModuleManager::addMemberToModule(), addMethodToClass(), addOverloaded(), addVariableToClass(), addVariableToFile(), buildDefineList(), buildFunctionList(), buildTypedefList(), computeMemberRelationsForBaseClass(), createTagLessInstance(), MemberDefImpl::createTemplateInstanceMember(), createUsingMemberImportForClass(), ClassDefImpl::deepCopy(), MemberGroup::distributeMemberGroupDocumentation(), findDefineDocumentation(), findDEV(), findEnumDocumentation(), findEnums(), findFriends(), 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(), MemberDefMutable::setFromAnonymousScope(), 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 6118 of file memberdef.cpp.

6119{
6120 for (auto decIt = decAl.begin(), defIt = defAl.begin();
6121 decIt!= decAl.end() && defIt!= defAl.end();
6122 ++decIt, ++defIt)
6123 {
6124 Argument &decA = *decIt;
6125 Argument &defA = *defIt;
6126 if (decA.docs.isEmpty() && !defA.docs.isEmpty())
6127 {
6128 decA.docs = defA.docs;
6129 }
6130 else if (defA.docs.isEmpty() && !decA.docs.isEmpty())
6131 {
6132 defA.docs = decA.docs;
6133 }
6134 if (Config_getBool(RESOLVE_UNNAMED_PARAMS))
6135 {
6136 if (decA.name.isEmpty() && !defA.name.isEmpty())
6137 {
6138 decA.name = defA.name;
6139 }
6140 else if (defA.name.isEmpty() && !decA.name.isEmpty())
6141 {
6142 defA.name = decA.name;
6143 }
6144 }
6145 }
6146}
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 bool isDefine = md->isDefine();
1060 if (!isDefine) ol.docify(" ");
1061
1062 //printf("writeDefArgList(%d)\n",defArgList->count());
1063 ol.endMemberDocName();
1065 //printf("===> name=%s isDefine=%d\n",qPrint(md->name()),md->isDefine());
1066
1067 QCString cName;
1068 if (scope)
1069 {
1070 cName=scope->name();
1071 int il=cName.find('<');
1072 int ir=cName.findRev('>');
1073 if (il!=-1 && ir!=-1 && ir>il)
1074 {
1075 cName=cName.mid(il,ir-il+1);
1076 //printf("1. cName=%s\n",qPrint(cName));
1077 }
1078 else if (scope->definitionType()==Definition::TypeClass)
1079 {
1080 cName=tempArgListToString((toClassDef(scope))->templateArguments(),
1081 scope->getLanguage());
1082 //printf("2. cName=%s\n",qPrint(cName));
1083 }
1084 else // no template specifier
1085 {
1086 cName.clear();
1087 }
1088 }
1089 //printf("~~~ %s cName=%s\n",qPrint(md->name()),qPrint(cName));
1090
1092
1093 bool first=TRUE;
1094 bool paramTypeStarted=FALSE;
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 ol.startParameterType(FALSE,key);
1202 paramTypeStarted=TRUE;
1203 }
1204 else // isDefine
1205 {
1206 ol.endParameterExtra(false,false,true);
1207 }
1208 }
1209 first=FALSE;
1210 }
1211 if (first)
1212 {
1213 ol.startParameterName(defArgList.size()<2);
1214 ol.endParameterName();
1216 }
1217 ol.endParameterExtra(TRUE,defArgList.size()<2,!md->isObjCMethod());
1218 if (!md->extraTypeChars().isEmpty())
1219 {
1220 ol.docify(md->extraTypeChars());
1221 }
1222 if (defArgList.constSpecifier())
1223 {
1224 ol.docify(" const");
1225 }
1226 if (defArgList.volatileSpecifier())
1227 {
1228 ol.docify(" volatile");
1229 }
1230 if (defArgList.refQualifier()==RefQualifierType::LValue)
1231 {
1232 ol.docify(" &");
1233 }
1234 else if (defArgList.refQualifier()==RefQualifierType::RValue)
1235 {
1236 ol.docify(" &&");
1237 }
1238 if (!defArgList.trailingReturnType().isEmpty())
1239 {
1241 scope, // scope
1242 md->getBodyDef(), // fileScope
1243 md, // self
1244 defArgList.trailingReturnType(), // text
1245 FALSE // autoBreak
1246 );
1247
1248 }
1249 return TRUE;
1250}
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:6230
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 1291 of file memberdef.cpp.

1292{
1293 QCString exception(QCString(md->excpString()).stripWhiteSpace());
1294 if ('{'==exception.at(0))
1295 {
1296 // this is an UNO IDL attribute - need special handling
1297 int index = exception.find(';');
1298 int oldIndex = 1;
1299 while (-1 != index) // there should be no more than 2 (set / get)
1300 {
1301 // omit '{' and ';' -> "set raises (...)"
1302 writeExceptionListImpl(ol,cd,md,exception.mid(oldIndex,index-oldIndex));
1303 oldIndex=index+1;
1304 index = exception.find(';',oldIndex);
1305 }
1306 // the rest is now just '}' - omit that
1307 }
1308 else
1309 {
1310 writeExceptionListImpl(ol,cd,md,exception);
1311 }
1312}
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 1252 of file memberdef.cpp.

1254{
1255 // this is ordinary exception spec - there must be a '('
1256 //printf("exception='%s'\n",qPrint(exception));
1257 int index = exception.find('(');
1258 if (index!=-1)
1259 {
1260 ol.exceptionEntry(exception.left(index),false);
1261 ++index; // paren in second column so skip it here
1262 for (int comma = exception.find(',', index); comma!=-1; )
1263 {
1264 ++comma; // include comma
1266 exception.mid(index,comma-index));
1267 ol.exceptionEntry(QCString(),false);
1268 index=comma;
1269 comma = exception.find(',', index);
1270 }
1271 int close = exception.find(')', index);
1272 if (close!=-1)
1273 {
1274 QCString type=removeRedundantWhiteSpace(exception.mid(index,close-index));
1275 linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(),md,type);
1276 ol.exceptionEntry(QCString(),true);
1277 }
1278 else
1279 {
1280 warn(md->getDefFileName(),md->getDefLine(),
1281 "missing ) in exception list on member %s",qPrint(md->name()));
1282 }
1283 }
1284 else // Java Exception
1285 {
1286 ol.docify(" ");
1287 linkifyText(TextGeneratorOLImpl(ol),cd,md->getBodyDef(),md,exception);
1288 }
1289}
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:672
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 1975 of file memberdef.cpp.

Referenced by MemberDefImpl::getClassDefOfAnonymousType().

◆ g_detectUndocumentedParamsMutex

std::mutex g_detectUndocumentedParamsMutex
static

Definition at line 4164 of file memberdef.cpp.

Referenced by MemberDefImpl::detectUndocumentedParams().

◆ g_docCrossReferenceMutex

std::mutex g_docCrossReferenceMutex
static

Definition at line 6380 of file memberdef.cpp.

Referenced by addDocCrossReference().

◆ g_hasDetailedDescriptionMutex

std::mutex g_hasDetailedDescriptionMutex
static

Definition at line 2661 of file memberdef.cpp.

Referenced by MemberDefImpl::hasDetailedDescription().

◆ reAnonymous

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