Doxygen
Loading...
Searching...
No Matches
dotnode.cpp File Reference
#include "dotnode.h"
#include "classdef.h"
#include "config.h"
#include "memberlist.h"
#include "membergroup.h"
#include "language.h"
#include "doxygen.h"
#include "util.h"
#include "textstream.h"
+ Include dependency graph for dotnode.cpp:

Go to the source code of this file.

Classes

struct  EdgeProperties
 Helper struct holding the properties of a edge in a dot graph. More...
 

Macros

#define DEBUG_RENUMBERING   0
 

Functions

QCString escapeTooltip (const QCString &tooltip)
 
static void writeBoxMemberList (TextStream &t, char prot, const MemberList *ml, const ClassDef *scope, bool &lineWritten, bool isStatic=FALSE, const StringUnorderedSet *skipNames=nullptr)
 
static QCString stripProtectionPrefix (const QCString &s)
 

Variables

static const char * normalEdgeColorMap []
 
static const char * normalArrowStyleMap []
 
static const char * normalEdgeStyleMap []
 
static const char * umlEdgeColorMap []
 
static const char * umlArrowStyleMap []
 
static const char * umlEdgeStyleMap []
 
static EdgeProperties normalEdgeProps
 
static EdgeProperties umlEdgeProps
 

Macro Definition Documentation

◆ DEBUG_RENUMBERING

#define DEBUG_RENUMBERING   0

Definition at line 895 of file dotnode.cpp.

Function Documentation

◆ escapeTooltip()

QCString escapeTooltip ( const QCString & tooltip)

Definition at line 99 of file dotnode.cpp.

100{
101 if (tooltip.isEmpty()) return tooltip;
102 QCString result;
103 const char *p=tooltip.data();
104 char c = 0;
105 while ((c=*p++))
106 {
107 switch(c)
108 {
109 case '"': result+="\\\""; break;
110 case '\\': result+="\\\\"; break;
111 default: result+=c; break;
112 }
113 }
114 return result;
115}
This is an alternative implementation of QCString.
Definition qcstring.h:101
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition qcstring.h:159

References QCString::data(), and QCString::isEmpty().

Referenced by common_attributes(), and DotNode::writeBox().

◆ stripProtectionPrefix()

static QCString stripProtectionPrefix ( const QCString & s)
static

Definition at line 290 of file dotnode.cpp.

291{
292 if (!s.isEmpty() && (s[0]=='-' || s[0]=='+' || s[0]=='~' || s[0]=='#'))
293 {
294 return s.mid(1);
295 }
296 else
297 {
298 return s;
299 }
300}
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:226

References QCString::isEmpty(), and QCString::mid().

Referenced by DotNode::writeLabel().

◆ writeBoxMemberList()

static void writeBoxMemberList ( TextStream & t,
char prot,
const MemberList * ml,
const ClassDef * scope,
bool & lineWritten,
bool isStatic = FALSE,
const StringUnorderedSet * skipNames = nullptr )
static

Definition at line 117 of file dotnode.cpp.

121{
122 constexpr auto tr_start = "<TR><TD VALIGN=\"top\" CELLPADDING=\"1\" CELLSPACING=\"0\">";
123 constexpr auto tr_mid = "</TD><TD VALIGN=\"top\" ALIGN=\"LEFT\" CELLPADDING=\"1\" CELLSPACING=\"0\">";
124 constexpr auto tr_end = "</TD></TR>\n";
125 constexpr auto br = "<BR ALIGN=\"LEFT\"/>";
126 if (ml)
127 {
128 auto hideUndocMembers = Config_getEnum(HIDE_UNDOC_MEMBERS);
129 int totalCount=0;
130 for (const auto &mma : *ml)
131 {
132 if (mma->getClassDef()==scope &&
133 (skipNames==nullptr || skipNames->find(mma->name().str())==std::end(*skipNames)) &&
134 !(hideUndocMembers && !mma->hasDocumentation())
135 )
136 {
137 totalCount++;
138 }
139 }
140
141 int count=0;
142 auto dotUmlDetails = Config_getEnum(DOT_UML_DETAILS);
143 for (const auto &mma : *ml)
144 {
145 if (mma->getClassDef() == scope &&
146 (skipNames==nullptr || skipNames->find(mma->name().str())==std::end(*skipNames)) &&
147 !(hideUndocMembers && !mma->hasDocumentation())
148 )
149 {
150 int numFields = Config_getInt(UML_LIMIT_NUM_FIELDS);
151 if (numFields>0 && (totalCount>numFields*3/2 && count>=numFields))
152 {
153 t << tr_start << tr_mid << theTranslator->trAndMore(QCString().sprintf("%d",totalCount-count)) << tr_end;
154 lineWritten = true;
155 break;
156 }
157 else
158 {
159 t << tr_start << prot << tr_mid;
160 QCString label;
161 if (dotUmlDetails==DOT_UML_DETAILS_t::YES)
162 {
163 label+=mma->typeString();
164 label+=" ";
165 }
166 label+=mma->name();
167 if (!mma->isObjCMethod() && (mma->isFunction() || mma->isSlot() || mma->isSignal()))
168 {
169 if (dotUmlDetails==DOT_UML_DETAILS_t::YES)
170 {
171 label+=mma->argsString();
172 }
173 else
174 {
175 label+="()";
176 }
177 }
178 t << DotNode::convertLabel(label,true);
179 t << br << tr_end;
180 lineWritten = true;
181 count++;
182 }
183 }
184 }
185 // write member groups within the memberlist
186 for (const auto &mg : ml->getMemberGroupList())
187 {
188 if (!mg->members().empty())
189 {
190 writeBoxMemberList(t,prot,&mg->members(),scope,lineWritten,isStatic,skipNames);
191 }
192 }
193 }
194}
static QCString convertLabel(const QCString &, bool htmlLike=false)
Definition dotnode.cpp:196
#define Config_getInt(name)
Definition config.h:34
#define Config_getEnum(name)
Definition config.h:35
static void writeBoxMemberList(TextStream &t, char prot, const MemberList *ml, const ClassDef *scope, bool &lineWritten, bool isStatic=FALSE, const StringUnorderedSet *skipNames=nullptr)
Definition dotnode.cpp:117
Translator * theTranslator
Definition language.cpp:71

