@@ -334,7 +334,6 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable>
334334 void writeTagFile (TextStream &) const override ;
335335
336336 int countMembersIncludingGrouped (MemberListType lt,const ClassDef *inheritedFrom,bool additional) const override ;
337- int countInheritanceNodes () const override ;
338337 int countMemberDeclarations (MemberListType lt,const ClassDef *inheritedFrom,
339338 MemberListType lt2,bool invert,bool showAlways,ClassDefSet &visitedClasses) const override ;
340339 void writeMemberDeclarations (OutputList &ol,ClassDefSet &visitedClasses,
@@ -352,6 +351,9 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable>
352351 bool hasCollaborationGraph () const override ;
353352 void overrideCollaborationGraph (bool e) override ;
354353 private:
354+ int countInheritedByNodes () const ;
355+ int countInheritsNodes () const ;
356+ int countInheritanceNodes () const ;
355357 void addUsedInterfaceClasses (MemberDef *md,const QCString &typeStr);
356358 void showUsedFiles (OutputList &ol) const ;
357359
@@ -585,8 +587,6 @@ class ClassDefAliasImpl : public DefinitionAliasMixin<ClassDef>
585587
586588 int countMembersIncludingGrouped (MemberListType lt,const ClassDef *inheritedFrom,bool additional) const override
587589 { return getCdAlias ()->countMembersIncludingGrouped (lt,inheritedFrom,additional); }
588- int countInheritanceNodes () const override
589- { return getCdAlias ()->countInheritanceNodes (); }
590590 int countMemberDeclarations (MemberListType lt,const ClassDef *inheritedFrom,
591591 MemberListType lt2,bool invert,bool showAlways,ClassDefSet &visitedClasses) const override
592592 { return getCdAlias ()->countMemberDeclarations (lt,inheritedFrom,lt2,invert,showAlways,visitedClasses); }
@@ -1659,14 +1659,20 @@ void ClassDefImpl::showUsedFiles(OutputList &ol) const
16591659 ol.popGeneratorState ();
16601660}
16611661
1662- int ClassDefImpl::countInheritanceNodes () const
1662+ int ClassDefImpl::countInheritedByNodes () const
16631663{
16641664 int count=0 ;
16651665 for (const auto &ibcd : m_impl->inheritedBy )
16661666 {
16671667 const ClassDef *icd=ibcd.classDef ;
16681668 if ( icd->isVisibleInHierarchy ()) count++;
16691669 }
1670+ return count;
1671+ }
1672+
1673+ int ClassDefImpl::countInheritsNodes () const
1674+ {
1675+ int count=0 ;
16701676 for (const auto &ibcd : m_impl->inherits )
16711677 {
16721678 const ClassDef *icd=ibcd.classDef ;
@@ -1675,14 +1681,19 @@ int ClassDefImpl::countInheritanceNodes() const
16751681 return count;
16761682}
16771683
1684+ int ClassDefImpl::countInheritanceNodes () const
1685+ {
1686+ return countInheritedByNodes ()+countInheritsNodes ();
1687+ }
1688+
16781689void ClassDefImpl::writeInheritanceGraph (OutputList &ol) const
16791690{
16801691 bool haveDot = Config_getBool (HAVE_DOT);
16811692 auto classGraph = m_impl->typeInheritanceGraph ;
16821693
16831694 if (classGraph == CLASS_GRAPH_t::NO) return ;
16841695 // count direct inheritance relations
1685- const int count=countInheritanceNodes ();
1696+ int count=countInheritanceNodes ();
16861697
16871698 bool renderDiagram = FALSE ;
16881699 if (haveDot && (classGraph==CLASS_GRAPH_t::YES || classGraph==CLASS_GRAPH_t::GRAPH))
@@ -1723,62 +1734,83 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const
17231734 ol.disableAllBut (OutputType::Man);
17241735 }
17251736
1726- if (!m_impl->inherits .empty ())
1737+ count = countInheritsNodes ();
1738+ if (count>0 )
17271739 {
17281740 auto replaceFunc = [this ,&ol](size_t entryIndex)
17291741 {
1730- const BaseClassDef &bcd=m_impl->inherits [entryIndex];
1731- const ClassDef *cd=bcd.classDef ;
1742+ for (size_t index=0 ; index<m_impl->inherits .size () ; index++)
1743+ {
1744+ const BaseClassDef &bcd=m_impl->inherits [index];
1745+ const ClassDef *cd=bcd.classDef ;
17321746
1733- // use the class name but with the template arguments as given
1734- // in the inheritance relation
1735- QCString displayName = insertTemplateSpecifierInScope (
1736- cd->displayName (),bcd.templSpecifiers );
1747+ if (cd->isVisibleInHierarchy ()) // filter on the class we want to show
1748+ {
1749+ if (index==entryIndex) // found the requested index
1750+ {
1751+ // use the class name but with the template arguments as given
1752+ // in the inheritance relation
1753+ QCString displayName = insertTemplateSpecifierInScope (
1754+ cd->displayName (),bcd.templSpecifiers );
17371755
1738- if (cd->isLinkable ())
1739- {
1740- ol.writeObjectLink (cd->getReference (),
1741- cd->getOutputFileBase (),
1742- cd->anchor (),
1743- displayName);
1744- }
1745- else
1746- {
1747- ol.docify (displayName);
1756+ if (cd->isLinkable ())
1757+ {
1758+ ol.writeObjectLink (cd->getReference (),
1759+ cd->getOutputFileBase (),
1760+ cd->anchor (),
1761+ displayName);
1762+ }
1763+ else
1764+ {
1765+ ol.docify (displayName);
1766+ }
1767+ return ;
1768+ }
1769+ }
17481770 }
17491771 };
17501772
17511773 ol.startParagraph ();
17521774 writeMarkerList (ol,
1753- theTranslator->trInheritsList (static_cast < int >(m_impl-> inherits . size ()) ).str (),
1754- m_impl-> inherits . size ( ),
1775+ theTranslator->trInheritsList (count ).str (),
1776+ static_cast < size_t >(count ),
17551777 replaceFunc);
17561778 ol.endParagraph ();
17571779 }
17581780
17591781 // write subclasses
1760- if (!m_impl->inheritedBy .empty ())
1782+ count = countInheritedByNodes ();
1783+ if (count>0 )
17611784 {
1762-
17631785 auto replaceFunc = [this ,&ol](size_t entryIndex)
17641786 {
1765- const BaseClassDef &bcd=m_impl->inheritedBy [entryIndex];
1766- const ClassDef *cd=bcd.classDef ;
1767- if (cd->isLinkable ())
1768- {
1769- ol.writeObjectLink (cd->getReference (),cd->getOutputFileBase (),cd->anchor (),cd->displayName ());
1770- }
1771- else
1787+ for (size_t index=0 ; index<m_impl->inheritedBy .size () ; index++)
17721788 {
1773- ol.docify (cd->displayName ());
1789+ const BaseClassDef &bcd=m_impl->inheritedBy [index];
1790+ const ClassDef *cd=bcd.classDef ;
1791+ if (cd->isVisibleInHierarchy ()) // filter on the class we want to show
1792+ {
1793+ if (index==entryIndex) // found the requested index
1794+ {
1795+ if (cd->isLinkable ())
1796+ {
1797+ ol.writeObjectLink (cd->getReference (),cd->getOutputFileBase (),cd->anchor (),cd->displayName ());
1798+ writeInheritanceSpecifier (ol,bcd);
1799+ }
1800+ else
1801+ {
1802+ ol.docify (cd->displayName ());
1803+ }
1804+ return ;
1805+ }
1806+ }
17741807 }
1775- writeInheritanceSpecifier (ol,bcd);
17761808 };
17771809
17781810 ol.startParagraph ();
17791811 writeMarkerList (ol,
1780- theTranslator->trInheritedByList (static_cast < int >(m_impl-> inheritedBy . size ()) ).str (),
1781- m_impl-> inheritedBy . size ( ),
1812+ theTranslator->trInheritedByList (count ).str (),
1813+ static_cast < size_t >(count ),
17821814 replaceFunc);
17831815 ol.endParagraph ();
17841816 }
0 commit comments