Doxygen
Loading...
Searching...
No Matches
dotnode.cpp File Reference
#include "dotnode.h"
#include "classdef.h"
#include "config.h"
#include "language.h"
#include "membergroup.h"
#include "memberlist.h"
#include "textstream.h"
#include "util.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

DString escapeTooltip (const DString &tooltip)
static void writeBoxMemberList (TextStream &t, char prot, const MemberList *ml, const ClassDef *scope, bool &lineWritten, bool isStatic=false, const StringUnorderedSet *skipNames=nullptr)
static DString stripProtectionPrefix (const DString &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 919 of file dotnode.cpp.

Function Documentation

◆ escapeTooltip()

DString escapeTooltip ( const DString & tooltip)

Definition at line 101 of file dotnode.cpp.

102{
103 if (tooltip.empty()) return tooltip;
104 DString result;
105 const char *p=tooltip.data();
106 char c = 0;
107 while ((c=*p++))
108 {
109 switch(c)
110 {
111 case '"': result+="\\\""; break;
112 case '\\': result+="\\\\"; break;
113 default: result+=c; break;
114 }
115 }
116 return result;
117}
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition dstring.h:84
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition dstring.h:148
const char * data() const
Returns a pointer to the contents of the string in the form of a 0-terminated C string.
Definition dstring.h:157

References DString::data(), and DString::empty().

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

◆ stripProtectionPrefix()

DString stripProtectionPrefix ( const DString & s)
static

Definition at line 316 of file dotnode.cpp.

317{
318 if (!s.empty() && (s[0]=='-' || s[0]=='+' || s[0]=='~' || s[0]=='#'))
319 {
320 return s.mid(1);
321 }
322 else
323 {
324 return s;
325 }
326}
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:318

References DString::empty(), and DString::mid().

Referenced by DotNode::writeLabel().

◆ writeBoxMemberList()

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 119 of file dotnode.cpp.

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

References Config_getEnum, Config_getInt, DotNode::convertLabel(), DotNode::List, theTranslator, Translator::trAndMore(), 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 48 of file dotnode.cpp.

◆ normalEdgeColorMap

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

mapping from protection levels to color names

Definition at line 37 of file dotnode.cpp.

◆ normalEdgeProps

EdgeProperties normalEdgeProps
static
Initial value:
=
{
}
static const char * normalEdgeColorMap[]
Definition dotnode.cpp:37
static const char * normalEdgeStyleMap[]
Definition dotnode.cpp:58
static const char * normalArrowStyleMap[]
Definition dotnode.cpp:48

Definition at line 91 of file dotnode.cpp.

Referenced by DotNode::writeArrow().

◆ normalEdgeStyleMap

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

Definition at line 58 of file dotnode.cpp.

◆ umlArrowStyleMap

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

Definition at line 75 of file dotnode.cpp.

◆ umlEdgeColorMap

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

Definition at line 64 of file dotnode.cpp.

◆ umlEdgeProps

EdgeProperties umlEdgeProps
static
Initial value:
=
{
}
static const char * umlEdgeStyleMap[]
Definition dotnode.cpp:85
static const char * umlEdgeColorMap[]
Definition dotnode.cpp:64
static const char * umlArrowStyleMap[]
Definition dotnode.cpp:75

Definition at line 96 of file dotnode.cpp.

Referenced by DotNode::writeArrow().

◆ umlEdgeStyleMap

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

Definition at line 85 of file dotnode.cpp.