References Config_getEnum, Config_getInt, DotNode::convertLabel(), FALSE, theTranslator, and writeBoxMemberList().

Referenced by writeBoxMemberList(), and DotNode::writeLabel().

Variable Documentation

◆ normalArrowStyleMap

const char* normalArrowStyleMap[]
static
Initial value:
=
{
"empty",
"empty",
"empty",
"open",
nullptr,
nullptr
}

Definition at line 46 of file dotnode.cpp.

47{
48 "empty", // Public
49 "empty", // Protected
50 "empty", // Private
51 "open", // "use" relation
52 nullptr, // Undocumented
53 nullptr // template relation
54};

◆ normalEdgeColorMap

const char* normalEdgeColorMap[]
static
Initial value:
=
{
"steelblue1",
"darkgreen",
"firebrick4",
"darkorchid3",
"grey75",
"orange",
"orange"
}

mapping from protection levels to color names

Definition at line 35 of file dotnode.cpp.

36{
37 "steelblue1", // Public
38 "darkgreen", // Protected
39 "firebrick4", // Private
40 "darkorchid3", // "use" relation
41 "grey75", // Undocumented
42 "orange", // template relation
43 "orange" // type constraint
44};

◆ normalEdgeProps

EdgeProperties normalEdgeProps
static
Initial value:
=
{
}
static const char * normalEdgeColorMap[]
Definition dotnode.cpp:35
static const char * normalEdgeStyleMap[]
Definition dotnode.cpp:56
static const char * normalArrowStyleMap[]
Definition dotnode.cpp:46

Definition at line 89 of file dotnode.cpp.

Referenced by DotNode::writeArrow().

◆ normalEdgeStyleMap

const char* normalEdgeStyleMap[]
static
Initial value:
=
{
"solid",
"dashed"
}

Definition at line 56 of file dotnode.cpp.

57{
58 "solid", // inheritance
59 "dashed" // usage
60};

◆ umlArrowStyleMap

const char* umlArrowStyleMap[]
static
Initial value:
=
{
"onormal",
"onormal",
"onormal",
"odiamond",
nullptr,
nullptr
}

Definition at line 73 of file dotnode.cpp.

74{
75 "onormal", // Public
76 "onormal", // Protected
77 "onormal", // Private
78 "odiamond", // "use" relation
79 nullptr, // Undocumented
80 nullptr // template relation
81};

◆ umlEdgeColorMap

const char* umlEdgeColorMap[]
static
Initial value:
=
{
"steelblue1",
"darkgreen",
"firebrick4",
"steelblue1",
"grey75",
"orange",
"orange"
}

Definition at line 62 of file dotnode.cpp.

63{
64 "steelblue1", // Public
65 "darkgreen", // Protected
66 "firebrick4", // Private
67 "steelblue1", // "use" relation
68 "grey75", // Undocumented
69 "orange", // template relation
70 "orange" // type constraint
71};

◆ umlEdgeProps

EdgeProperties umlEdgeProps
static
Initial value:
=
{
}
static const char * umlEdgeStyleMap[]
Definition dotnode.cpp:83
static const char * umlEdgeColorMap[]
Definition dotnode.cpp:62
static const char * umlArrowStyleMap[]
Definition dotnode.cpp:73

Definition at line 94 of file dotnode.cpp.

Referenced by DotNode::writeArrow().

◆ umlEdgeStyleMap

const char* umlEdgeStyleMap[]
static
Initial value:
=
{
"solid",
"solid"
}

Definition at line 83 of file dotnode.cpp.

84{
85 "solid", // inheritance
86 "solid" // usage
87};