summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/groupdef.cpp26
-rw-r--r--src/groupdef.h2
2 files changed, 10 insertions, 18 deletions
diff --git a/src/groupdef.cpp b/src/groupdef.cpp
index 5c08048..64a3902 100644
--- a/src/groupdef.cpp
+++ b/src/groupdef.cpp
@@ -508,29 +508,21 @@ void GroupDef::removeMember(MemberDef *md)
}
}
-bool GroupDef::containsGroup(const GroupDef *def)
+bool GroupDef::findGroup(const GroupDef *def) const
{
if (this==def)
{
return TRUE;
}
- else if (groupList->find(def)>=0)
+ else if (groupList)
{
- return TRUE;
- }
- else // look for subgroups as well
- {
- GroupList *groups = partOfGroups();
- if (groups)
+ GroupListIterator it(*groupList);
+ GroupDef *gd;
+ for (;(gd=it.current());++it)
{
- GroupListIterator it(*groups);
- GroupDef *gd;
- for (;(gd=it.current());++it)
+ if (gd->findGroup(def))
{
- if (gd->containsGroup(def))
- {
- return TRUE;
- }
+ return TRUE;
}
}
}
@@ -1377,12 +1369,12 @@ void addGroupToGroups(Entry *root,GroupDef *subGroup)
warn(root->fileName,root->startLine,"Refusing to add group %s to itself",
gd->name().data());
}
- else if (gd->containsGroup(subGroup))
+ else if (subGroup->findGroup(gd))
{
warn(root->fileName,root->startLine,"Refusing to add group %s to group %s, since the latter is already a "
"subgroup of the former\n", subGroup->name().data(),gd->name().data());
}
- else
+ else if (!gd->findGroup(subGroup))
{
gd->addGroup(subGroup);
subGroup->makePartOfGroup(gd);
diff --git a/src/groupdef.h b/src/groupdef.h
index a21311b..a6ae533 100644
--- a/src/groupdef.h
+++ b/src/groupdef.h
@@ -64,7 +64,7 @@ class GroupDef : public Definition
void addDir(const DirDef *dd);
bool insertMember(MemberDef *def,bool docOnly=FALSE);
void removeMember(MemberDef *md);
- bool containsGroup(const GroupDef *def); // true if def is already a subgroup
+ bool findGroup(const GroupDef *def) const; // true if def is a subgroup of this group
void writeDocumentation(OutputList &ol);
void writeMemberPages(OutputList &ol);
void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const;