From 4e75d77f60bd173019247177686376ce36ace90b Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 22 Nov 2020 14:20:17 +0100 Subject: issue #8070: C++: \var don't document enum class values --- src/doxygen.cpp | 27 ++++++++++++++++++++++++++- src/memberdef.cpp | 18 ++++++++++-------- src/memberlist.cpp | 4 ++++ 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 13b275f..6c8c67a 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -5454,7 +5454,8 @@ static void addMemberFunction(const Entry *root, qPrint(scopeName),cd ? qPrint(cd->name()) : "", qPrint(md->argsString()), qPrint(root->fileName)); - //printf("Member %s (member scopeName=%s) (this scopeName=%s) classTempList=%s\n",md->name().data(),cd->name().data(),scopeName.data(),classTempList.data()); + //printf("Member %s (member scopeName=%s) (this scopeName=%s) isEnumValue()=%d\n", + // md->name().data(),cd->name().data(),scopeName.data(),md->isEnumValue()); FileDef *fd=root->fileDef(); NamespaceDef *nd=0; if (!namespaceName.isEmpty()) nd=getResolvedNamespace(namespaceName); @@ -5462,6 +5463,30 @@ static void addMemberFunction(const Entry *root, //printf("scopeName %s->%s\n",scopeName.data(), // stripTemplateSpecifiersFromScope(scopeName,FALSE).data()); + // if the member we are searching for is an enum value that is part of + // a "strong" enum, we need to look into the fields of the enum for a match + int enumNamePos=0; + if (md->isEnumValue() && (enumNamePos=className.findRev("::"))!=-1) + { + QCString enumName = className.mid(enumNamePos+2); + if (className.left(enumNamePos)==cd->name()) + { + MemberName *enumMn=Doxygen::memberNameLinkedMap->find(enumName); + //printf("enumMn(%s)=%p\n",className.data(),enumMn); + if (enumMn) + { + for (const auto &emd : *enumMn) + { + memFound = emd->isStrong() && md->getEnumScope()==emd.get(); + addMemberDocs(root,md,funcDecl,0,overloaded,spec); + count++; + if (memFound) break; + } + } + } + } + if (memFound) break; + const ClassDef *tcd=findClassDefinition(fd,nd,scopeName); if (tcd==0 && cd && stripAnonymousNamespaceScope(cd->name())==scopeName) { diff --git a/src/memberdef.cpp b/src/memberdef.cpp index b7ac968..7fe95db 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -1884,10 +1884,10 @@ void MemberDefImpl::writeLink(OutputList &ol, const NamespaceDef *nspace = getNamespaceDef(); if (!hideScopeNames) { - if (m_impl->enumScope && m_impl->livesInsideEnum) - { - n.prepend(m_impl->enumScope->displayName()+sep); - } + //if (m_impl->enumScope && m_impl->livesInsideEnum) + //{ + // n.prepend(m_impl->enumScope->displayName()+sep); + //} if (classDef && gd && !isRelated()) { n.prepend(classDef->displayName()+sep); @@ -4637,10 +4637,15 @@ void MemberDefImpl::writeEnumDeclaration(OutputList &typeDecl, MemberListIterator mli(*fmdl); MemberDefMutable *fmd=toMemberDefMutable(mli.current()); bool fmdVisible = fmd ? fmd->isBriefSectionVisible() : TRUE; + bool first=true; while (fmd) { if (fmdVisible) { + if (!first) + { + typeDecl.writeString(", "); + } /* in html we start a new line after a number of items */ if (numVisibleEnumValues>enumValuesPerLine && (enumMemCount%enumValuesPerLine)==0 @@ -4675,15 +4680,12 @@ void MemberDefImpl::writeEnumDeclaration(OutputList &typeDecl, typeDecl.writeString(" "); typeDecl.parseText(fmd->initializer()); } + first=false; } bool prevVisible = fmdVisible; ++mli; fmd=toMemberDefMutable(mli.current()); - if (fmd && (fmdVisible=fmd->isBriefSectionVisible())) - { - typeDecl.writeString(", "); - } if (prevVisible) { typeDecl.disable(OutputGenerator::Man); diff --git a/src/memberlist.cpp b/src/memberlist.cpp index 11b6c9f..ed10bed 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -508,6 +508,10 @@ void MemberList::writePlainDeclarations(OutputList &ol, ol.writeString("local "); } ol.writeString("enum "); + if (md->isStrong()) + { + ol.writeString("class "); + } ol.insertMemberAlign(); md->writeEnumDeclaration(ol,cd,nd,fd,gd); if (!detailsLinkable) -- cgit v0.12