Skip to content

Commit e5e0d79

Browse files
committed
More flexible group dependency graphs regarding show / hide
For call / caller / include / included by graphs it is possible to steer the graph creation process on a 1 to 1 base (commands like \callgraph and \hidecallgraph). Introducing for the group dependency graphs: ``` \groupgraph and \hidegroupgraph ```
1 parent ddd687a commit e5e0d79

11 files changed

+99
-3
lines changed

doc/commands.doc

+28
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,12 @@ documentation:
116116
\refitem cmdfile \\file
117117
\refitem cmdfileinfo \\fileinfo
118118
\refitem cmdfn \\fn
119+
\refitem cmdgroupgraph \\groupgraph
119120
\refitem cmdheaderfile \\headerfile
120121
\refitem cmdhidecallergraph \\hidecallergraph
121122
\refitem cmdhidecallgraph \\hidecallgraph
122123
\refitem cmdhidedirectorygraph \\hidedirectorygraph
124+
\refitem cmdhidegroupgraph \\hidegroupgraph
123125
\refitem cmdhideincludedbygraph \\hideincludedbygraph
124126
\refitem cmdhideincludegraph \\hideincludegraph
125127
\refitem cmdhiderefby \\hiderefby
@@ -515,6 +517,32 @@ Structural indicators
515517
\sa section \ref cmddirectorygraph "\\directorygraph",
516518
option \ref cfg_directory_graph "DIRECTORY_GRAPH"
517519

520+
<hr>
521+
\section cmdgroupgraph \\groupgraph
522+
523+
\addindex \\groupgraph
524+
When this command is put in a comment block of a
525+
\ref cmddefgroup "\\defgroup" command
526+
then doxygen will generate a group dependency graph for that group. The
527+
group graph will be generated regardless of the value of
528+
\ref cfg_group_graphs "GROUP_GRAPHS".
529+
530+
\sa section \ref cmdhidegroupgraph "\\hidegroupgraph",
531+
option \ref cfg_group_graphs "GROUP_GRAPHS"
532+
533+
<hr>
534+
\section cmdhidegroupgraph \\hidegroupgraph
535+
536+
\addindex \\hidegroupgraph
537+
When this command is put in a comment block of a
538+
\ref cmddefgroup "\\defgroup" command
539+
then doxygen will not generate a group dependency graph for that group. The
540+
group graph will not be generated regardless of the value of
541+
\ref cfg_group_graphs "GROUP_GRAPHS".
542+
543+
\sa section \ref cmdgroupgraph "\\groupgraph",
544+
option \ref cfg_group_graphs "GROUP_GRAPHS"
545+
518546
<hr>
519547
\section cmdqualifier \\qualifier <label> | "(text)"
520548

src/commentscan.l

