summaryrefslogtreecommitdiffstats
path: root/src/groupdef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/groupdef.cpp')
-rw-r--r--src/groupdef.cpp242
1 files changed, 180 insertions, 62 deletions
diff --git a/src/groupdef.cpp b/src/groupdef.cpp
index 397b254..31eb7fe 100644
--- a/src/groupdef.cpp
+++ b/src/groupdef.cpp
@@ -40,11 +40,129 @@
#include "membername.h"
#include "dirdef.h"
#include "config.h"
+#include "definitionimpl.h"
//---------------------------------------------------------------------------
-GroupDef::GroupDef(const char *df,int dl,const char *na,const char *t,
- const char *refFileName) : Definition(df,dl,1,na)
+class GroupDefImpl : public DefinitionImpl, public GroupDef
+{
+ public:
+ GroupDefImpl(const char *fileName,int line,const char *name,const char *title,const char *refFileName=0);
+ virtual ~GroupDefImpl();
+
+ virtual DefType definitionType() const { return TypeGroup; }
+ virtual QCString getOutputFileBase() const;
+ virtual QCString anchor() const { return QCString(); }
+ virtual QCString displayName(bool=TRUE) const { return hasGroupTitle() ? title : DefinitionImpl::name(); }
+ virtual const char *groupTitle() const { return title; }
+ virtual void setGroupTitle( const char *newtitle );
+ virtual bool hasGroupTitle( ) const { return titleSet; }
+ virtual void addFile(const FileDef *def);
+ virtual bool addClass(const ClassDef *def);
+ virtual bool addNamespace(const NamespaceDef *def);
+ virtual void addGroup(const GroupDef *def);
+ virtual void addPage(PageDef *def);
+ virtual void addExample(const PageDef *def);
+ virtual void addDir(const DirDef *dd);
+ virtual bool insertMember(MemberDef *def,bool docOnly=FALSE);
+ virtual void removeMember(MemberDef *md);
+ virtual bool findGroup(const GroupDef *def) const; // true if def is a subgroup of this group
+ virtual void writeDocumentation(OutputList &ol);
+ virtual void writeMemberPages(OutputList &ol);
+ virtual void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const;
+ virtual void writeTagFile(FTextStream &);
+ virtual int countMembers() const;
+ virtual bool isLinkableInProject() const;
+ virtual bool isLinkable() const;
+ virtual bool isASubGroup() const;
+ virtual void computeAnchors();
+
+ virtual void addMembersToMemberGroup();
+ virtual void distributeMemberGroupDocumentation();
+ virtual void findSectionsInDocumentation();
+
+ virtual void addListReferences();
+ virtual void sortMemberLists();
+ virtual bool subGrouping() const { return m_subGrouping; }
+
+ virtual void setGroupScope(Definition *d) { groupScope = d; }
+ virtual Definition *getGroupScope() const { return groupScope; }
+
+ virtual MemberList *getMemberList(MemberListType lt) const;
+ virtual const QList<MemberList> &getMemberLists() const { return m_memberLists; }
+
+ /* user defined member groups */
+ virtual MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; }
+
+ virtual FileList * getFiles() const { return fileList; }
+ virtual ClassSDict * getClasses() const { return classSDict; }
+ virtual NamespaceSDict * getNamespaces() const { return namespaceSDict; }
+ virtual GroupList * getSubGroups() const { return groupList; }
+ virtual PageSDict * getPages() const { return pageDict; }
+ virtual DirList * getDirs() const { return dirList; }
+ virtual PageSDict * getExamples() const { return exampleDict; }
+ virtual bool hasDetailedDescription() const;
+ virtual void sortSubGroups();
+
+ private:
+ void addMemberListToGroup(MemberList *,bool (MemberDef::*)() const);
+ MemberList *createMemberList(MemberListType lt);
+ void addMemberToList(MemberListType lt,MemberDef *md);
+ void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title);
+ void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title);
+ void removeMemberFromList(MemberListType lt,MemberDef *md);
+ void writeGroupGraph(OutputList &ol);
+ void writeFiles(OutputList &ol,const QCString &title);
+ void writeNamespaces(OutputList &ol,const QCString &title);
+ void writeNestedGroups(OutputList &ol,const QCString &title);
+ void writeDirs(OutputList &ol,const QCString &title);
+ void writeClasses(OutputList &ol,const QCString &title);
+ void writeInlineClasses(OutputList &ol);
+ void writePageDocumentation(OutputList &ol);
+ void writeDetailedDescription(OutputList &ol,const QCString &title);
+ void writeBriefDescription(OutputList &ol);
+ void writeMemberGroups(OutputList &ol);
+ void startMemberDeclarations(OutputList &ol);
+ void endMemberDeclarations(OutputList &ol);
+ void startMemberDocumentation(OutputList &ol);
+ void endMemberDocumentation(OutputList &ol);
+ void writeAuthorSection(OutputList &ol);
+ void writeSummaryLinks(OutputList &ol);
+ void updateLanguage(const Definition *);
+
+ QCString title; // title of the group
+ bool titleSet; // true if title is not the same as the name
+ QCString fileName; // base name of the generated file
+ FileList *fileList; // list of files in the group
+ ClassSDict *classSDict; // list of classes in the group
+ NamespaceSDict *namespaceSDict; // list of namespaces in the group
+ GroupList *groupList; // list of sub groups.
+ PageSDict *pageDict; // list of pages in the group
+ PageSDict *exampleDict; // list of examples in the group
+ DirList *dirList; // list of directories in the group
+
+ MemberList *allMemberList;
+ MemberNameInfoSDict *allMemberNameInfoSDict;
+
+ Definition *groupScope;
+
+ QList<MemberList> m_memberLists;
+ MemberGroupSDict *memberGroupSDict;
+ bool m_subGrouping;
+
+};
+
+GroupDef *createGroupDef(const char *fileName,int line,const char *name,
+ const char *title,const char *refFileName)
+{
+ return new GroupDefImpl(fileName,line,name,title,refFileName);
+}
+
+
+//---------------------------------------------------------------------------
+
+GroupDefImpl::GroupDefImpl(const char *df,int dl,const char *na,const char *t,
+ const char *refFileName) : DefinitionImpl(df,dl,1,na)
{
fileList = new FileList;
classSDict = new ClassSDict(17);
@@ -69,12 +187,12 @@ GroupDef::GroupDef(const char *df,int dl,const char *na,const char *t,
allMemberList = new MemberList(MemberListType_allMembersList);
- visited = 0;
+ //visited = 0;
groupScope = 0;
m_subGrouping=Config_getBool(SUBGROUPING);
}
-GroupDef::~GroupDef()
+GroupDefImpl::~GroupDefImpl()
{
delete fileList;
delete classSDict;
@@ -88,7 +206,7 @@ GroupDef::~GroupDef()
delete dirList;
}
-void GroupDef::setGroupTitle( const char *t )
+void GroupDefImpl::setGroupTitle( const char *t )
{
if ( t && qstrlen(t) )
{
@@ -104,7 +222,7 @@ void GroupDef::setGroupTitle( const char *t )
}
-void GroupDef::distributeMemberGroupDocumentation()
+void GroupDefImpl::distributeMemberGroupDocumentation()
{
MemberGroupSDict::Iterator mgli(*memberGroupSDict);
MemberGroup *mg;
@@ -114,7 +232,7 @@ void GroupDef::distributeMemberGroupDocumentation()
}
}
-void GroupDef::findSectionsInDocumentation()
+void GroupDefImpl::findSectionsInDocumentation()
{
docFindSections(documentation(),this,0,docFile());
MemberGroupSDict::Iterator mgli(*memberGroupSDict);
@@ -135,7 +253,7 @@ void GroupDef::findSectionsInDocumentation()
}
}
-void GroupDef::addFile(const FileDef *def)
+void GroupDefImpl::addFile(const FileDef *def)
{
static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS);
if (def->isHidden()) return;
@@ -146,7 +264,7 @@ void GroupDef::addFile(const FileDef *def)
fileList->append(def);
}
-bool GroupDef::addClass(const ClassDef *cd)
+bool GroupDefImpl::addClass(const ClassDef *cd)
{
static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS);
if (cd->isHidden()) return FALSE;
@@ -194,7 +312,7 @@ bool GroupDef::addClass(const ClassDef *cd)
return FALSE;
}
-bool GroupDef::addNamespace(const NamespaceDef *def)
+bool GroupDefImpl::addNamespace(const NamespaceDef *def)
{
static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS);
if (def->isHidden()) return FALSE;
@@ -210,7 +328,7 @@ bool GroupDef::addNamespace(const NamespaceDef *def)
return FALSE;
}
-void GroupDef::addDir(const DirDef *def)
+void GroupDefImpl::addDir(const DirDef *def)
{
if (def->isHidden()) return;
if (Config_getBool(SORT_BRIEF_DOCS))
@@ -219,7 +337,7 @@ void GroupDef::addDir(const DirDef *def)
dirList->append(def);
}
-void GroupDef::addPage(PageDef *def)
+void GroupDefImpl::addPage(PageDef *def)
{
if (def->isHidden()) return;
//printf("Making page %s part of a group\n",def->name.data());
@@ -227,14 +345,14 @@ void GroupDef::addPage(PageDef *def)
def->makePartOfGroup(this);
}
-void GroupDef::addExample(const PageDef *def)
+void GroupDefImpl::addExample(const PageDef *def)
{
if (def->isHidden()) return;
exampleDict->append(def->name(),def);
}
-void GroupDef::addMembersToMemberGroup()
+void GroupDefImpl::addMembersToMemberGroup()
{
QListIterator<MemberList> mli(m_memberLists);
MemberList *ml;
@@ -246,7 +364,7 @@ void GroupDef::addMembersToMemberGroup()
}
}
- //printf("GroupDef::addMembersToMemberGroup() memberGroupList=%d\n",memberGroupList->count());
+ //printf("GroupDefImpl::addMembersToMemberGroup() memberGroupList=%d\n",memberGroupList->count());
MemberGroupSDict::Iterator mgli(*memberGroupSDict);
MemberGroup *mg;
for (;(mg=mgli.current());++mgli)
@@ -256,7 +374,7 @@ void GroupDef::addMembersToMemberGroup()
}
-bool GroupDef::insertMember(MemberDef *md,bool docOnly)
+bool GroupDefImpl::insertMember(MemberDef *md,bool docOnly)
{
if (md->isHidden()) return FALSE;
updateLanguage(md);
@@ -412,7 +530,7 @@ bool GroupDef::insertMember(MemberDef *md,bool docOnly)
addMemberToList(MemberListType_docFriendMembers,md);
break;
default:
- err("GroupDef::insertMembers(): "
+ err("GroupDefImpl::insertMembers(): "
"member `%s' (typeid=%d) with scope `%s' inserted in group scope `%s'!\n",
md->name().data(),md->memberType(),
md->getClassDef() ? md->getClassDef()->name().data() : "",
@@ -421,7 +539,7 @@ bool GroupDef::insertMember(MemberDef *md,bool docOnly)
return TRUE;
}
-void GroupDef::removeMember(MemberDef *md)
+void GroupDefImpl::removeMember(MemberDef *md)
{
// fprintf(stderr, "GroupDef(%s)::removeMember( %s )\n", title.data(), md->name().data());
MemberNameInfo *mni = allMemberNameInfoSDict->find(md->name());
@@ -503,12 +621,12 @@ void GroupDef::removeMember(MemberDef *md)
removeMemberFromList(MemberListType_docFriendMembers,md);
break;
default:
- err("GroupDef::removeMember(): unexpected member remove in file!\n");
+ err("GroupDefImpl::removeMember(): unexpected member remove in file!\n");
}
}
}
-bool GroupDef::findGroup(const GroupDef *def) const
+bool GroupDefImpl::findGroup(const GroupDef *def) const
{
if (this==def)
{
@@ -529,7 +647,7 @@ bool GroupDef::findGroup(const GroupDef *def) const
return FALSE;
}
-void GroupDef::addGroup(const GroupDef *def)
+void GroupDefImpl::addGroup(const GroupDef *def)
{
//printf("adding group `%s' to group `%s'\n",def->name().data(),name().data());
//if (Config_getBool(SORT_MEMBER_DOCS))
@@ -538,13 +656,13 @@ void GroupDef::addGroup(const GroupDef *def)
groupList->append(def);
}
-bool GroupDef::isASubGroup() const
+bool GroupDefImpl::isASubGroup() const
{
GroupList *groups = partOfGroups();
return groups!=0 && groups->count()!=0;
}
-int GroupDef::countMembers() const
+int GroupDefImpl::countMembers() const
{
return fileList->count()+
classSDict->count()+
@@ -556,13 +674,13 @@ int GroupDef::countMembers() const
}
/*! Compute the HTML anchor names for all members in the group */
-void GroupDef::computeAnchors()
+void GroupDefImpl::computeAnchors()
{
- //printf("GroupDef::computeAnchors()\n");
+ //printf("GroupDefImpl::computeAnchors()\n");
setAnchors(allMemberList);
}
-void GroupDef::writeTagFile(FTextStream &tagFile)
+void GroupDefImpl::writeTagFile(FTextStream &tagFile)
{
tagFile << " <compound kind=\"group\">" << endl;
tagFile << " <name>" << convertToXML(name()) << "</name>" << endl;
@@ -705,7 +823,7 @@ void GroupDef::writeTagFile(FTextStream &tagFile)
tagFile << " </compound>" << endl;
}
-void GroupDef::writeDetailedDescription(OutputList &ol,const QCString &title)
+void GroupDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title)
{
if ((!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF))
|| !documentation().isEmpty() || !inbodyDocumentation().isEmpty()
@@ -766,7 +884,7 @@ void GroupDef::writeDetailedDescription(OutputList &ol,const QCString &title)
}
}
-void GroupDef::writeBriefDescription(OutputList &ol)
+void GroupDefImpl::writeBriefDescription(OutputList &ol)
{
if (hasBriefDescription())
{
@@ -802,7 +920,7 @@ void GroupDef::writeBriefDescription(OutputList &ol)
ol.writeSynopsis();
}
-void GroupDef::writeGroupGraph(OutputList &ol)
+void GroupDefImpl::writeGroupGraph(OutputList &ol)
{
if (Config_getBool(HAVE_DOT) /*&& Config_getBool(GROUP_GRAPHS)*/ )
{
@@ -822,7 +940,7 @@ void GroupDef::writeGroupGraph(OutputList &ol)
}
}
-void GroupDef::writeFiles(OutputList &ol,const QCString &title)
+void GroupDefImpl::writeFiles(OutputList &ol,const QCString &title)
{
// write list of files
if (fileList->count()>0)
@@ -854,13 +972,13 @@ void GroupDef::writeFiles(OutputList &ol,const QCString &title)
}
}
-void GroupDef::writeNamespaces(OutputList &ol,const QCString &title)
+void GroupDefImpl::writeNamespaces(OutputList &ol,const QCString &title)
{
// write list of namespaces
namespaceSDict->writeDeclaration(ol,title);
}
-void GroupDef::writeNestedGroups(OutputList &ol,const QCString &title)
+void GroupDefImpl::writeNestedGroups(OutputList &ol,const QCString &title)
{
// write list of groups
int count=0;
@@ -910,7 +1028,7 @@ void GroupDef::writeNestedGroups(OutputList &ol,const QCString &title)
}
}
-void GroupDef::writeDirs(OutputList &ol,const QCString &title)
+void GroupDefImpl::writeDirs(OutputList &ol,const QCString &title)
{
// write list of directories
if (dirList->count()>0)
@@ -943,18 +1061,18 @@ void GroupDef::writeDirs(OutputList &ol,const QCString &title)
}
}
-void GroupDef::writeClasses(OutputList &ol,const QCString &title)
+void GroupDefImpl::writeClasses(OutputList &ol,const QCString &title)
{
// write list of classes
classSDict->writeDeclaration(ol,0,title,FALSE);
}
-void GroupDef::writeInlineClasses(OutputList &ol)
+void GroupDefImpl::writeInlineClasses(OutputList &ol)
{
classSDict->writeDocumentation(ol);
}
-void GroupDef::writePageDocumentation(OutputList &ol)
+void GroupDefImpl::writePageDocumentation(OutputList &ol)
{
PageDef *pd=0;
PageSDict::Iterator pdi(*pageDict);
@@ -977,7 +1095,7 @@ void GroupDef::writePageDocumentation(OutputList &ol)
}
}
-void GroupDef::writeMemberGroups(OutputList &ol)
+void GroupDefImpl::writeMemberGroups(OutputList &ol)
{
/* write user defined member groups */
if (memberGroupSDict)
@@ -993,19 +1111,19 @@ void GroupDef::writeMemberGroups(OutputList &ol)
}
}
-void GroupDef::startMemberDeclarations(OutputList &ol)
+void GroupDefImpl::startMemberDeclarations(OutputList &ol)
{
ol.startMemberSections();
}
-void GroupDef::endMemberDeclarations(OutputList &ol)
+void GroupDefImpl::endMemberDeclarations(OutputList &ol)
{
ol.endMemberSections();
}
-void GroupDef::startMemberDocumentation(OutputList &ol)
+void GroupDefImpl::startMemberDocumentation(OutputList &ol)
{
- //printf("** GroupDef::startMemberDocumentation()\n");
+ //printf("** GroupDefImpl::startMemberDocumentation()\n");
if (Config_getBool(SEPARATE_MEMBER_PAGES))
{
ol.pushGeneratorState();
@@ -1014,9 +1132,9 @@ void GroupDef::startMemberDocumentation(OutputList &ol)
}
}
-void GroupDef::endMemberDocumentation(OutputList &ol)
+void GroupDefImpl::endMemberDocumentation(OutputList &ol)
{
- //printf("** GroupDef::endMemberDocumentation()\n");
+ //printf("** GroupDefImpl::endMemberDocumentation()\n");
if (Config_getBool(SEPARATE_MEMBER_PAGES))
{
ol.popGeneratorState();
@@ -1024,7 +1142,7 @@ void GroupDef::endMemberDocumentation(OutputList &ol)
}
}
-void GroupDef::writeAuthorSection(OutputList &ol)
+void GroupDefImpl::writeAuthorSection(OutputList &ol)
{
// write Author section (Man only)
ol.pushGeneratorState();
@@ -1036,7 +1154,7 @@ void GroupDef::writeAuthorSection(OutputList &ol)
ol.popGeneratorState();
}
-void GroupDef::writeSummaryLinks(OutputList &ol)
+void GroupDefImpl::writeSummaryLinks(OutputList &ol)
{
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Html);
@@ -1081,7 +1199,7 @@ void GroupDef::writeSummaryLinks(OutputList &ol)
ol.popGeneratorState();
}
-void GroupDef::writeDocumentation(OutputList &ol)
+void GroupDefImpl::writeDocumentation(OutputList &ol)
{
//static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
ol.pushGeneratorState();
@@ -1258,7 +1376,7 @@ void GroupDef::writeDocumentation(OutputList &ol)
}
-void GroupDef::writeMemberPages(OutputList &ol)
+void GroupDefImpl::writeMemberPages(OutputList &ol)
{
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Html);
@@ -1276,7 +1394,7 @@ void GroupDef::writeMemberPages(OutputList &ol)
ol.popGeneratorState();
}
-void GroupDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const
+void GroupDefImpl::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const
{
static bool createSubDirs=Config_getBool(CREATE_SUBDIRS);
@@ -1525,12 +1643,12 @@ void addExampleToGroups(Entry *root,PageDef *eg)
}
}
-QCString GroupDef::getOutputFileBase() const
+QCString GroupDefImpl::getOutputFileBase() const
{
return fileName;
}
-void GroupDef::addListReferences()
+void GroupDefImpl::addListReferences()
{
{
QList<ListItemInfo> *xrefItems = xrefListItems();
@@ -1559,7 +1677,7 @@ void GroupDef::addListReferences()
}
}
-MemberList *GroupDef::createMemberList(MemberListType lt)
+MemberList *GroupDefImpl::createMemberList(MemberListType lt)
{
m_memberLists.setAutoDelete(TRUE);
QListIterator<MemberList> mli(m_memberLists);
@@ -1578,7 +1696,7 @@ MemberList *GroupDef::createMemberList(MemberListType lt)
return ml;
}
-void GroupDef::addMemberToList(MemberListType lt,MemberDef *md)
+void GroupDefImpl::addMemberToList(MemberListType lt,MemberDef *md)
{
static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS);
static bool sortMemberDocs = Config_getBool(SORT_MEMBER_DOCS);
@@ -1589,7 +1707,7 @@ void GroupDef::addMemberToList(MemberListType lt,MemberDef *md)
ml->append(md);
}
-void GroupDef::sortMemberLists()
+void GroupDefImpl::sortMemberLists()
{
QListIterator<MemberList> mli(m_memberLists);
MemberList *ml;
@@ -1599,7 +1717,7 @@ void GroupDef::sortMemberLists()
}
}
-MemberList *GroupDef::getMemberList(MemberListType lt) const
+MemberList *GroupDefImpl::getMemberList(MemberListType lt) const
{
QListIterator<MemberList> mli(m_memberLists);
MemberList *ml;
@@ -1613,7 +1731,7 @@ MemberList *GroupDef::getMemberList(MemberListType lt) const
return 0;
}
-void GroupDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title)
+void GroupDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title)
{
static bool optimizeVhdl = Config_getBool(OPTIMIZE_OUTPUT_VHDL);
@@ -1629,36 +1747,36 @@ void GroupDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QC
}
}
-void GroupDef::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title)
+void GroupDefImpl::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title)
{
MemberList * ml = getMemberList(lt);
if (ml) ml->writeDocumentation(ol,name(),this,title);
}
-void GroupDef::removeMemberFromList(MemberListType lt,MemberDef *md)
+void GroupDefImpl::removeMemberFromList(MemberListType lt,MemberDef *md)
{
MemberList *ml = getMemberList(lt);
if (ml) ml->remove(md);
}
-void GroupDef::sortSubGroups()
+void GroupDefImpl::sortSubGroups()
{
groupList->sort();
}
-bool GroupDef::isLinkableInProject() const
+bool GroupDefImpl::isLinkableInProject() const
{
return !isReference() && isLinkable();
}
-bool GroupDef::isLinkable() const
+bool GroupDefImpl::isLinkable() const
{
return hasUserDocumentation();
}
// let the "programming language" for a group depend on what is inserted into it.
// First item that has an associated languages determines the language for the whole group.
-void GroupDef::updateLanguage(const Definition *d)
+void GroupDefImpl::updateLanguage(const Definition *d)
{
if (getLanguage()==SrcLangExt_Unknown && d->getLanguage()!=SrcLangExt_Unknown)
{
@@ -1666,7 +1784,7 @@ void GroupDef::updateLanguage(const Definition *d)
}
}
-bool GroupDef::hasDetailedDescription() const
+bool GroupDefImpl::hasDetailedDescription() const
{
static bool repeatBrief = Config_getBool(REPEAT_BRIEF);
return ((!briefDescription().isEmpty() && repeatBrief) ||