From d3ffd31e89c05d0afa3245ccc68604baeae837a4 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sun, 15 Nov 2020 12:57:40 +0100 Subject: Refactoring: removed macros used for getting the value of settings --- src/dotcallgraph.cpp | 14 +++++--------- src/dotclassgraph.cpp | 24 +++++++++--------------- src/dotgroupcollaboration.cpp | 4 +--- 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/src/dotcallgraph.cpp b/src/dotcallgraph.cpp index ef89627..cbd62ef 100644 --- a/src/dotcallgraph.cpp +++ b/src/dotcallgraph.cpp @@ -20,10 +20,6 @@ #include "config.h" #include "util.h" -#define HIDE_SCOPE_NAMES Config_getBool(HIDE_SCOPE_NAMES) -#define DOT_GRAPH_MAX_NODES Config_getInt(DOT_GRAPH_MAX_NODES) -#define MAX_DOT_GRAPH_DEPTH Config_getInt(MAX_DOT_GRAPH_DEPTH) - static QCString getUniqueId(const MemberDef *md) { QCString result = md->getReference()+"$"+ @@ -50,7 +46,7 @@ void DotCallGraph::buildGraph(DotNode *n,const MemberDef *md,int distance) else { QCString name; - if (HIDE_SCOPE_NAMES) + if (Config_getBool(HIDE_SCOPE_NAMES)) { name = rmd->getOuterScope()==m_scope ? rmd->name() : rmd->qualifiedName(); @@ -83,7 +79,7 @@ void DotCallGraph::determineVisibleNodes(QList &queue, int &maxNodes) while (queue.count()>0 && maxNodes>0) { DotNode *n = queue.take(0); - if (!n->isVisible() && n->distance()<=MAX_DOT_GRAPH_DEPTH) // not yet processed + if (!n->isVisible() && n->distance()<=Config_getInt(MAX_DOT_GRAPH_DEPTH)) // not yet processed { n->markAsVisible(); maxNodes--; @@ -133,7 +129,7 @@ DotCallGraph::DotCallGraph(const MemberDef *md,bool inverse) m_scope = md->getOuterScope(); QCString uniqueId = getUniqueId(md); QCString name; - if (HIDE_SCOPE_NAMES) + if (Config_getBool(HIDE_SCOPE_NAMES)) { name = md->name(); } @@ -153,7 +149,7 @@ DotCallGraph::DotCallGraph(const MemberDef *md,bool inverse) m_usedNodes->insert(uniqueId,m_startNode); buildGraph(m_startNode,md,1); - int maxNodes = DOT_GRAPH_MAX_NODES; + int maxNodes = Config_getInt(DOT_GRAPH_MAX_NODES); QList openNodeQueue; openNodeQueue.append(m_startNode); determineVisibleNodes(openNodeQueue,maxNodes); @@ -210,7 +206,7 @@ bool DotCallGraph::isTrivial() const bool DotCallGraph::isTooBig() const { - return numNodes()>=DOT_GRAPH_MAX_NODES; + return numNodes()>=Config_getInt(DOT_GRAPH_MAX_NODES); } int DotCallGraph::numNodes() const diff --git a/src/dotclassgraph.cpp b/src/dotclassgraph.cpp index e157ec3..4077d5b 100644 --- a/src/dotclassgraph.cpp +++ b/src/dotclassgraph.cpp @@ -20,12 +20,6 @@ #include "config.h" #include "util.h" -#define HIDE_SCOPE_NAMES Config_getBool(HIDE_SCOPE_NAMES) -#define MAX_DOT_GRAPH_DEPTH Config_getInt(MAX_DOT_GRAPH_DEPTH) -#define UML_LOOK Config_getBool(UML_LOOK) -#define TEMPLATE_RELATIONS Config_getBool(TEMPLATE_RELATIONS) -#define DOT_GRAPH_MAX_NODES Config_getInt(DOT_GRAPH_MAX_NODES) - void DotClassGraph::addClass(const ClassDef *cd,DotNode *n,int prot, const char *label,const char *usedName,const char *templSpec,bool base,int distance) { @@ -71,7 +65,7 @@ void DotClassGraph::addClass(const ClassDef *cd,DotNode *n,int prot, else // new class { QCString displayName=className; - if (HIDE_SCOPE_NAMES) displayName=stripScope(displayName); + if (Config_getBool(HIDE_SCOPE_NAMES)) displayName=stripScope(displayName); QCString tmp_url; if (cd->isLinkable() && !cd->isHidden()) { @@ -162,7 +156,7 @@ bool DotClassGraph::determineVisibleNodes(DotNode *rootNode, { DotNode *n = childQueue.take(0); int distance = n->distance(); - if (!n->isVisible() && distance<=MAX_DOT_GRAPH_DEPTH) // not yet processed + if (!n->isVisible() && distance<=Config_getInt(MAX_DOT_GRAPH_DEPTH)) // not yet processed { if (distance>0) { @@ -191,7 +185,7 @@ bool DotClassGraph::determineVisibleNodes(DotNode *rootNode, if (includeParents && parentQueue.count()>0) { DotNode *n = parentQueue.take(0); - if ((!n->isVisible() || firstNode) && n->distance()<=MAX_DOT_GRAPH_DEPTH) // not yet processed + if ((!n->isVisible() || firstNode) && n->distance()<=Config_getInt(MAX_DOT_GRAPH_DEPTH)) // not yet processed { firstNode=FALSE; int distance = n->distance(); @@ -220,7 +214,7 @@ bool DotClassGraph::determineVisibleNodes(DotNode *rootNode, } } } - if (UML_LOOK) return FALSE; // UML graph are always top to bottom + if (Config_getBool(UML_LOOK)) return FALSE; // UML graph are always top to bottom int maxWidth=0; int maxHeight=(int)QMAX(childTreeWidth.size(),parentTreeWidth.size()); uint i; @@ -293,7 +287,7 @@ void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int dista } } } - if (TEMPLATE_RELATIONS && base) + if (Config_getBool(TEMPLATE_RELATIONS) && base) { ConstraintClassDict *dict = cd->templateTypeConstraints(); if (dict) @@ -311,7 +305,7 @@ void DotClassGraph::buildGraph(const ClassDef *cd,DotNode *n,bool base,int dista // ---- Add template instantiation relations - if (TEMPLATE_RELATIONS) + if (Config_getBool(TEMPLATE_RELATIONS)) { if (base) // template relations for base classes { @@ -376,7 +370,7 @@ DotClassGraph::DotClassGraph(const ClassDef *cd,GraphType t) buildGraph(cd,m_startNode,TRUE,1); if (t==Inheritance) buildGraph(cd,m_startNode,FALSE,1); - m_lrRank = determineVisibleNodes(m_startNode,DOT_GRAPH_MAX_NODES,t==Inheritance); + m_lrRank = determineVisibleNodes(m_startNode,Config_getInt(DOT_GRAPH_MAX_NODES),t==Inheritance); QList openNodeQueue; openNodeQueue.append(m_startNode); determineTruncatedNodes(openNodeQueue,t==Inheritance); @@ -390,12 +384,12 @@ bool DotClassGraph::isTrivial() const if (m_graphType==Inheritance) return m_startNode->children()==0 && m_startNode->parents()==0; else - return !UML_LOOK && m_startNode->children()==0; + return !Config_getBool(UML_LOOK) && m_startNode->children()==0; } bool DotClassGraph::isTooBig() const { - return numNodes()>=DOT_GRAPH_MAX_NODES; + return numNodes()>=Config_getInt(DOT_GRAPH_MAX_NODES); } int DotClassGraph::numNodes() const diff --git a/src/dotgroupcollaboration.cpp b/src/dotgroupcollaboration.cpp index 8121657..db6bd23 100644 --- a/src/dotgroupcollaboration.cpp +++ b/src/dotgroupcollaboration.cpp @@ -23,8 +23,6 @@ #include "util.h" #include "config.h" -#define DOT_TRANSPARENT Config_getBool(DOT_TRANSPARENT) - DotGroupCollaboration::DotGroupCollaboration(const GroupDef* gd) { QCString tmp_url = gd->getReference()+"$"+gd->getOutputFileBase(); @@ -379,7 +377,7 @@ void DotGroupCollaboration::writeGraphHeader(FTextStream &t,const QCString &titl } t << endl; t << "{" << endl; - if (DOT_TRANSPARENT) + if (Config_getBool(DOT_TRANSPARENT)) { t << " bgcolor=\"transparent\";" << endl; } -- cgit v0.12