Skip to content

Commit

Permalink
Bug 766809 - Enumerations heading present but none listed
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitri van Heesch committed May 25, 2016
1 parent ee9a066 commit e7ac59b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 37 deletions.
65 changes: 28 additions & 37 deletions src/memberlist.cpp
Expand Up @@ -253,6 +253,32 @@ MemberListIterator::MemberListIterator(const QList<MemberDef> &l) :
{
}

int MemberList::countEnumValues(MemberDef *md,bool setAnonEnumType) const
{
int enumVars=0;
MemberListIterator vmli(*this);
MemberDef *vmd;
QCString name(md->name());
int i=name.findRev("::");
if (i!=-1) name=name.right(name.length()-i-2); // strip scope (TODO: is this needed?)
if (name[0]=='@') // anonymous enum => append variables
{
for ( ; (vmd=vmli.current()) ; ++vmli)
{
QCString vtype=vmd->typeString();
if ((vtype.find(name))!=-1)
{
enumVars++;
if (setAnonEnumType)
{
vmd->setAnonymousEnumType(md);
}
}
}
}
return enumVars;
}

bool MemberList::declVisible() const
{
MemberListIterator mli(*this);
Expand All @@ -277,26 +303,9 @@ bool MemberList::declVisible() const
return TRUE;
case MemberType_Enumeration:
{
int enumVars=0;
MemberListIterator vmli(*this);
MemberDef *vmd;
QCString name(md->name());
int i=name.findRev("::");
if (i!=-1) name=name.right(name.length()-i-2); // strip scope (TODO: is this needed?)
if (name[0]=='@') // anonymous enum => append variables
{
for ( ; (vmd=vmli.current()) ; ++vmli)
{
QCString vtype=vmd->typeString();
if ((vtype.find(name))!=-1)
{
enumVars++;
}
}
}
// if this is an anonymous enum and there are variables of this
// enum type (i.e. enumVars>0), then we do not show the enum here.
if (enumVars==0) // show enum here
if (countEnumValues(md,FALSE)==0) // show enum here
{
return TRUE;
}
Expand Down Expand Up @@ -368,27 +377,9 @@ void MemberList::writePlainDeclarations(OutputList &ol,
}
case MemberType_Enumeration:
{
int enumVars=0;
MemberListIterator vmli(*this);
MemberDef *vmd;
QCString name(md->name());
int i=name.findRev("::");
if (i!=-1) name=name.right(name.length()-i-2); // strip scope (TODO: is this needed?)
if (name[0]=='@') // anonymous enum => append variables
{
for ( ; (vmd=vmli.current()) ; ++vmli)
{
QCString vtype=vmd->typeString();
if ((vtype.find(name))!=-1)
{
enumVars++;
vmd->setAnonymousEnumType(md);
}
}
}
// if this is an anonymous enum and there are variables of this
// enum type (i.e. enumVars>0), then we do not show the enum here.
if (enumVars==0 && !hideUndocMembers) // show enum here
if (countEnumValues(md,TRUE)==0) // show enum here
{
//printf("Enum!!\n");
if (first)
Expand Down
1 change: 1 addition & 0 deletions src/memberlist.h
Expand Up @@ -82,6 +82,7 @@ class MemberList : public QList<MemberDef>

private:
int compareValues(const MemberDef *item1,const MemberDef *item2) const;
int countEnumValues(MemberDef *md,bool setAnonEnumType) const;
int m_varCnt;
int m_funcCnt;
int m_enumCnt;
Expand Down

0 comments on commit e7ac59b

Please sign in to comment.