summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2020-08-02 14:45:10 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2020-08-02 14:45:10 (GMT)
commitea6e16bf7f3af2ed8779df553b8fadbf396737fa (patch)
treed5de6fd41856c5b694714cdda2a62c88dcc1ebae /src
parent4f18ae106a216a465713a0c7be78105419146881 (diff)
downloadDoxygen-ea6e16bf7f3af2ed8779df553b8fadbf396737fa.zip
Doxygen-ea6e16bf7f3af2ed8779df553b8fadbf396737fa.tar.gz
Doxygen-ea6e16bf7f3af2ed8779df553b8fadbf396737fa.tar.bz2
Changed container class for class use and constrained relations from QDict<void> to StringSet
Diffstat (limited to 'src')
-rw-r--r--src/classdef.h23
-rw-r--r--src/dotclassgraph.cpp61
2 files changed, 30 insertions, 54 deletions
diff --git a/src/classdef.h b/src/classdef.h
index 46a13c1..d413794 100644
--- a/src/classdef.h
+++ b/src/classdef.h
@@ -24,6 +24,7 @@
#include <qdict.h>
#include <qptrdict.h>
+#include "containers.h"
#include "definition.h"
#include "arguments.h"
@@ -433,18 +434,15 @@ struct UsesClassDef
{
UsesClassDef(ClassDef *cd) : classDef(cd)
{
- accessors = new QDict<void>(17);
- containment = TRUE;
}
~UsesClassDef()
{
- delete accessors;
}
void addAccessor(const char *s)
{
- if (accessors->find(s)==0)
+ if (accessors.find(s)==accessors.end())
{
- accessors->insert(s,(void *)666);
+ accessors.insert(s);
}
}
/** Class definition that this relation uses. */
@@ -453,12 +451,12 @@ struct UsesClassDef
/** Dictionary of member variable names that form the edge labels of the
* usage relation.
*/
- QDict<void> *accessors;
+ StringSet accessors;
/** Template arguments used for the base class */
QCString templSpecifiers;
- bool containment;
+ bool containment = true;
};
/** Dictionary of usage relations.
@@ -486,8 +484,7 @@ class UsesClassDictIterator : public QDictIterator<UsesClassDef>
*/
struct BaseClassDef
{
- BaseClassDef(ClassDef *cd,const char *n,Protection p,
- Specifier v,const char *t) :
+ BaseClassDef(ClassDef *cd,const char *n,Protection p, Specifier v,const char *t) :
classDef(cd), usedName(n), prot(p), virt(v), templSpecifiers(t) {}
/** Class definition that this relation inherits from. */
@@ -549,17 +546,15 @@ struct ConstraintClassDef
{
ConstraintClassDef(ClassDef *cd) : classDef(cd)
{
- accessors = new QDict<void>(17);
}
~ConstraintClassDef()
{
- delete accessors;
}
void addAccessor(const char *s)
{
- if (accessors->find(s)==0)
+ if (accessors.find(s)==accessors.end())
{
- accessors->insert(s,(void *)666);
+ accessors.insert(s);
}
}
/** Class definition that this relation uses. */
@@ -568,7 +563,7 @@ struct ConstraintClassDef
/** Dictionary of member types names that form the edge labels of the
* constraint relation.
*/
- QDict<void> *accessors;
+ StringSet accessors;
};
/** Dictionary of constraint relations.
diff --git a/src/dotclassgraph.cpp b/src/dotclassgraph.cpp
index 28967f4..84b7962 100644
--- a/src/dotclassgraph.cpp
+++ b/src/dotclassgraph.cpp
@@ -239,6 +239,25 @@ bool DotClassGraph::determineVisibleNodes(DotNode *rootNode,
// left to right order.
}
+static QCString joinLabels(const StringSet &ss)
+{
+ QCString label;
+ int count=1;
+ int maxLabels=10;
+ auto it = std::begin(ss), e = std::end(ss);
+ if (it!=e) // set not empty
+ {
+ label += (*it++).c_str();
+ for (; it!=e && count < maxLabels ; ++it,++count)
+ {
+ label += '\n';
+ label += (*it).c_str();
+ }
+ if (count==maxLabels) label+="\n...";
+ }
+ return label;
+}
+
void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int distance)
{
//printf("DocClassGraph::buildGraph(%s,distance=%d,base=%d)\n",
@@ -275,27 +294,8 @@ void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int dista
UsesClassDef *ucd;
for (;(ucd=ucdi.current());++ucdi)
{
- QCString label;
- QDictIterator<void> dvi(*ucd->accessors);
- const char *s;
- bool first=TRUE;
- int count=0;
- int maxLabels=10;
- for (;(s=dvi.currentKey()) && count<maxLabels;++dvi,++count)
- {
- if (first)
- {
- label=s;
- first=FALSE;
- }
- else
- {
- label+=QCString("\n")+s;
- }
- }
- if (count==maxLabels) label+="\n...";
//printf("addClass: %s templSpec=%s\n",ucd->classDef->name().data(),ucd->templSpecifiers.data());
- addClass(ucd->classDef,n,EdgeInfo::Purple,label,0,
+ addClass(ucd->classDef,n,EdgeInfo::Purple,joinLabels(ucd->accessors),0,
ucd->templSpecifiers,base,distance);
}
}
@@ -309,27 +309,8 @@ void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int dista
ConstraintClassDef *ccd;
for (;(ccd=ccdi.current());++ccdi)
{
- QCString label;
- QDictIterator<void> dvi(*ccd->accessors);
- const char *s;
- bool first=TRUE;
- int count=0;
- int maxLabels=10;
- for (;(s=dvi.currentKey()) && count<maxLabels;++dvi,++count)
- {
- if (first)
- {
- label=s;
- first=FALSE;
- }
- else
- {
- label+=QCString("\n")+s;
- }
- }
- if (count==maxLabels) label+="\n...";
//printf("addClass: %s templSpec=%s\n",ucd->classDef->name().data(),ucd->templSpecifiers.data());
- addClass(ccd->classDef,n,EdgeInfo::Orange2,label,0,
+ addClass(ccd->classDef,n,EdgeInfo::Orange2,joinLabels(ccd->accessors),0,
0,TRUE,distance);
}
}