+18
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ static bool handleReferencedByRelation(yyscan_t yyscanner,const QCString &, cons
134134
static bool handleHideReferencedByRelation(yyscan_t yyscanner,const QCString &, const StringVector &);
135135
static bool handleReferencesRelation(yyscan_t yyscanner,const QCString &, const StringVector &);
136136
static bool handleHideReferencesRelation(yyscan_t yyscanner,const QCString &, const StringVector &);
137+
static bool handleGroupgraph(yyscan_t yyscanner,const QCString &, const StringVector &);
138+
static bool handleHideGroupgraph(yyscan_t yyscanner,const QCString &, const StringVector &);
137139
static bool handleInternal(yyscan_t yyscanner,const QCString &, const StringVector &);
138140
static bool handleStatic(yyscan_t yyscanner,const QCString &, const StringVector &);
139141
static bool handlePure(yyscan_t yyscanner,const QCString &, const StringVector &);
@@ -227,10 +229,12 @@ static const std::map< std::string, DocCmdMap > docCmdMap =
227229
{ "extends", { &handleExtends, CommandSpacing::Invisible }},
228230
{ "file", { &handleFile, CommandSpacing::Invisible }},
229231
{ "fn", { &handleFn, CommandSpacing::Invisible }},
232+
{ "groupgraph", { &handleGroupgraph, CommandSpacing::Invisible }},
230233
{ "headerfile", { &handleHeaderFile, CommandSpacing::Invisible }},
231234
{ "hidecallergraph", { &handleHideCallergraph, CommandSpacing::Invisible }},
232235
{ "hidecallgraph", { &handleHideCallgraph, CommandSpacing::Invisible }},
233236
{ "hidedirectorygraph", { &handleHideDirectoryGraph, CommandSpacing::Invisible }},
237+
{ "hidegroupgraph", { &handleHideGroupgraph, CommandSpacing::Invisible }},
234238
{ "hideincludedbygraph", { &handleHideIncludedBygraph, CommandSpacing::Invisible }},
235239
{ "hideincludegraph", { &handleHideIncludegraph, CommandSpacing::Invisible }},
236240
{ "hideinitializer", { &handleHideInitializer, CommandSpacing::Invisible }},
@@ -3123,6 +3127,20 @@ static bool handleHideDirectoryGraph(yyscan_t yyscanner,const QCString &, const
31233127
return FALSE;
31243128
}
31253129

3130+
static bool handleGroupgraph(yyscan_t yyscanner,const QCString &, const StringVector &)
3131+
{
3132+
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3133+
yyextra->current->groupGraph = TRUE; // ON
3134+
return FALSE;
3135+
}
3136+
3137+
static bool handleHideGroupgraph(yyscan_t yyscanner,const QCString &, const StringVector &)
3138+
{
3139+
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
3140+
yyextra->current->groupGraph = FALSE; // OFF
3141+
return FALSE;
3142+
}
3143+
31263144
static bool handleQualifier(yyscan_t yyscanner,const QCString &cmd, const StringVector &)
31273145
{
31283146
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;

src/config.xml

+4
Original file line numberDiff line numberDiff line change
@@ -3769,6 +3769,10 @@ where `loc1` and `loc2` can be relative or absolute paths or URLs.
37693769
<![CDATA[
37703770
If the \c GROUP_GRAPHS tag is set to \c YES then doxygen
37713771
will generate a graph for groups, showing the direct groups dependencies.
3772+
Explicit enabling a group dependency graph, when \c GROUP_GRAPHS is set to \c NO, can be
3773+
accomplished by means of the command \ref cmdgroupgraph "\\groupgraph".
3774+
Disabling a directory graph can be accomplished by means of the command
3775+
\ref cmdhidegroupgraph "\\hidegroupgraph".
37723776
37733777
See also the chapter \ref grouping "Grouping" in the manual.
37743778
]]>

src/dotgroupcollaboration.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,16 @@ bool DotGroupCollaboration::isTrivial() const
321321
return m_usedNodes.size() <= 1;
322322
}
323323

324+
bool DotGroupCollaboration::isTooBig() const
325+
{
326+
return numNodes()>=Config_getInt(DOT_GRAPH_MAX_NODES);
327+
}
328+
329+
int DotGroupCollaboration::numNodes() const
330+
{
331+
return static_cast<int>(m_usedNodes.size());
332+
}
333+
324334
void DotGroupCollaboration::writeGraphHeader(TextStream &t,const QCString &title) const
325335
{
326336
DotGraph::writeGraphHeader(t, title);

src/dotgroupcollaboration.h

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class DotGroupCollaboration : public DotGraph
3434
const QCString &path,const QCString &fileName,const QCString &relPath,
3535
bool writeImageMap=TRUE,int graphId=-1);
3636
bool isTrivial() const;
37+
bool isTooBig() const;
38+
int numNodes() const;
3739

3840
protected:
3941
virtual QCString getBaseName() const;

src/doxygen.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,10 @@ static void buildGroupListFiltered(const Entry *root,bool additional, bool inclu
368368
gd->addSectionsToDefinition(root->anchors);
369369
gd->setRefItems(root->sli);
370370
gd->setLanguage(root->lang);
371+
if (root->groupDocType==Entry::GROUPDOC_NORMAL)
372+
{
373+
gd->enableGroupGraph(root->groupGraph);
374+
}
371375
}
372376
else
373377
{
@@ -391,6 +395,10 @@ static void buildGroupListFiltered(const Entry *root,bool additional, bool inclu
391395
gd->addSectionsToDefinition(root->anchors);
392396
gd->setRefItems(root->sli);
393397
gd->setLanguage(root->lang);
398+
if (root->groupDocType==Entry::GROUPDOC_NORMAL)
399+
{
400+
gd->enableGroupGraph(root->groupGraph);
401+
}
394402
}
395403
}
396404
}

src/entry.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Entry::Entry(const Entry &e)
6868
includeGraph = e.includeGraph;
6969
includedByGraph = e.includedByGraph;
7070
directoryGraph = e.directoryGraph;
71+
groupGraph = e.groupGraph;
7172
referencedByRelation = e.referencedByRelation;
7273
referencesRelation = e.referencesRelation;
7374
exported = e.exported;
@@ -194,6 +195,7 @@ void Entry::reset()
194195
bool entryIncludeGraph = Config_getBool(INCLUDE_GRAPH);
195196
bool entryIncludedByGraph = Config_getBool(INCLUDED_BY_GRAPH);
196197
bool entryDirectoryGraph = Config_getBool(DIRECTORY_GRAPH);
198+
bool entryGroupGraph = Config_getBool(GROUP_GRAPHS);
197199
//printf("Entry::reset()\n");
198200
name.resize(0);
199201
type.resize(0);
@@ -229,6 +231,7 @@ void Entry::reset()
229231
includeGraph = entryIncludeGraph;
230232
includedByGraph = entryIncludedByGraph;
231233
directoryGraph = entryDirectoryGraph;
234+
groupGraph = entryGroupGraph;
232235
referencedByRelation = entryReferencedByRelation;
233236
referencesRelation = entryReferencesRelation;
234237
exported = false;

