Skip to content

Commit

Permalink
Add commands to handle referenced by relation and references relation
Browse files Browse the repository at this point in the history
Analogous to call graph and caller graph this patch provides an implementation for the referenced by relation and references relation.
Providing the commands:
- referencedbyrelation
- hidereferencedbyrelation
- referencesrelation
- hidereferencesrelation

Motivation is that some lists can get extremely large and also there is now more symmetry between the textual and graphical out.
  • Loading branch information
albert-github committed Oct 17, 2018
1 parent 2f50bc0 commit 0697535
Show file tree
Hide file tree
Showing 12 changed files with 236 additions and 20 deletions.
77 changes: 74 additions & 3 deletions doc/commands.doc
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ documentation:
\refitem cmdheaderfile \\headerfile
\refitem cmdhidecallergraph \\hidecallergraph
\refitem cmdhidecallgraph \\hidecallgraph
\refitem cmdhidereferencedbyrelation \\hidereferencedbyrelation
\refitem cmdhidereferencesrelation \\hidereferencesrelation
\refitem cmdhideinitializer \\hideinitializer
\refitem cmdhtmlinclude \\htmlinclude
\refitem cmdhtmlonly \\htmlonly
Expand Down Expand Up @@ -156,7 +158,9 @@ documentation:
\refitem cmdpublicsection \\publicsection
\refitem cmdpure \\pure
\refitem cmdref \\ref
\refitem cmdrefitem \\refitem
\refitem cmdreferencedbyrelation \\refitem
\refitem cmdrefitem \\referencedbyrelation
\refitem cmdreferencesrelation \\referencesrelation
\refitem cmdrelated \\related
\refitem cmdrelates \\relates
\refitem cmdrelatedalso \\relatedalso
Expand Down Expand Up @@ -306,7 +310,7 @@ Structural indicators
When this command is put in a comment block of a function or method
and \ref cfg_have_dot "HAVE_DOT" is set to \c YES, then doxygen will
generate a caller graph for that function (provided the implementation of the
function or method calls other documented functions). The caller graph will be
function or method is called by other documented functions). The caller graph will be
generated regardless of the value of \ref cfg_caller_graph "CALLER_GRAPH".
\note The completeness (and correctness) of the caller graph depends on the
doxygen code parser which is not perfect.
Expand All @@ -332,6 +336,74 @@ Structural indicators
section \ref cmdhidecallgraph "\\hidecallgraph" and
option \ref cfg_caller_graph "CALLER_GRAPH"

<hr>
\section cmdreferencedbyrelation \\referencedbyrelation

\addindex \\referencedbyrelation
When this command is put in a comment block of a function, method or variable,
then doxygen will generate an overview for that function, method, variable of
the, documented, funcions and methods that call / use it.
The overview will be generated regardless of the value of
\ref cfg_referenced_by_relation "REFERENCED_BY_RELATION".
\note The completeness (and correctness) of the overview depends on the
doxygen code parser which is not perfect.

\sa section \ref cmdreferencesrelation "\\referencesrelation",
section \ref cmdhidereferencedbyrelation "\\hidereferencedbyrelation",
section \ref cmdhidereferencesrelation "\\hidereferencesrelation" and
option \ref cfg_referenced_by_relation "REFERENCED_BY_RELATION"

<hr>
\section cmdhidereferencedbyrelation \\hidereferencedbyrelation

\addindex \\hidereferencedbyrelation
When this command is put in a comment block of a function, method or variable
then doxygen will not generate an overview for that function, method or
variable of the functions and methods that call / use it.
The overview will not be generated regardless of the value of
\ref cfg_referenced_by_relation "REFERENCED_BY_RELATION".
\note The completeness (and correctness) of the overview depends on the
doxygen code parser which is not perfect.

\sa section \ref cmdreferencesrelation "\\referencesrelation",
section \ref cmdreferencedbyrelation "\\referencedbyrelation",
section \ref cmdhidereferencesrelation "\\hidereferencesrelation" and
option \ref cfg_referenced_by_relation "REFERENCED_BY_RELATION"

<hr>
\section cmdreferencesrelation \\referencesrelation

