Skip to content

Commit d3ffd31

Browse files
committed
Refactoring: removed macros used for getting the value of settings
1 parent 62e55b7 commit d3ffd31

File tree

3 files changed

+15
-27
lines changed

3 files changed

+15
-27
lines changed

src/dotcallgraph.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
#include "config.h"
2121
#include "util.h"
2222

23-
#define HIDE_SCOPE_NAMES Config_getBool(HIDE_SCOPE_NAMES)
24-
#define DOT_GRAPH_MAX_NODES Config_getInt(DOT_GRAPH_MAX_NODES)
25-
#define MAX_DOT_GRAPH_DEPTH Config_getInt(MAX_DOT_GRAPH_DEPTH)
26-
2723
static QCString getUniqueId(const MemberDef *md)
2824
{
2925
QCString result = md->getReference()+"$"+
@@ -50,7 +46,7 @@ void DotCallGraph::buildGraph(DotNode *n,const MemberDef *md,int distance)
5046
else
5147
{
5248
QCString name;
53-
if (HIDE_SCOPE_NAMES)
49+
if (Config_getBool(HIDE_SCOPE_NAMES))
5450
{
5551
name = rmd->getOuterScope()==m_scope ?
5652
rmd->name() : rmd->qualifiedName();
@@ -83,7 +79,7 @@ void DotCallGraph::determineVisibleNodes(QList<DotNode> &queue, int &maxNodes)
8379
while (queue.count()>0 && maxNodes>0)
8480
{
8581
DotNode *n = queue.take(0);
86-
if (!n->isVisible() && n->distance()<=MAX_DOT_GRAPH_DEPTH) // not yet processed
82+
if (!n->isVisible() && n->distance()<=Config_getInt(MAX_DOT_GRAPH_DEPTH)) // not yet processed
8783
{
8884
n->markAsVisible();
8985
maxNodes--;
@@ -133,7 +129,7 @@ DotCallGraph::DotCallGraph(const MemberDef *md,bool inverse)
133129
m_scope = md->getOuterScope();
134130
QCString uniqueId = getUniqueId(md);
135131
QCString name;
136-
if (HIDE_SCOPE_NAMES)
132+
if (Config_getBool(HIDE_SCOPE_NAMES))
137133
{
138134
name = md->name();
139135
}
@@ -153,7 +149,7 @@ DotCallGraph::DotCallGraph(const MemberDef *md,bool inverse)
153149
m_usedNodes->insert(uniqueId,m_startNode);
154150
buildGraph(m_startNode,md,1);
155151

156-
int maxNodes = DOT_GRAPH_MAX_NODES;
152+
int maxNodes = Config_getInt(DOT_GRAPH_MAX_NODES);
157153
QList<DotNode> openNodeQueue;
158154
openNodeQueue.append(m_startNode);
159155
determineVisibleNodes(openNodeQueue,maxNodes);
@@ -210,7 +206,7 @@ bool DotCallGraph::isTrivial() const
210206

211207
bool DotCallGraph::isTooBig() const
212208
{
213-
return numNodes()>=DOT_GRAPH_MAX_NODES;
209+
return numNodes()>=Config_getInt(DOT_GRAPH_MAX_NODES);
214210
}
215211

216212
int DotCallGraph::numNodes() const

src/dotclassgraph.cpp

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,6 @@
2020
#include "config.h"
2121
#include "util.h"
2222

23-
#define HIDE_SCOPE_NAMES Config_getBool(HIDE_SCOPE_NAMES)
24-
#define MAX_DOT_GRAPH_DEPTH Config_getInt(MAX_DOT_GRAPH_DEPTH)
25-
#define UML_LOOK Config_getBool(UML_LOOK)
26-
#define TEMPLATE_RELATIONS Config_getBool(TEMPLATE_RELATIONS)
27-
#define DOT_GRAPH_MAX_NODES Config_getInt(DOT_GRAPH_MAX_NODES)
28-
2923
void DotClassGraph::addClass(const ClassDef *cd,DotNode *n,int prot,
3024
const char *label,const char *usedName,const char *templSpec,bool base,int distance)
3125
{
@@ -71,7 +65,7 @@ void DotClassGraph::addClass(const ClassDef *cd,DotNode *n,int prot,
7165
else // new class
7266
{
7367
QCString displayName=className;
74-
if (HIDE_SCOPE_NAMES) displayName=stripScope(displayName);
68+
if (Config_getBool(HIDE_SCOPE_NAMES)) displayName=stripScope(displayName);
7569
QCString tmp_url;
7670
if (cd->isLinkable() && !cd->isHidden())
7771
{
@@ -162,7 +156,7 @@ bool DotClassGraph::determineVisibleNodes(DotNode *rootNode,
162156
{
163157
DotNode *n = childQueue.take(0);
164158
int distance = n->distance();
165-
if (!n->isVisible() && distance<=MAX_DOT_GRAPH_DEPTH) // not yet processed
159+
if (!n->isVisible() && distance<=Config_getInt(MAX_DOT_GRAPH_DEPTH)) // not yet processed
166160
{
167161
if (distance>0)
168162
{
@@ -191,7 +185,7 @@ bool DotClassGraph::determineVisibleNodes(DotNode *rootNode,
191185
if (includeParents && parentQueue.count()>0)
192186
{
193187
DotNode *n = parentQueue.take(0);
194-
if ((!n->isVisible() || firstNode) && n->distance()<=MAX_DOT_GRAPH_DEPTH) // not yet processed
188+
if ((!n->isVisible() || firstNode) && n->distance()<=Config_getInt(MAX_DOT_GRAPH_DEPTH)) // not yet processed
195189
{
196190
firstNode=FALSE;
197191
int distance = n->distance();
@@ -220,7 +214,7 @@ bool DotClassGraph::determineVisibleNodes(DotNode *rootNode,
220214
}
221215
}
222216
}
223-
if (UML_LOOK) return FALSE; // UML graph are always top to bottom
217+
if (Config_getBool(UML_LOOK)) return FALSE; // UML graph are always top to bottom
224218
int maxWidth=0;
225219
int maxHeight=(int)QMAX(childTreeWidth.size(),parentTreeWidth.size());
226220
uint i;
@@ -293,7 +287,7 @@ void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int dista
293287
}
294288
}
295289
}
296-
if (TEMPLATE_RELATIONS && base)
290+
if (Config_getBool(TEMPLATE_RELATIONS) && base)
297291
{
298292
ConstraintClassDict *dict = cd->templateTypeConstraints();
299293
if (dict)
@@ -311,7 +305,7 @@ void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int dista
311305

312306
// ---- Add template instantiation relations
313307

314-
if (TEMPLATE_RELATIONS)
308+
if (Config_getBool(TEMPLATE_RELATIONS))
315309
{
316310
if (base) // template relations for base classes
317311
{
@@ -376,7 +370,7 @@ DotClassGraph::DotClassGraph(const ClassDef *cd,GraphType t)
376370
buildGraph(cd,m_startNode,TRUE,1);
377371
if (t==Inheritance) buildGraph(cd,m_startNode,FALSE,1);
378372

379-
m_lrRank = determineVisibleNodes(m_startNode,DOT_GRAPH_MAX_NODES,t==Inheritance);
373+
m_lrRank = determineVisibleNodes(m_startNode,Config_getInt(DOT_GRAPH_MAX_NODES),t==Inheritance);
380374
QList<DotNode> openNodeQueue;
381375
openNodeQueue.append(m_startNode);
382376
determineTruncatedNodes(openNodeQueue,t==Inheritance);
@@ -390,12 +384,12 @@ bool DotClassGraph::isTrivial() const
390384
if (m_graphType==Inheritance)
391385
return m_startNode->children()==0 && m_startNode->parents()==0;
392386
else
393-
return !UML_LOOK && m_startNode->children()==0;
387+
return !Config_getBool(UML_LOOK) && m_startNode->children()==0;
394388
}
395389

396390
bool DotClassGraph::isTooBig() const
397391
{
398-
return numNodes()>=DOT_GRAPH_MAX_NODES;
392+
return numNodes()>=Config_getInt(DOT_GRAPH_MAX_NODES);
399393
}
400394

401395
int DotClassGraph::numNodes() const

src/dotgroupcollaboration.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#include "util.h"
2424
#include "config.h"
2525

26-
#define DOT_TRANSPARENT Config_getBool(DOT_TRANSPARENT)
27-
2826
DotGroupCollaboration::DotGroupCollaboration(const GroupDef* gd)
2927
{
3028
QCString tmp_url = gd->getReference()+"$"+gd->getOutputFileBase();
@@ -379,7 +377,7 @@ void DotGroupCollaboration::writeGraphHeader(FTextStream &t,const QCString &titl
379377
}
380378
t << endl;
381379
t << "{" << endl;
382-
if (DOT_TRANSPARENT)
380+
if (Config_getBool(DOT_TRANSPARENT))
383381
{
384382
t << " bgcolor=\"transparent\";" << endl;
385383
}

0 commit comments

Comments
 (0)