diff options
author | Szabi Tolnai <Szabi.Tolnai@cirrus.com> | 2020-08-10 09:53:34 (GMT) |
---|---|---|
committer | Szabi Tolnai <Szabi.Tolnai@cirrus.com> | 2020-08-11 13:52:36 (GMT) |
commit | 970b3469a3beaf7041a2efce8d81515077003232 (patch) | |
tree | 13e85888a90134690f50fc18c17ab77e742db99d | |
parent | 047adfbbc66eaa432ec9cea00e3801e3b4e1bca8 (diff) | |
download | Doxygen-970b3469a3beaf7041a2efce8d81515077003232.zip Doxygen-970b3469a3beaf7041a2efce8d81515077003232.tar.gz Doxygen-970b3469a3beaf7041a2efce8d81515077003232.tar.bz2 |
Support commented out argument names in declarations controlled by new cofig EXTRACT_ANON_ARGUMENTS.
-rw-r--r-- | src/config.xml | 8 | ||||
-rw-r--r-- | src/memberdef.cpp | 64 | ||||
-rw-r--r-- | src/memberdef.h | 1 |
3 files changed, 72 insertions, 1 deletions
diff --git a/src/config.xml b/src/config.xml index b3718be..7bacf3e 100644 --- a/src/config.xml +++ b/src/config.xml @@ -916,6 +916,14 @@ Go to the <a href="commands.html">next</a> section or return to the ]]> </docs> </option> + <option type='bool' id='EXTRACT_ANON_ARGUMENTS' defval='0'> + <docs> +<![CDATA[ + If this flag is set to \c YES, the name of anonymous arguments in declarations will be + extracted from the definitions. By default anonymous arguments will stay nameless. +]]> + </docs> + </option> <option type='bool' id='HIDE_UNDOC_MEMBERS' defval='0'> <docs> <![CDATA[ diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 312e13e..dc4363a 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -277,6 +277,7 @@ class MemberDefImpl : public DefinitionImpl, public MemberDef virtual void setDeclFile(const QCString &df,int line,int column); virtual void moveArgumentList(std::unique_ptr<ArgumentList> al); virtual void moveDeclArgumentList(std::unique_ptr<ArgumentList> al); + virtual void extractArgumentNames(const MemberDef& md); virtual void setDefinitionTemplateParameterLists(const ArgumentLists &lists); virtual void setTypeConstraints(const ArgumentList &al); virtual void setType(const char *t); @@ -789,6 +790,7 @@ class MemberDefAliasImpl : public DefinitionAliasImpl, public MemberDef virtual void setDeclFile(const QCString &df,int line,int column) {} virtual void moveArgumentList(std::unique_ptr<ArgumentList> al) {} virtual void moveDeclArgumentList(std::unique_ptr<ArgumentList> al) {} + virtual void extractArgumentNames(const MemberDef& md) {} virtual void setDefinitionTemplateParameterLists(const ArgumentLists &lists) {} virtual void setTypeConstraints(const ArgumentList &al) {} virtual void setType(const char *t) {} @@ -5483,6 +5485,54 @@ const ArgumentList &MemberDefImpl::declArgumentList() const return m_impl->declArgList; } +void MemberDefImpl::extractArgumentNames(const MemberDef& md) +{ + ArgumentList &decAl = m_impl->declArgList; + ArgumentList &defAl = m_impl->defArgList; + const ArgumentList &decAlSrc = md.declArgumentList(); + const ArgumentList &defAlSrc = md.argumentList(); + auto decSrc = decAlSrc.begin(), defSrc = defAlSrc.begin(); + for (auto decIt = decAl.begin(), defIt = defAl.begin(); + decIt != decAl.end() && defIt != defAl.end() && decSrc != decAlSrc.end() && defSrc != defAlSrc.end(); + ++decIt, ++defIt, ++decSrc, ++defSrc++) + { + Argument &decA = *decIt; + Argument &defA = *defIt; + const Argument &decAS = *decSrc; + const Argument &defAS = *defSrc; + if (decA.name.isEmpty()) + { + if (!defA.name.isEmpty()) + { + decA.name = defA.name; + } + else if (!decAS.name.isEmpty()) + { + decA.name = decAS.name; + } + else if (!defAS.name.isEmpty()) + { + decA.name = defAS.name; + } + } + if (defA.name.isEmpty()) + { + if (!decA.name.isEmpty()) + { + defA.name = decA.name; + } + else if (!decAS.name.isEmpty()) + { + defA.name = decAS.name; + } + else if (!defAS.name.isEmpty()) + { + defA.name = defAS.name; + } + } + } +} + const ArgumentList &MemberDefImpl::templateArguments() const { return m_impl->tArgList; @@ -5949,6 +5999,14 @@ static void transferArgumentDocumentation(ArgumentList &decAl,ArgumentList &defA { defA.docs = decA.docs; } + if (decA.name.isEmpty() && !defA.name.isEmpty()) + { + decA.name = defA.name; + } + else if (defA.name.isEmpty() && !decA.name.isEmpty()) + { + defA.name = decA.name; + } } } @@ -5980,6 +6038,11 @@ void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef) // mdec->getFileDef()->name().data(),mdec->documentation().data() // ); + if (Config_getBool(EXTRACT_ANON_ARGUMENTS)) + { + mdec->extractArgumentNames(*mdef); + } + // first merge argument documentation transferArgumentDocumentation(mdecAl,mdefAl); @@ -6041,7 +6104,6 @@ void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef) mdec->mergeMemberSpecifiers(mdef->getMemberSpecifiers()); mdef->mergeMemberSpecifiers(mdec->getMemberSpecifiers()); - // copy group info. if (mdec->getGroupDef()==0 && mdef->getGroupDef()!=0) { diff --git a/src/memberdef.h b/src/memberdef.h index 4a488d9..5a1e951 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -336,6 +336,7 @@ class MemberDef : virtual public Definition // argument related members virtual void moveArgumentList(std::unique_ptr<ArgumentList> al) = 0; virtual void moveDeclArgumentList(std::unique_ptr<ArgumentList> al) = 0; + virtual void extractArgumentNames(const MemberDef& md) = 0; virtual void setDefinitionTemplateParameterLists(const ArgumentLists &lists) = 0; virtual void setTypeConstraints(const ArgumentList &al) = 0; virtual void setType(const char *t) = 0; |