\addindex \\referencesrelation
When this command is put in a comment block of a function or method,
then doxygen will generate an overview for that function or method of the
functions and methods that call it.
The overview will be generated regardless of the value of
\ref cfg_references_relation "REFERENCES_RELATION".
\note The completeness (and correctness) of the overview depends on the
doxygen code parser which is not perfect.

\sa section \ref cmdreferencedbyrelation "\\referencedbyrelation",
section \ref cmdhidereferencedbyrelation "\\hidereferencedbyrelation",
section \ref cmdhidereferencesrelation "\\hidereferencesrelation" and
option \ref cfg_references_relation "REFERENCES_RELATION"

<hr>
\section cmdhidereferencesrelation \\hidereferencesrelation

\addindex \\hidereferencesrelation
When this command is put in a comment block of a function or method
and then doxygen will not generate an overview for that function or method of
the functions and methods that call it.
The overview will not be generated regardless of the value of
\ref cfg_references_relation "REFERENCES_RELATION".
\note The completeness (and correctness) of the overview depends on the
doxygen code parser which is not perfect.

\sa section \ref cmdreferencesrelation "\\referencesrelation",
section \ref cmdreferencedbyrelation "\\referencedbyrelation",
section \ref cmdhidereferencedbyrelation "\\hidereferencedbyrelation" and
option \ref cfg_references_relation "REFERENCES_RELATION"

<hr>
\section cmdcategory \\category <name> [<header-file>] [<header-name>]

Expand Down Expand Up @@ -3424,4 +3496,3 @@ Go to the <a href="htmlcmds.html">next</a> section or return to the
\endhtmlonly

*/

32 changes: 32 additions & 0 deletions src/commentscan.l
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ static bool handleCallgraph(const QCString &, const QCStringList &);
static bool handleHideCallgraph(const QCString &, const QCStringList &);
static bool handleCallergraph(const QCString &, const QCStringList &);
static bool handleHideCallergraph(const QCString &, const QCStringList &);
static bool handleReferencedByRelation(const QCString &, const QCStringList &);
static bool handleHideReferencedByRelation(const QCString &, const QCStringList &);
static bool handleReferencesRelation(const QCString &, const QCStringList &);
static bool handleHideReferencesRelation(const QCString &, const QCStringList &);
static bool handleInternal(const QCString &, const QCStringList &);
static bool handleLineBr(const QCString &, const QCStringList &);
static bool handleStatic(const QCString &, const QCStringList &);
Expand Down Expand Up @@ -214,6 +218,10 @@ static DocCmdMap docCmdMap[] =
{ "hidecallgraph", &handleHideCallgraph, FALSE },
{ "callergraph", &handleCallergraph, FALSE },
{ "hidecallergraph", &handleHideCallergraph, FALSE },
{ "referencedbyrelation", &handleReferencedByRelation, FALSE },
{ "hidereferencedbyrelation", &handleHideReferencedByRelation, FALSE },
{ "referencesrelation", &handleReferencesRelation, FALSE },
{ "hidereferencesrelation", &handleHideReferencesRelation, FALSE },
{ "internal", &handleInternal, TRUE },
{ "_linebr", &handleLineBr, FALSE },
{ "static", &handleStatic, FALSE },
Expand Down Expand Up @@ -2831,6 +2839,30 @@ static bool handleHideCallergraph(const QCString &, const QCStringList &)
return FALSE;
}

static bool handleReferencedByRelation(const QCString &, const QCStringList &)
{
current->referencedByRelation = TRUE; // ON
return FALSE;
}

static bool handleHideReferencedByRelation(const QCString &, const QCStringList &)
{
current->referencedByRelation = FALSE; // OFF
return FALSE;
}

static bool handleReferencesRelation(const QCString &, const QCStringList &)
{
current->referencesRelation = TRUE; // ON
return FALSE;
}

static bool handleHideReferencesRelation(const QCString &, const QCStringList &)
{
current->referencesRelation = FALSE; // OFF
return FALSE;
}