src/entry.h

+1
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ class Entry
259259
bool includeGraph; //!< do we need to draw the include graph?
260260
bool includedByGraph; //!< do we need to draw the included by graph?
261261
bool directoryGraph; //!< do we need to draw the directory graph?
262+
bool groupGraph; //!< do we need to draw the group graph?
262263
bool exported; //!< is the symbol exported from a C++20 module
263264
Specifier virt; //!< virtualness of the entry
264265
QCString args; //!< member argument string

src/groupdef.cpp

+21-2
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ class GroupDefImpl : public DefinitionMixin<GroupDef>
119119
virtual void sortSubGroups() override;
120120
virtual void writeSummaryLinks(OutputList &ol) const override;
121121

122+
virtual bool hasGroupGraph() const override;
123+
virtual void enableGroupGraph(bool e) override;
122124
private:
123125
void addMemberListToGroup(MemberList *,bool (MemberDef::*)() const);
124126
void addMemberToList(MemberListType lt,MemberDef *md);
@@ -164,6 +166,7 @@ class GroupDefImpl : public DefinitionMixin<GroupDef>
164166
MemberLists m_memberLists;
165167
MemberGroupList m_memberGroups;
166168
bool m_subGrouping;
169+
bool m_hasGroupGraph = false;
167170

168171
};
169172

@@ -193,6 +196,7 @@ GroupDefImpl::GroupDefImpl(const QCString &df,int dl,const QCString &na,const QC
193196
//visited = 0;
194197
m_groupScope = 0;
195198
m_subGrouping=Config_getBool(SUBGROUPING);
199+
m_hasGroupGraph=Config_getBool(GROUP_GRAPHS);
196200
}
197201

198202
GroupDefImpl::~GroupDefImpl()
@@ -873,10 +877,15 @@ void GroupDefImpl::writeBriefDescription(OutputList &ol)
873877

874878
void GroupDefImpl::writeGroupGraph(OutputList &ol)
875879
{
876-
if (Config_getBool(HAVE_DOT) /*&& Config_getBool(GROUP_GRAPHS)*/ )
880+
if (Config_getBool(HAVE_DOT) && m_hasGroupGraph /*&& Config_getBool(GROUP_GRAPHS)*/)
877881
{
878882
DotGroupCollaboration graph(this);
879-
if (!graph.isTrivial())
883+
if (graph.isTooBig())
884+
{
885+
warn_uncond("Group dependency graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n",
886+
qPrint(name()), graph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES));
887+
}
888+
else if (!graph.isTrivial())
880889
{
881890
msg("Generating dependency graph for group %s\n",qPrint(qualifiedName()));
882891
ol.pushGeneratorState();
@@ -1882,6 +1891,16 @@ bool GroupDefImpl::hasDetailedDescription() const
18821891
(m_pages.size()!=numDocMembers());
18831892
}
18841893

1894+
void GroupDefImpl::enableGroupGraph(bool e)
1895+
{
1896+
m_hasGroupGraph=e;
1897+
}
1898+
1899+
bool GroupDefImpl::hasGroupGraph() const
1900+
{
1901+
return m_hasGroupGraph;
1902+
}
1903+
18851904
// --- Cast functions
18861905

18871906
GroupDef *toGroupDef(Definition *d)

src/groupdef.h

+3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ class GroupDef : public DefinitionMutable, public Definition
112112
virtual bool hasDetailedDescription() const = 0;
113113
virtual void sortSubGroups() = 0;
114114

115+
// group graph related members
116+
virtual bool hasGroupGraph() const = 0;
117+
virtual void enableGroupGraph(bool e) = 0;
115118
};
116119

117120
std::unique_ptr<GroupDef> createGroupDef(const QCString &fileName,int line,const QCString &name,

templates/general/layout_default.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@
184184
<!-- Layout definition for a group page -->
185185
<group>
186186
<briefdescription visible="yes"/>
187-
<groupgraph visible="$GROUP_GRAPHS"/>
187+
<groupgraph visible="yes"/>
188188
<memberdecl>
189189
<nestedgroups visible="yes" title=""/>
190190
<modules visible="yes" title=""/>

0 commit comments

Comments
 (0)