static bool handleInternal(const QCString &, const QCStringList &)
{
if (!Config_getBool(INTERNAL_DOCS))
Expand Down
40 changes: 40 additions & 0 deletions src/context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,14 @@ class TranslateContext::Private
{
return theTranslator->trCallerGraph();
}
TemplateVariant referencedByRelation() const
{
return theTranslator->trReferencedBy();
}
TemplateVariant referencesRelation() const
{
return theTranslator->trReferences();
}
TemplateVariant inheritedFrom() const
{
return theTranslator->trInheritedFrom("@0","@1");
Expand Down Expand Up @@ -1112,6 +1120,10 @@ class TranslateContext::Private
s_inst.addProperty("callGraph", &Private::callGraph);
//%% string callerGraph
s_inst.addProperty("callerGraph", &Private::callerGraph);
//%% string referencedByRelation
s_inst.addProperty("referencedByRelation", &Private::referencedByRelation);
//%% string referencesRelation
s_inst.addProperty("referencesRelation", &Private::referencesRelation);
//%% markerstring inheritedFrom
s_inst.addProperty("inheritedFrom", &Private::inheritedFrom);
//%% string addtionalInheritedMembers
Expand Down Expand Up @@ -3994,6 +4006,10 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
s_inst.addProperty("callGraph", &Private::callGraph);
s_inst.addProperty("hasCallerGraph", &Private::hasCallerGraph);
s_inst.addProperty("callerGraph", &Private::callerGraph);
s_inst.addProperty("hasReferencedByRelation", &Private::hasReferencedByRelation);
s_inst.addProperty("referencedByRelation", &Private::referencedByRelation);
s_inst.addProperty("hasReferencesRelation", &Private::hasReferencesRelation);
s_inst.addProperty("referencesRelation", &Private::referencesRelation);
s_inst.addProperty("fieldType", &Private::fieldType);
s_inst.addProperty("type", &Private::type);
s_inst.addProperty("detailsVisibleFor", &Private::detailsVisibleFor);
Expand Down Expand Up @@ -4918,6 +4934,10 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
}
return TemplateVariant(FALSE);
}
TemplateVariant hasReferencedByRelation() const
{
return TemplateVariant(m_memberDef->hasReferencedByRelation());
}
TemplateVariant callGraph() const
{
if (hasCallGraph().toBool())
Expand Down Expand Up @@ -4958,6 +4978,14 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
return TemplateVariant("");
}
}
TemplateVariant referencedByRelation() const
{
if (hasReferencedByRelation().toBool())
{
err("context.cpp: output format not yet supported");
}
return TemplateVariant("");
}
DotCallGraph *getCallerGraph() const
{
Cachable &cache = getCache();
Expand All @@ -4978,6 +5006,10 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
}
return TemplateVariant(FALSE);
}
TemplateVariant hasReferencesRelation() const
{
return TemplateVariant(m_memberDef->hasReferencesRelation());
}
TemplateVariant callerGraph() const
{
if (hasCallerGraph().toBool())
Expand Down Expand Up @@ -5018,6 +5050,14 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
return TemplateVariant("");
}
}
TemplateVariant referencesRelation() const
{
if (hasReferencesRelation().toBool())
{
err("context.cpp: output format not yet supported");
}
return TemplateVariant("");
}
TemplateVariant type() const
{
return m_memberDef->typeString();
Expand Down
10 changes: 2 additions & 8 deletions src/definition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1446,18 +1446,12 @@ void Definition::_writeSourceRefList(OutputList &ol,const char *scopeName,

void Definition::writeSourceReffedBy(OutputList &ol,const char *scopeName)
{
if (Config_getBool(REFERENCED_BY_RELATION))
{
_writeSourceRefList(ol,scopeName,theTranslator->trReferencedBy(),m_impl->sourceRefByDict,FALSE);
}
_writeSourceRefList(ol,scopeName,theTranslator->trReferencedBy(),m_impl->sourceRefByDict,FALSE);
}

void Definition::writeSourceRefs(OutputList &ol,const char *scopeName)
{
if (Config_getBool(REFERENCES_RELATION))
{
_writeSourceRefList(ol,scopeName,theTranslator->trReferences(),m_impl->sourceRefsDict,TRUE);
}
_writeSourceRefList(ol,scopeName,theTranslator->trReferences(),m_impl->sourceRefsDict,TRUE);
}

bool Definition::hasDocumentation() const
Expand Down
Loading

0 comments on commit 0697535

Please sign in to comment.